From ca07a4105556eae7e370fd619d4c8463d6214996 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Mon, 3 Nov 2003 19:37:38 +0000 Subject: [PATCH] - fixed some statements which would fail with 'set -e' - made 'disableInterface' smart so that it calculates parameters automatically git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@349 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/scripts/vserver.functions | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/util-vserver/scripts/vserver.functions b/util-vserver/scripts/vserver.functions index 111d23a..7c74f46 100644 --- a/util-vserver/scripts/vserver.functions +++ b/util-vserver/scripts/vserver.functions @@ -37,6 +37,7 @@ declare -a INITKILL_SEQ=() declare -a ENTER_SHELL=() INTERFACE_CMDS_IDX=0 +_HAVE_INTERFACE_OPTIONS= INITSTYLE=sysv @@ -225,9 +226,9 @@ function _generateChcontextOptions local flag { - read ctx <"$vdir"/context - read hostname <"$vdir"/hostname - read domainname <"$vdir"/domainname + read ctx <"$vdir"/context || : + read hostname <"$vdir"/hostname || : + read domainname <"$vdir"/domainname || : } 2>/dev/null test -z "$S_CONTEXT" || ctx=$S_CONTEXT @@ -340,6 +341,7 @@ function _generateInterfaceOptions _processSingleInterface "$iface" done + _HAVE_INTERFACE_OPTIONS=1 } function enableInterfaces @@ -366,11 +368,13 @@ function enableInterfaces function disableInterfaces { + test "$_HAVE_INTERFACE_OPTIONS" || _generateInterfaceOptions "$1" + local i=$INTERFACE_CMDS_IDX declare -a var while test $i -gt 0; do - let --i + let --i || : eval var='( "${INTERFACE_CMDS_'$i'[@]}" )' local type=${var[0]} -- 1.8.1.5