# 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
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"
ROOTDIR=
ROOTDIR_REL=
-PKGCFGBASE=
-PKGCFGBASE_REL=
VSERVERDIRNAME=
VDIR=
}
}
-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
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'"
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
{
_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" /
}
# 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"
done
}
-function initVariablesApt
+function apt.initVariables
{
:
}
-function initFilesystemApt
+function apt.initFilesystem
{
mkdir -p "$PKGCFGDIR"/apt/{etc,archives/partial,cache,state/lists/partial}
RPMDB_PATH=
RPMLIBDIR=
-function importGPGPubKeys
+function rpm.importGPGPubKeys
{
local dst=$1
local pkgs
"$_VRPM" "$dst" -- --import "${pkgs[@]}"
}
-function initVariablesRPM
+function rpm.initVariables
{
test "$WORKAROUND_106057" && \
RPMDB_PATH=/.rpmdb || \
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"