added some doc
[util-vserver.git] / util-vserver / scripts / vserver.functions
index d666cbc..5892446 100644 (file)
@@ -240,6 +240,11 @@ function _generateInitOptions
            test -z "$runlevel_stop"  || INITCMD_STOP=(  "${INITCMD_STOP[@]}"  "$runlevel_stop"  )
            ;;
 
+       (xgentoo)
+           INITCMD_START=( /sbin/rc default  )
+           INITCMD_STOP=(  /sbin/rc shutdown )
+           ;;
+
        (x) ;;
        (*) echo "Unknown init-style '$INITSTYLE'; aborting" >&2;
            exit 1;;
@@ -494,6 +499,15 @@ function generateOptions
     _generateChcontextOptions  "$1"
 }
 
+function _mountVserverInternal
+{
+    local fstab="$1"
+    test -e "$fstab" || return 0
+    shift
+    
+    "$@" $_SECURE_MOUNT -a --chroot "$vdir" --fstab "$fstab"
+}
+
 function mountVserver
 {
     local cfgdir=$1
@@ -501,7 +515,8 @@ function mountVserver
     local vdir=$1/vdir
     local mtab_src
 
-    test -e "$cfgdir"/fstab || return 0
+    test -e "$cfgdir"/fstab -o \
+         -e "$cfgdir"/fstab.local || return 0
 
     findObject -r mtab_src "$vdir"/apps/init/mtab "$CONFDIR"/.defaults/init/mtab "$PKGLIBDEFAULTDIR"/mtab /dev/null
     
@@ -513,36 +528,50 @@ function mountVserver
 
     test -z "$NAMESPACE_CLEANUP" || isAvoidNamespace "$cfgdir" || \
        $_VNAMESPACE --cleanup
-       
-    $_CHBIND "${CHBIND_OPTS[@]}" \
-       $_SECURE_MOUNT -a --chroot "$vdir" --fstab "$cfgdir"/fstab
+
+    _mountVserverInternal "$cfgdir"/fstab       $_CHBIND "${CHBIND_OPTS[@]}"
+    _mountVserverInternal "$cfgdir"/fstab.local
 
     isAvoidNamespace "$cfgdir" || \
        $_SECURE_MOUNT --rbind -n "$vdir" "/"
 }
 
+function _umountVserverInternal
+{
+    local fstab="$1"
+    test -e "$fstab" || return 0
+    shift
+
+    tac "$fstab" | {
+       is_ok=1
+       while read src dst tmp; do
+           test "$tmp" || continue
+           case x"$src" in
+               (x\#*)  continue;;
+           esac
+
+       
+           "$@" $_EXEC_CD "$dst" $_UMOUNT -lfn . || is_ok=
+       done
+       test "$is_ok"
+    }
+}
+
 function umountVserver
 {
     local cfgdir=$1
     local vdir=$1/vdir
+    local is_ok=1
 
-    is_ok=1
-
-    isAvoidNamespace "$cfgdir"   || return 0
-    test -e "$cfgdir"/fstab      || return 0
-    test "$_HAVE_CHBIND_OPTIONS" || _generateChbindOptions "$cfgdir"
+    isAvoidNamespace "$cfgdir"    || return 0
+    test -e "$cfgdir"/fstab -o \
+         -e "$cfgdir"/fstab.local || return 0
+    test "$_HAVE_CHBIND_OPTIONS"  || _generateChbindOptions "$cfgdir"
     
-    pushd "$vdir/" >/dev/null
-    tac "$cfgdir"/fstab | while read src dst tmp; do
-       test "$tmp" || continue
-       case x"$src" in
-           (x\#*)      continue;;
-       esac
-
-       $_CHBIND "${CHBIND_OPTS[@]}" $_EXEC_CD "$dst" \
-           $_UMOUNT -lfn . || is_ok=
-    done
-    popd >/dev/null
+    pushd "$vdir/" >/dev/null || return 1
+       _umountVserverInternal  "$cfgdir"/fstab.local                              || is_ok=
+       _umountVserverInternal  "$cfgdir"/fstab       $_CHBIND "${CHBIND_OPTS[@]}" || is_ok=
+    popd >/dev/null           || return 1
 
     test "$is_ok"
 }