From: Enrico Scholz Date: Tue, 3 Feb 2004 21:57:25 +0000 (+0000) Subject: splitted some functions into a separate vserver-build.functions.pkgmgmt file X-Git-Tag: VERSION_0_10~774 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16eafb4fda7a2946dbcc9ca52f4cf7f68383e873;hp=e2e324637059ed62ee276753ecd573f93fc76dd3;p=util-vserver.git splitted some functions into a separate vserver-build.functions.pkgmgmt file use XXX.yyy namespace-style notation git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@771 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/util-vserver/scripts/vserver-build.apt-rpm b/util-vserver/scripts/vserver-build.apt-rpm index 792c4b5..bd05fd0 100644 --- a/util-vserver/scripts/vserver-build.apt-rpm +++ b/util-vserver/scripts/vserver-build.apt-rpm @@ -15,11 +15,12 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -tmp=$(getopt -o +d: -n "$0" -- "$@") || exit 1 +tmp=$(getopt -o +d: --long debug -n "$0" -- "$@") || exit 1 eval set -- "$tmp" . "$_LIB_VSERVER_BUILD_FUNCTIONS_RPM" . "$_LIB_VSERVER_BUILD_FUNCTIONS_APT" +. "$_LIB_VSERVER_BUILD_FUNCTIONS_PKGMGMT" while true; do case "$1" in @@ -36,19 +37,21 @@ done getDistribution initVariables -initVariablesRPM -initVariablesApt +pkgmgmt.initVariables +rpm.initVariables +apt.initVariables -initFilesystem "$OPTION_FORCE" -initFilesystemRPM -initFilesystemApt +initFilesystem "$OPTION_FORCE" +pkgmgmt.initFilesystem "$OPTION_FORCE" +rpm.initFilesystem +apt.initFilesystem setup_writeOption "$VSERVER_NAME" setup_writeInitialFstab test -z "$BUILD_INITPRE" || "$BUILD_INITPRE" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS" -importGPGPubKeys "$VSERVER_NAME" "$CONFDIR/.distributions/$DISTRIBUTION/pubkeys" "$DISTRIBDIR/$DISTRIBUTION/pubkeys" +rpm.importGPGPubKeys "$VSERVER_NAME" "$CONFDIR/.distributions/$DISTRIBUTION/pubkeys" "$DISTRIBDIR/$DISTRIBUTION/pubkeys" "$_VAPT_GET" "$SETUP_CONFDIR" -- update -installBasePackages "$SETUP_CONFDIR" "$PKGDIR" +apt.installBasePackages "$SETUP_CONFDIR" "$PKGDIR" "$_VAPT_GET" "$SETUP_CONFDIR" -- dist-upgrade -y test -z "$BUILD_INITPOST" || "$BUILD_INITPOST" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS" diff --git a/util-vserver/scripts/vserver-build.functions b/util-vserver/scripts/vserver-build.functions index dc699f5..8a85849 100644 --- a/util-vserver/scripts/vserver-build.functions +++ b/util-vserver/scripts/vserver-build.functions @@ -20,8 +20,6 @@ ROOTDIR= ROOTDIR_REL= -PKGCFGBASE= -PKGCFGBASE_REL= VSERVERDIRNAME= VDIR= @@ -86,31 +84,6 @@ function _setRootDir } } -function _setPkgCfgBase -{ - test -z "$PKGCFGBASE" || return 0 - - for item in "\"$CONFDIR/.defaults/apps/pkgmgmt/base\" 1" "$ROOTDIR/.pkg" "$DEFAULT_VSERVERPKGDIR"; do - eval set -- "$item" - PKGCFGBASE=$1 - PKGCFGBASE_REL=$2 - test ! -d "$PKGCFGBASE" || break - done - - test -d "$PKGCFGBASE" || { - echo "pkgcfgbase-dir '$PKGCFGBASE' does not exists or is invalid" - exit 1 - } -} - -function _setPkgCfg -{ - _setPkgCfgBase - - test -z "$PKGCFGDIR" || return 0 - PKGCFGDIR="$PKGCFGBASE/$VSERVERDIRNAME" -} - function _setVserverDir { test -z "$VSERVERDIRNAME" || return 0 @@ -133,7 +106,7 @@ function _renameVserverCfg local suffix=.~$(date +'%s')~ local i - for i in "$VDIR" "$SETUP_CONFDIR" "$PKGCFGDIR"; do + for i in "$VDIR" "$SETUP_CONFDIR"; do test ! -e "$i" || { mv "$i" "$i$suffix" say "Renamed '$i' to '$i$suffix'" @@ -171,16 +144,10 @@ function initFilesystem exit 1 } >&2 - mkdir -p "$SETUP_CONFDIR"/apps/pkgmgmt "$VDIR"/{dev/pts,etc} "$SETUP_LOCKREVDIR" + mkdir -p "$SETUP_CONFDIR"/apps "$VDIR"/{dev/pts,etc} "$SETUP_LOCKREVDIR" ln -s "$VDIR" "$SETUP_CONFDIR/vdir" - test -z "$PKGCFGDIR" || { - ln -s "$PKGCFGDIR" "$SETUP_CONFDIR/apps/pkgmgmt/base" - - test "$_EXECDIR" = / || ln -s "$_EXECDIR" "$confdir/apps/pkgmgmt/execdir" - } - local spec while read spec; do makeDevEntry "$VDIR"/dev $spec @@ -198,12 +165,10 @@ function initVariables { _setRootDir _setVserverDir - _setPkgCfg _setVdir findFile _DEV_FILE "$CONFDIR/.distributions/$DISTRIBUTION/devs" "$DISTRIBDIR/$DISTRIBUTION/devs" "$DISTRIBDIR/defaults/devs" findDir _EXECDIR "$CONFDIR/.distributions/$DISTRIBUTION/execdir" "$DISTRIBDIR/$DISTRIBUTION/execdir" / findFile BUILD_INITPRE "$CONFDIR/.distributions/$DISTRIBUTION/initpre" "$DISTRIBDIR/$DISTRIBUTION/initpre" "" findFile BUILD_INITPOST "$CONFDIR/.distributions/$DISTRIBUTION/initpost" "$DISTRIBDIR/$DISTRIBUTION/initpost" "" - findDir PKGDIR "$CONFDIR/.distributions/$DISTRIBUTION/pkgs" "$DISTRIBDIR/$DISTRIBUTION/pkgs" / } diff --git a/util-vserver/scripts/vserver-build.functions.apt b/util-vserver/scripts/vserver-build.functions.apt index 3d9e3af..bd270d2 100644 --- a/util-vserver/scripts/vserver-build.functions.apt +++ b/util-vserver/scripts/vserver-build.functions.apt @@ -15,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -function installBasePackages +function apt.installBasePackages { local name="$1" local dir="$2" @@ -40,12 +40,12 @@ function installBasePackages done } -function initVariablesApt +function apt.initVariables { : } -function initFilesystemApt +function apt.initFilesystem { mkdir -p "$PKGCFGDIR"/apt/{etc,archives/partial,cache,state/lists/partial} diff --git a/util-vserver/scripts/vserver-build.functions.rpm b/util-vserver/scripts/vserver-build.functions.rpm index ec6a081..6eec6c3 100644 --- a/util-vserver/scripts/vserver-build.functions.rpm +++ b/util-vserver/scripts/vserver-build.functions.rpm @@ -18,7 +18,7 @@ RPMDB_PATH= RPMLIBDIR= -function importGPGPubKeys +function rpm.importGPGPubKeys { local dst=$1 local pkgs @@ -39,7 +39,7 @@ function importGPGPubKeys "$_VRPM" "$dst" -- --import "${pkgs[@]}" } -function initVariablesRPM +function rpm.initVariables { test "$WORKAROUND_106057" && \ RPMDB_PATH=/.rpmdb || \ @@ -48,7 +48,7 @@ function initVariablesRPM findDir RPMLIBDIR "$CONFDIR/.distributions/$DISTRIBUTION/rpmlib" "$DISTRIBDIR/$DISTRIBUTION/rpmlib" / } -function initFilesystemRPM +function rpm.initFilesystem { test -z "$WORKAROUND_106057" || mkdir -p "$RPMDB_PATH" mkdir -p "$VDIR$RPMDB_PATH"