mirror of
git://github.com/lxc/lxc
synced 2025-09-01 14:15:23 +00:00
lxc-plamo: various small changes
- Change redirection of fd 200 to 9 (greater than 9 may conflict with fd the shell uses internally) - Replace numeric line addressing of ed to regular expression to avoid correcting the line addressing at each modification of init scripts - Correct the option order (trivial) Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp> Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp> Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
committed by
Serge Hallyn
parent
271d94a3da
commit
ffeb76b460
@@ -112,7 +112,7 @@ copy_plamo() {
|
|||||||
install_plamo() {
|
install_plamo() {
|
||||||
mkdir -p @LOCALSTATEDIR@/lock/subsys
|
mkdir -p @LOCALSTATEDIR@/lock/subsys
|
||||||
(
|
(
|
||||||
if ! flock -n 200 ; then
|
if ! flock -n 9 ; then
|
||||||
echo "Cache repository is busy."
|
echo "Cache repository is busy."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -143,7 +143,7 @@ install_plamo() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
) 200> @LOCALSTATEDIR@/lock/subsys/lxc-plamo
|
) 9> @LOCALSTATEDIR@/lock/subsys/lxc-plamo
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_plamo() {
|
configure_plamo() {
|
||||||
@@ -207,17 +207,17 @@ configure_plamo() {
|
|||||||
echo "Please change root password!"
|
echo "Please change root password!"
|
||||||
# /etc/rc.d/rc.S
|
# /etc/rc.d/rc.S
|
||||||
ed - $rootfs/etc/rc.d/rc.S <<- "EOF"
|
ed - $rootfs/etc/rc.d/rc.S <<- "EOF"
|
||||||
230,261d
|
/^mount -w -n -t proc/;/^# ln -s \/bin\/true/-1d
|
||||||
156,163d
|
/^mknod \/dev\/unikey/;/^# Clean \/etc\/mtab/-2d
|
||||||
26,147d
|
/^# copy the rules/;/^# Set the hostname/-1d
|
||||||
16,22d
|
/^# Check the integrity/;/^# Clean up temporary/-1d
|
||||||
w
|
w
|
||||||
EOF
|
EOF
|
||||||
# /etc/rc.d/rc.M
|
# /etc/rc.d/rc.M
|
||||||
ed - $rootfs/etc/rc.d/rc.M <<- "EOF"
|
ed - $rootfs/etc/rc.d/rc.M <<- "EOF"
|
||||||
269,270d
|
/^# Screen blanks/;/^# Initialize ip6tables/-1d
|
||||||
56,82d
|
/^# Initialize sysctl/;/^echo "Starting services/-1d
|
||||||
31,38d
|
/^sync/;/^# All done/-1d
|
||||||
w
|
w
|
||||||
EOF
|
EOF
|
||||||
# /etc/rc.d/rc.inet1.tradnet
|
# /etc/rc.d/rc.inet1.tradnet
|
||||||
@@ -285,7 +285,7 @@ cleanup() {
|
|||||||
[ -d $dlcache -a -d $rtcache ] || return 0
|
[ -d $dlcache -a -d $rtcache ] || return 0
|
||||||
# lock, so we won't purge while someone is creating a repository
|
# lock, so we won't purge while someone is creating a repository
|
||||||
(
|
(
|
||||||
if ! flock -n 200 ; then
|
if ! flock -n 9 ; then
|
||||||
echo "Cache repository is busy."
|
echo "Cache repository is busy."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -293,17 +293,17 @@ cleanup() {
|
|||||||
rm -rf --one-file-system $dlcache $rtcache || return 1
|
rm -rf --one-file-system $dlcache $rtcache || return 1
|
||||||
echo "Done."
|
echo "Done."
|
||||||
return 0
|
return 0
|
||||||
) 200> @LOCALSTATEDIR@/lock/subsys/lxc-plamo
|
) 9> @LOCALSTATEDIR@/lock/subsys/lxc-plamo
|
||||||
}
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<- EOF
|
cat <<- EOF
|
||||||
$prog [-h|--help] -p|--path=<path> -n|--name=<name> --rootfs=<rootfs>
|
$prog [-h|--help] -p|--path=<path> -n|--name=<name> --rootfs=<rootfs>
|
||||||
[--clean] [-r|--release=<release>] [-b|--bindhome=<user>]
|
[--clean] [-r|--release=<release>] [-a|--arch=<arch>]
|
||||||
[-a|--arch=<arch>]
|
[-b|--bindhome=<user>]
|
||||||
release: $release
|
release: $release
|
||||||
bindhome: bind <user>'s home into the container
|
|
||||||
arch: x86 or x86_64: defaults to host arch
|
arch: x86 or x86_64: defaults to host arch
|
||||||
|
bindhome: bind <user>'s home into the container
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,10 +311,10 @@ prog=`basename $0`
|
|||||||
path="" ; name="" ; rootfs=""
|
path="" ; name="" ; rootfs=""
|
||||||
clean=0
|
clean=0
|
||||||
release=${release:-5.x}
|
release=${release:-5.x}
|
||||||
bindhome=""
|
|
||||||
arch=`uname -m | sed 's/i.86/x86/'` ; hostarch=$arch
|
arch=`uname -m | sed 's/i.86/x86/'` ; hostarch=$arch
|
||||||
sopts=hp:n:cr:b:a:
|
bindhome=""
|
||||||
lopts=help,path:,name:,rootfs:,clean,release:,bindhome:,arch:
|
sopts=hp:n:cr:a:b:
|
||||||
|
lopts=help,path:,name:,rootfs:,clean,release:,arch:,bindhome:
|
||||||
if ! options=`getopt -o $sopts -l $lopts -- "$@"` ; then
|
if ! options=`getopt -o $sopts -l $lopts -- "$@"` ; then
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
@@ -328,8 +328,8 @@ while true ; do
|
|||||||
--rootfs) rootfs=$2 ; shift 2 ;;
|
--rootfs) rootfs=$2 ; shift 2 ;;
|
||||||
-c|--clean) clean=1 ; shift 1 ;;
|
-c|--clean) clean=1 ; shift 1 ;;
|
||||||
-r|--release) release=$2 ; shift 2 ;;
|
-r|--release) release=$2 ; shift 2 ;;
|
||||||
-b|--bindhome) bindhome=$2 ; shift 2 ;;
|
|
||||||
-a|--arch) arch=$2 ; shift 2 ;;
|
-a|--arch) arch=$2 ; shift 2 ;;
|
||||||
|
-b|--bindhome) bindhome=$2 ; shift 2 ;;
|
||||||
--) shift 1 ; break ;;
|
--) shift 1 ; break ;;
|
||||||
*) break ;;
|
*) break ;;
|
||||||
esac
|
esac
|
||||||
|
Reference in New Issue
Block a user