splitted some functions into a separate vserver-build.functions.pkgmgmt file
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 3 Feb 2004 21:57:25 +0000 (21:57 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 3 Feb 2004 21:57:25 +0000 (21:57 +0000)
use XXX.yyy namespace-style notation

git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@771 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/scripts/vserver-build.apt-rpm
util-vserver/scripts/vserver-build.functions
util-vserver/scripts/vserver-build.functions.apt
util-vserver/scripts/vserver-build.functions.rpm

index 792c4b5..bd05fd0 100644 (file)
 # 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"
index dc699f5..8a85849 100644 (file)
@@ -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"     /
 }
index 3d9e3af..bd270d2 100644 (file)
@@ -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}
     
index ec6a081..6eec6c3 100644 (file)
@@ -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"