scripts/vserver-build.debootstrap \
scripts/vserver-build.fai \
scripts/vserver-build.rpm \
+ scripts/vserver-build.urpmi \
scripts/vserver-build.yum \
scripts/vserver-build.template \
scripts/vserver-build.rsync \
scripts/vservers.grabinfo.sh \
scripts/vshelper \
scripts/vsysvwrapper \
+ scripts/vurpm-worker \
scripts/vyum-worker \
scripts/h2ext-worker
scripts/vsomething \
scripts/vtop \
scripts/vupdateworld \
+ scripts/vurpm \
scripts/vyum
scripts_sbin_gen_PRGS =
function _pkgSetVarsRPM
{
if test -n "$PKGDIR"; then
- findDir RPMETCDIR $PKGDIR/rpmetc $PKGDIR/base/rpm/etc /etc/rpm
- findDir RPMSTATEDIR $PKGDIR/rpmstate $PKGDIR/base/rpm/state
+ findDir RPMETCDIR $PKGDIR/rpmetc $PKGDIR/base/rpm/etc \
+ $PKGDIR/base/etc/rpm /etc/rpm
+ findDir RPMSTATEDIR $PKGDIR/rpmstate $PKGDIR/base/rpm/state \
+ $PKGDIR/base/var/lib/rpm
findDir RPMLIBDIR $PKGDIR/rpmlib /
fi
}
+function _pkgSetVarsUrpmi
+{
+ if test -n "$PKGDIR"; then
+ findDir URPMIETCDIR $PKGDIR/urpmietc $PKGDIR/base/etc/urpmi /etc/urpmi
+ findDir URPMISTATEDIR $PKGDIR/urpmistate $PKGDIR/base/var/lib/urpmi
+ else
+ findDir URPMIETCDIR "$VDIR"/etc/urpmi /etc/urpmi
+ findDir URPMISTATEDIR "$VDIR"/var/lib/urpmi /var/lib/urpmi
+ fi
+}
+
function _pkgMountBase
{
:
}
+function _pkgMountUrpmi
+{
+ :
+}
+
function _pkgMountRPM
{
_pkgMountBindDir "$RPMETCDIR" /etc/rpm
:
}
+function _pkgSetEnvUrpmi
+{
+ :
+}
+
function _pkgSetEnvRPM
{
CUR_VSERVER=$vserver
rpm) _pkgSetVarsRPM;;
apt) _pkgSetVarsApt;;
yum) _pkgSetVarsYum;;
+ urpmi) _pkgSetVarsUrpmi;;
*) echo "Unknown packaging flavor" >&2; exit 1;;
esac
done
rpm) _pkgMountRPM;;
apt) _pkgMountApt;;
yum) _pkgMountYum;;
+ urpmi) _pkgMountUrpmi;;
esac
done
rpm) _pkgSetEnvRPM;;
apt) _pkgSetEnvApt;;
yum) _pkgSetEnvYum;;
+ urpmi) _pkgSetEnvUrpmi;;
esac
done
test -n "$have_yum" && return 0 || return 1
}
+## Usage: pkgmgmt.isUrpmiAvailable <cfgdir> <vdir> [<is-internal>]
+function pkgmgmt.isUrpmiAvailable
+{
+ local cfgdir="$1"
+ local vdir="$2"
+ local is_internal="$3"
+
+ local have_urpmi i
+ if test -n "$is_internal"; then
+ have_urpmi=1
+ test -d "$cfgdir"/var/lib/urpmi || have_yum=
+ else
+ have_urpmi=
+ for i in /bin /usr/bin /usr/local/bin; do
+ test ! -x "$vdir$i"/urpmi || { have_urpmi=1; break; }
+ done
+ fi
+
+ test -n "$have_urpmi" && return 0 || return 1
+}
+
function vshelper.doSanityCheck
{
"
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
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
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
local vserver=$1
local is_internalize=$2
local have_apt
+ local have_yum
+ local have_urpmi
local cfgdir
local i
## 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=
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=
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
apt-rpm ... -- -d <distribution>
... installs the base-packages of the given distribution with
help of 'vapt-get'
- yum ... -- -d <distribution>
+ yum ... -- -d <distribution> [-- <packages>*]
... installs the base-packages of the given distribution with
help of 'vyum'
+ urpmi ... -- -d <distribution> -m <mirror>
rpm ... -- [-d <distribution>] --empty|([--force] [--nodeps] <manifest>)+
... installs lists of rpm-packages
skeleton ... -- [<cmd> <args>*]
case x"$method" in
(xlegacy) exec $_VSERVER_LEGACY "$VSERVER_NAME" build "$@" ;;
- (xapt-rpm|xcopy|xskeleton|xdebootstrap|xyum|xrpm|xtemplate|xfai|xrsync|xclone)
+ (xapt-rpm|xcopy|xskeleton|xdebootstrap|xyum|xrpm|xtemplate|xfai|xrsync|xclone|xurpmi)
. $__PKGLIBDIR/vserver-build.$method
;;
(x) panic $"No build-method specified";;
if test -e /etc/fedora-release; then
set -- $(cat /etc/fedora-release)
DISTRIBUTION=fdr$4
+ elif test -e /etc/mandrake-release; then
+ set -- $(cat /etc/mandrake-release)
+ DISTRIBUTION=mdv$4
elif test -e /etc/redhat-release; then
set -- $(cat /etc/redhat-release)
DISTRIBUTION=rh$5
--- /dev/null
+# $Id$ --*- sh -*--
+
+# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+#
+# 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.
+
+tmp=$(getopt -o '+d:m:o:' --long debug,mirror:,mirrorlist -n "$0" -- "$@") || exit 1
+eval set -- "$tmp"
+
+. "$_LIB_VSERVER_BUILD_FUNCTIONS_PKGMGMT"
+
+DISTRIBUTION=
+MIRROR=
+MIRRORLIST=
+PKGS=( basesystem-minimal )
+while true; do
+ case "$1" in
+ -d) DISTRIBUTION=$2; shift;;
+ --debug) set -x;;
+ -m|--mirror) MIRROR="$2"; shift;;
+ --mirrorlist) MIRRORLIST=$1;;
+ --) shift; break ;;
+ *) echo "vserver-build.urpmi: internal error: unrecognized option '$1'" >&2
+ exit 1
+ ;;
+ esac
+ 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
+
+
+base.initFilesystem "$OPTION_FORCE"
+pkgmgmt.initFilesystem "$OPTION_FORCE"
+
+
+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[@]}"
+
+pushd "$VDIR"/ >/dev/null
+rm -rf dev
+populateDev
+popd >/dev/null
+
+test -z "$BUILD_INITPOST" || "$BUILD_INITPOST" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS"
+
+base.setSuccess
--- /dev/null
+#! /bin/bash
+# $Id$
+
+# Copyright (C) 2011 Daniel Hokka Zakrisson <daniel@hozac.com>
+# Copyright (C) 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+#
+# 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.
+
+: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
+test -e "$UTIL_VSERVER_VARS" || {
+ echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
+ exit 1
+}
+. "$UTIL_VSERVER_VARS"
+. "$_LIB_FUNCTIONS"
+
+
+function showHelp()
+{
+ echo \
+$"Usage: $0 <command> <vserver-name>* [--all] -- <params>+
+
+<command> is any of urpmi/urpme/urpmi.update/urpmf/etc
+
+Report bugs to <$PACKAGE_BUGREPORT>."
+ exit 0
+}
+
+function showVersion()
+{
+ echo \
+$"vurpm $PACKAGE_VERSION -- urpmi/urpme for vservers
+This program is part of $PACKAGE_STRING
+
+Copyright (C) 2005 Enrico Scholz
+This program is free software; you may redistribute it under the terms of
+the GNU General Public License. This program has absolutely no warranty."
+ exit 0
+}
+
+tmp=$(getopt -o +q --long help,version,debug,quiet,all -n "$0" -- "$@") || exit 1
+eval set -- "$tmp"
+
+declare -a send_through urpmi_opts
+
+while true; do
+ case "$1" in
+ (--help) showHelp $0 ;;
+ (--version) showVersion ;;
+ (--debug) send_through=( "${send_through[@]}" "$1" ); set -x;;
+ (--quiet|-q) send_through=( "${send_through[@]}" "$1" );;
+ (--all) urpmi_opts=( "${yum_opts[@]}" "$1" );;
+ (--) shift; break;;
+ (*) echo $"vurpm: internal error; arg=='$1'" >&2; exit 1;;
+ esac
+ shift
+done
+
+VSOMETHING_TITLE=vurpm
+VSOMETHING_WORKER=$_VURPM_WORKER
+VSOMETHING_PKGMGMT=1
+
+export VSOMETHING_TITLE VSOMETHING_WORKER VSOMETHING_PKGMGMT
+
+cmd="$1"
+export VURPM_CMD="$cmd"
+shift
+
+test ${#urpmi_opts[@]} -eq 0 || urpmi_opts=( "${urpmi_opts[@]}" -- )
+exec $_VSOMETHING "${send_through[@]}" "$cmd" "${urpmi_opts[@]}" "$@"
--- /dev/null
+#! /bin/bash
+# $Id$
+
+# 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.
+
+set -e
+
+: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
+test -e "$UTIL_VSERVER_VARS" || {
+ echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
+ exit 1
+}
+. "$UTIL_VSERVER_VARS"
+. "$_LIB_FUNCTIONS"
+
+vserver=$1
+shift
+
+pkgInit "$vserver" rpm urpmi
+rpmFake.init "$vserver"
+
+urpm="${VURPM_CMD:-urpmi}"
+
+args=( --urpmi-root "$PKGDIR/base" )
+if test "$urpm" = "urpmi" -o "$urpm" = "urpme"; then
+ args=( "${args[@]}" --root "$VDIR" )
+
+rpmFake.exec $urpm \
+ "${args[@]}" \
+ "$@"