X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fvserver.functions;h=260bd6e474637fca92969f25c1d3da00b3056122;hb=69c048e18d1630eea2d5c55f7c5acbdcacba846e;hp=6570993263575bc8c388c755e06fe561ef94778b;hpb=93c4a7d40d5bedb16f2cdc9f8fb7629418275a9f;p=util-vserver.git diff --git a/scripts/vserver.functions b/scripts/vserver.functions index 6570993..260bd6e 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -73,6 +73,22 @@ else SILENT_OPT='--silent' fi +function _readFileToArray +{ + local _rfta_f="$1" + local _rfta_a="$2" + local _rfta_p="$3" + local _rfta_v + + test -e "$_rfta_f" || return 0 + while read _rfta_v; do + case x"$_rfta_v" in + (x|x\#*) ;; + (*) eval "$_rfta_a=( \"\${$_rfta_a[@]}\" $_rfta_p \"$_rfta_v\" )";; + esac + done <"$_rfta_f" +} + function _generateChbindOptions { local vdir="$1" @@ -87,12 +103,15 @@ function _generateChbindOptions getFileValue nid "$vdir/ncontext" "$vdir/context" - CHBIND_OPTS=( $SILENT_OPT ${nid:+--nid "$nid"} ${bcast:+--bcast "$bcast"} ) + CHBIND_OPTS=( $SILENT_OPT --secure ${nid:+--nid "$nid"} ${bcast:+--bcast "$bcast"} ) for i in "${INTERFACES[@]}"; do CHBIND_OPTS=( "${CHBIND_OPTS[@]}" --ip "$i" ) done + _readFileToArray "$vdir"/nflags CHBIND_OPTS --flag + _readFileToArray "$vdir"/ncapabilities CHBIND_OPTS --ncap + _HAVE_CHBIND_OPTIONS=1 } @@ -139,31 +158,15 @@ function _generatePersonalityOptions function _generateCCapabilityOptions { local vdir=$1 - local cap - local f="$vdir"/ccapabilities - - test -e "$f" || return 0 - while read cap; do - case x"$cap" in - (x|x\#*) ;; - (*) OPTS_VATTRIBUTE=( "${OPTS_VATTRIBUTE[@]}" --ccap "$cap" );; - esac - done <"$f" + + _readFileToArray "$vdir"/ccapabilities OPTS_VATTRIBUTE --ccap } function _generateBCapabilityOptions { local vdir=$1 - local cap - local f="$vdir"/bcapabilities - - test -e "$f" || return 0 - while read cap; do - case x"$cap" in - (x|x\#*) ;; - (*) OPTS_VATTRIBUTE=( "${OPTS_VATTRIBUTE[@]}" --bcap "$cap" );; - esac - done <"$f" + + _readFileToArray "$vdir"/bcapabilities OPTS_VATTRIBUTE --bcap } function _generateCapabilityOptions @@ -247,7 +250,8 @@ function _generateInitOptions CHCONTEXT_INIT_OPTS=() - getFileValue INITSTYLE "$cfgdir"/style + test x"$INITSTYLE" = xrescue || \ + getFileValue INITSTYLE "$cfgdir"/style getFileValue RUNLEVEL_START "$cfgdir"/runlevel getFileValue RUNLEVEL_START "$cfgdir"/runlevel.start getFileValue RUNLEVEL_STOP "$cfgdir"/runlevel.stop @@ -262,8 +266,6 @@ function _generateInitOptions (xrescue) INITCMD_START=( "${INITCMD_RESCUE[@]}" ) INITCMD_STOP=( /sbin/killall5 ) - _IS_FAKEINIT=1 - _NEED_VSHELPER_SYNC= ;; (xsysv) @@ -1070,7 +1072,7 @@ WARNING: There is no cachedirectory configured for this vserver; panic $"\ /proc/uptime can not be accessed. Usually, this is caused by procfs-security. Please read the FAQ for more details -http://www.linux-vserver.org/index.php?page=Linux-Vserver+FAQ" +http://linux-vserver.org/Proc-Security" } @@ -1197,7 +1199,7 @@ function _namespaceCleanup # these are things that have to be accessible post-cleanup for tmp in "$root" "$__SBINDIR" "$__PKGLIBDIR" "$vdir" \ - "$__PKGSTATEDIR" "${skip[@]}"; do + "$__PKGSTATEDIR" "`pwd`" "${skip[@]}"; do while test -n "$tmp"; do list=( "${list[@]}" "$tmp" ) tmp="${tmp%/*}"