gentoo: use /var/run for new /run compatibility
[util-vserver.git] / scripts / vserver-setup.functions
index 3996d68..b535203 100644 (file)
@@ -34,8 +34,8 @@ declare -a SETUP_FLAGS=()
 
 declare -r SETUP_OPTIONS="confdir:,lockfile:,hostname:,netdev:,netmask:,netprefix:,netbcast:,interface:,flags:,context:,initstyle:,cpuset:,cpusetcpus:,cpusetmems:,cpusetvirt"
 declare -r SETUP_HELPMSG=$"
-    --context   ...  the static context of the vserver [default: none; a dynamic
-                     context will be assumed]
+    --context   ...  the static context of the vserver [default: none; one will
+                     be generated for you]
     --confdir   ...  [default: $__CONFDIR/<name>]
     --lockfile <filename>
                ...  [default: $__RUNDIR/<name>]
@@ -133,9 +133,14 @@ function _setup_writeInterface
 
     tmp=${tmp##${name}=}
     local dev=${tmp%%:*}
-    test "$dev" != "$tmp" || dev=
+    local nodev=
+    test "$dev" != "$tmp"  || dev=
 
     tmp=${tmp##${dev}:}
+    test "$dev" != "nodev" || {
+       dev=
+       nodev=1
+    }
     local mask=${tmp##*/}
     test "$mask" != "$tmp"  || mask=
 
@@ -157,7 +162,8 @@ function _setup_writeInterface
     _setup_writeSingleOption "$prefix" $d/prefix
 
     test -n "$dev" -o -n "$SETUP_NETDEV" || {
-       echo $"No device specified for interface '$idx'; setting 'nodev'" >&2
+       test -n "$nodev" || \
+           echo $"No device specified for interface '$idx'; setting 'nodev'" >&2
        $_TOUCH $d/nodev
     }
 }
@@ -214,7 +220,7 @@ function setup_writeOption
 
     test -z "$SETUP_FLAGS" || for i in "${SETUP_FLAGS[@]}"; do
        echo "$i"
-    done >"$cfgdir"/flags
+    done >"$cfgdir"/cflags
 
     ln -s "$SETUP_LOCKFILE"   "$cfgdir"/run
 }