X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fscripts%2Fpkgmgmt;h=dc58391354e7f8e3890c4f70abae796335b67691;hb=e3be43e3ee2157a63ea175463629c2433f595854;hp=a641dfbddd652c3f40c0752fa751aa5aa156ced9;hpb=dfd7c5abfa53e81582a7ca7e88f6ab82dda39085;p=util-vserver.git diff --git a/util-vserver/scripts/pkgmgmt b/util-vserver/scripts/pkgmgmt index a641dfb..dc58391 100755 --- a/util-vserver/scripts/pkgmgmt +++ b/util-vserver/scripts/pkgmgmt @@ -24,6 +24,7 @@ test -e "$UTIL_VSERVER_VARS" || { . "$UTIL_VSERVER_VARS" . "$_LIB_FUNCTIONS" . "$_LIB_VSERVER_BUILD_FUNCTIONS_PKGMGMT" +. "$PKGLIBDIR/vserver.functions" function showHelp() { @@ -120,6 +121,45 @@ function _unhashAuto() rm -f $tmp } +function _mountFilesystemsInternal() +{ + local fstab="$1" + test -e "$fstab" || return 0 + shift + + "$@" $_SECURE_MOUNT -n -a --chroot "$vdir" --fstab "$fstab" +} + +function _mountFilesystems() +{ + local cfgdir=$($_VSERVER_INFO "$1" CFGDIR) || { + echo "Can not determine configuration directory for '$1'; ..." >&2 + return 1 + } + test "$_HAVE_CHBIND_OPTIONS" || _generateChbindOptions "$1" + + _mountFilesystemsInternal "$cfgdir"/fstab $_CHBIND "${CHBIND_OPTS[@]}" || return 1 + _mountFilesystemsInternal "$cfgdir"/fstab.local $_CHBIND "${CHBIND_OPTS[@]}" || return 1 +} + +function _umountFilesystems() +{ + local cfgdir=$($_VSERVER_INFO "$1" CFGDIR) || { + echo "Can not determine configuration directory for '$1'; ..." >&2 + return 1 + } + local vdir=$cfgdir/vdir + local is_ok=1 + test "$_HAVE_CHBIND_OPTIONS" || _generateChbindOptions "$1" + + 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" +} + function processVserver_RH() { local vserver=$1 @@ -290,6 +330,7 @@ function processVserver() test -z "$skip" || return 1 local style + _mountFilesystems "$vserver" || return 1 pkgmgmt.guessStyle "$vserver" style || return 1 case "$style" in @@ -299,6 +340,8 @@ function processVserver() echo $"Vserver style '$style' is not supported for packagemanagment" >&2 return 1 esac + + _umountFilesystems "$vserver" || return 1 } tmp=$(getopt -o y --long debug,externalize,internalize,help,version -n "$0" -- "$@") || exit 1