X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fpkgmgmt;h=2da1b1e18a6b2015f1e412aefff4bce86491f153;hb=dbbb75087e2a59a419e8c3ef76458f3262dfe8cd;hp=5cf54dcdaf67ccbec0b6378f3618e55c98dc3609;hpb=816eac39a39ff4775f280cf8b2a45e07eb663002;p=util-vserver.git diff --git a/scripts/pkgmgmt b/scripts/pkgmgmt index 5cf54dc..2da1b1e 100755 --- a/scripts/pkgmgmt +++ b/scripts/pkgmgmt @@ -23,6 +23,7 @@ test -e "$UTIL_VSERVER_VARS" || { } . "$UTIL_VSERVER_VARS" . "$_LIB_FUNCTIONS" +. "$_LIB_VSERVER_BUILD_FUNCTIONS" . "$_LIB_VSERVER_BUILD_FUNCTIONS_PKGMGMT" . "$__PKGLIBDIR/vserver.functions" @@ -54,7 +55,6 @@ function init() else rpmdb_mntpoint=/.rpmdb fi - pkgmgmt.initVariables } function _createDirs() @@ -160,9 +160,9 @@ function _mountFilesystems() } test -n "$_HAVE_CHBIND_OPTIONS" || _generateChbindOptions "$1" - _mountFilesystemsInternal "$cfgdir"/fstab || return 1 - _mountFilesystemsInternal "$cfgdir"/fstab.local || return 1 - _mountFilesystemsInternal "$cfgdir"/fstab.remote $_CHBIND "${CHBIND_OPTS[@]}" || return 1 + _mountFilesystemsInternal "$cfgdir"/fstab || return 1 + _mountFilesystemsInternal "$cfgdir"/fstab.local || return 1 + _mountFilesystemsInternal "$cfgdir"/fstab.remote "${CHBIND_CMD[@]}" || return 1 } function _umountFilesystems() @@ -177,9 +177,9 @@ function _umountFilesystems() test -n "$_HAVE_CHBIND_OPTIONS" || _generateChbindOptions "$1" pushd "$vdir/" >/dev/null || return 1 - _umountVserverInternal "$cfgdir"/fstab.remote $_CHBIND "${CHBIND_OPTS[@]}" || is_ok= - _umountVserverInternal "$cfgdir"/fstab.local || is_ok= - _umountVserverInternal "$cfgdir"/fstab || is_ok= + _umountVserverInternal "$cfgdir"/fstab.remote "${CHBIND_CMD[@]}" || is_ok= + _umountVserverInternal "$cfgdir"/fstab.local || is_ok= + _umountVserverInternal "$cfgdir"/fstab || is_ok= popd >/dev/null || return 1 test -n "$is_ok" @@ -195,7 +195,7 @@ packagemanagement: " case $2 in - (RH) pkgs=$(vrpm "$1" -- -q --qf '---%{NAME}---\n' rpm apt yum "${YUM_RELEASEPKGS[@]}") + (RH) pkgs=$(vrpm "$1" -- -q --qf '---%{NAME}---\n' rpm apt yum urpmi "${YUM_RELEASEPKGS[@]}") hasSubstring "$pkgs" ---rpm--- || { warning "$ERR * The vserver does not seem to have the 'rpm' package which is required @@ -205,7 +205,7 @@ packagemanagement: ERR= } - hasSubstring "$pkgs" ---apt--- ---yum--- || { + hasSubstring "$pkgs" ---apt--- ---yum--- ---urpmi--- || { warning "$ERR * The vserver does not seem to have a depsolver like 'apt' or 'yum' installed. It is suggested to install such a program before setting @@ -214,7 +214,8 @@ packagemanagement: ERR= } - test -n "$have_apt" || test -z "$have_yum" || \ + test -n "$have_apt" || test -n "$have_urpmi" || + test -z "$have_yum" || \ hasSubstring "$pkgs" "${YUM_RELEASEPKGS[@]}" || { warning "$ERR * yum requires a special package which describes the version of the @@ -235,6 +236,8 @@ function processVserver_RH() local vserver=$1 local is_internalize=$2 local have_apt + local have_yum + local have_urpmi local cfgdir local i @@ -244,8 +247,10 @@ function processVserver_RH() ## Figure out the environment.... have_apt=1 have_yum=1 + have_urpmi=1 pkgmgmt.isAptAvailable "$cfgdir" "$vdir" "$is_internalize" || have_apt= pkgmgmt.isYumAvailable "$cfgdir" "$vdir" "$is_internalize" || have_yum= + pkgmgmt.isUrpmiAvailable "$cfgdir" "$vdir" "$is_internalize" || have_urpmi= local APTETCDIR= local APTSTATEDIR= @@ -280,11 +285,16 @@ Can not continue; use '--force' to override this check" popd >/dev/null if test -n "$have_apt"; then - findDir APTETCDIR "$cfgdir"/aptetc "$cfgdir"/base/apt/etc /etc/apt / + findDir APTETCDIR "$cfgdir"/aptetc "$cfgdir"/base/apt/etc /etc/apt / + elif test -n "$have_urpmi"; then + findDir URPMISTATEDIR "$cfgdir"/base/var/lib/urpmi + findDir URPMIETCDIR "$cfgdir"/base/etc/urpmi fi - findDir RPMETCDIR "$cfgdir"/rpmetc "$cfgdir"/base/rpm/etc /etc/rpm / - findDir RPMSTATEDIR "$cfgdir"/rpmstate "$cfgdir"/base/rpm/state + findDir RPMETCDIR "$cfgdir"/rpmetc "$cfgdir"/base/rpm/etc \ + "$cfgdir"/base/etc/rpm /etc/rpm / + findDir RPMSTATEDIR "$cfgdir"/rpmstate "$cfgdir"/base/rpm/state \ + "$cfgdir"/base/var/lib/rpm else mkdir -m755 -p "$cfgdir" local need_base= @@ -327,6 +337,9 @@ Can not continue; use '--force' to override this check" pushd "$vdir" >/dev/null _hashAuto /etc/apt/apt.conf '/' popd >/dev/null + elif test -n "$have_urpmi"; then + _copySecure "$vdir" "$URPMISTATEDIR" /var/lib/urpmi + _copySecure "$vdir" "$URPMIETCDIR" /etc/urpmi fi _copySecure "$vdir" "$RPMETCDIR" /etc/rpm @@ -398,6 +411,11 @@ function processVserver() echo $"Vserver '$vserver' does not seem to exist; skipping it..." return 1 } >&2 + + _setVserverDir "$vserver" + _setVserverName + _setVserverDirName + pkgmgmt.initVariables pkgmgmt.isInternal "$vserver" || is_external=1