_LIB_VSERVER_BUILD_FUNCTIONS_APT="$__PKGLIBDIR/vserver-build.functions.apt"
_LIB_VSERVER_BUILD_FUNCTIONS_RPM="$__PKGLIBDIR/vserver-build.functions.rpm"
_LIB_VSERVER_BUILD_FUNCTIONS_YUM="$__PKGLIBDIR/vserver-build.functions.yum"
+_LIB_VSERVER_BUILD_FUNCTIONS_URPMI="$__PKGLIBDIR/vserver-build.functions.urpmi"
_LIB_VSERVER_BUILD_FUNCTIONS_PKGMGMT="$__PKGLIBDIR/vserver-build.functions.pkgmgmt"
_LISTDEVIP="$__LEGACYDIR/listdevip"
_LOCKFILE="$__PKGLIBDIR/lockfile"
--- /dev/null
+# $Id$ --*- sh -*--
+
+# Copyright (C) 2011 Daniel Hokka Zakrisson <daniel@hozac.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+function urpmi.initVariables
+{
+ if test -z "$MIRROR"; then
+ getFileValue MIRROR "$__CONFDIR/.distributions/$DISTRIBUTION/mirror" \
+ "$__DISTRIBDIR/$DISTRIBUTION/mirror"
+ if test -z "$MIRROR"; then
+ panic $"vserver-build.urpmi: --mirror argument required"
+ fi
+ fi
+}
+
+function urpmi.initFilesystem
+{
+ $_MKDIR -p "$PKGCFGDIR"/var/lib/urpmi "$PKGCFGDIR"/etc/urpmi
+}
+
+function urpmi.installPackages
+{
+ local name="$1"
+ local dir="$2"
+
+ test "$dir" != / || return 0
+ for filelist in "$dir"/*; do
+ isRegularFile "$filelist" || continue
+ local idx=0
+ local can_fail=false
+ local flags=
+
+ set -- $(<$filelist)
+ while test "$#" -gt 0; do
+ case "$1" in
+ --reinstall) flags='';;
+ --can-fail) can_fail=true;;
+ *) break;;
+ esac
+ shift
+ done
+ "$_VURPM" urpmi "$name" -- $flags $* || $can_fail
+ "$_VYUM" "$name" -- -y install $flags $* || $can_fail
+ done
+}
eval set -- "$tmp"
. "$_LIB_VSERVER_BUILD_FUNCTIONS_PKGMGMT"
+. "$_LIB_VSERVER_BUILD_FUNCTIONS_RPM"
+. "$_LIB_VSERVER_BUILD_FUNCTIONS_URPMI"
DISTRIBUTION=
MIRROR=
MIRRORLIST=
-PKGS=( basesystem-minimal )
while true; do
case "$1" in
-d) DISTRIBUTION=$2; shift;;
shift
done
-if test -z "$MIRROR"; then
- panic $"vserver-build.urpmi: --mirror argument required"
-fi
-
-if test "$#" -gt 0; then
- PKGS=( "$@" )
-fi
-
getDistribution
base.init
pkgmgmt.initVariables
-
+rpm.initVariables
+urpmi.initVariables
base.initFilesystem "$OPTION_FORCE"
pkgmgmt.initFilesystem "$OPTION_FORCE"
-
+rpm.initFilesystem
+urpmi.initFilesystem
setup_writeOption "$VSERVER_NAME"
setup_writeInitialFstab
test -z "$BUILD_INITPRE" || "$BUILD_INITPRE" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS"
-urpmi.addmedia --urpmi-root "$PKGCFGDIR"/ --distrib $MIRRORLIST "$MIRROR"
-urpmi --urpmi-root "$PKGCFGDIR"/ --root "$VDIR"/ "${PKGS[@]}"
+$_VURPM urpmi.addmedia "$SETUP_CONFDIR" -- --distrib $MIRRORLIST "$MIRROR"
+urpmi.installPackages "$SETUP_CONFDIR" "$PKGINSTALLDIR"
+test -z "$1" || $_VURPM urpmi "$SETUP_CONFDIR" -- "$@"
pushd "$VDIR"/ >/dev/null
rm -rf dev