X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fvserver.functions;h=752bd854533444ee25a40d5b1f65da0dc8575a45;hb=b0ff6a1c514a1705967cc5aa784d564a7417301c;hp=c6fa4b5a50bf78b3325b6d141f414b8525058b99;hpb=754434fee29f02326853e656fbf0a6bea5c63ea4;p=util-vserver.git diff --git a/scripts/vserver.functions b/scripts/vserver.functions index c6fa4b5..752bd85 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -42,6 +42,7 @@ declare -a OPTS_VCONTEXT_MIGRATE=() declare -a OPTS_VCONTEXT_ENTER=() declare -a OPTS_VATTRIBUTE=( --flag fakeinit ) declare -a OPTS_VSCHED=() +declare -a OPTS_ENV=() declare -a STOPCMD_PREPARE=() @@ -252,6 +253,11 @@ function _generateInitOptions getFileValue RUNLEVEL_STOP "$cfgdir"/runlevel.stop getFileArray INITKILL_SEQ "$cfgdir"/killseq || : + findFile _gio_env "$cfgdir"/environment \ + "$__CONFDIR"/.defaults/apps/init/environment \ + "$__PKGLIBDEFAULTDIR"/environment + getFileArray OPTS_ENV "$_gio_env" || : + case x"$INITSTYLE" in (xrescue) INITCMD_START=( "${INITCMD_RESCUE[@]}" ) @@ -527,7 +533,11 @@ function _processSingleInterface echo -e $"VLAN device-name used, but vlan subsystem not enabled.\nTry to execute 'modprobe 8021q' before starting the vservers" >&2 return 1 } - test -f /proc/net/vlan -o -e "$iface"/novlandev || { + test -e "$iface/vlandev" \ + -o \( -e "$iface/../vlandev" -a ! -e "$iface/novlandev" \) \ + -o \( -e "$__CONFDIR/.defaults/interfaces/vlandev" \ + -a ! -e "$iface/novlandev" \ + -a ! -e "$iface/../novlandev" \) && { _addInterfaceCmd VCONFIG $vlan_info } fi @@ -790,13 +800,13 @@ function mountVserver test -n "$_HAVE_CHBIND_OPTIONS" || _generateChbindOptions "$cfgdir" - test -z "$NAMESPACE_CLEANUP" || isAvoidNamespace "$cfgdir" || \ - $_VNAMESPACE --cleanup - _mountVserverInternal "$cfgdir"/fstab _mountVserverInternal "$cfgdir"/fstab.local _mountVserverInternal "$cfgdir"/fstab.remote $_CHBIND "${CHBIND_OPTS[@]}" + isNamespaceCleanup "$cfgdir" && \ + _namespaceCleanup + isAvoidNamespace "$cfgdir" || \ $_SECURE_MOUNT --rbind -n "$vdir" "/" } @@ -1148,3 +1158,29 @@ function saveDiskLimits _saveSingleDiskLimit "$vdir" "$dlimit" done } + +function _namespaceCleanup +{ + local root=$(readlink -f "$vdir") + local tmp="$root" + local -a list + while [ "$tmp" ]; do + list=( "${list[@]}" "$tmp" ) + tmp="${tmp%/*}" + done + local -a list_umount + while read dev path opts; do + [ "$path" ] || continue + for i in "$root" /dev /proc; do + [ "${path#$i}" != "$path" ] && continue 2 + done + for i in "${list[@]}" /; do + [ "$path" = "$i" ] && continue 2 + done + list_umount=( "${list_umount[@]}" "$path" ) + done < /proc/mounts + for i in "${list_umount[@]}"; do + umount -l -n "$i" + done +} +