- fixed some statements which would fail with 'set -e'
[util-vserver.git] / util-vserver / scripts / vserver.functions
index 111d23a..7c74f46 100644 (file)
@@ -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]}