From: Enrico Scholz Date: Tue, 1 Feb 2005 16:56:17 +0000 (+0000) Subject: moved installPackages into vserver-build.functions.rpm X-Git-Tag: IPSENTINEL_VERSION_0_12~148 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8f3fb47dd13a7b3505d79a29098dc79cae00249;p=util-vserver.git moved installPackages into vserver-build.functions.rpm added support for preconfigured package-lists git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@1846 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/util-vserver/scripts/vserver-build.rpm b/util-vserver/scripts/vserver-build.rpm index 6f3d240..8592152 100644 --- a/util-vserver/scripts/vserver-build.rpm +++ b/util-vserver/scripts/vserver-build.rpm @@ -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. -tmp=$(getopt -o +d:b: --long debug -n "$0" -- "$@") || exit 1 +tmp=$(getopt -o +d:b:e --long debug,empty -n "$0" -- "$@") || exit 1 eval set -- "$tmp" . "$_LIB_VSERVER_BUILD_FUNCTIONS_RPM" @@ -24,27 +24,9 @@ eval set -- "$tmp" set -e -## Usage: installPackages * -## it expects a list of packages on stdin -function installPackages() -{ - local cfgdir=$1 - shift - - while read; do - case x"$REPLY" in - (x|\#*) continue;; - esac - - echo "$BASEDIR/$REPLY" - done >>"$manifest" - - cat "$manifest" - test ! -s "$manifest" || $_VRPM "$cfgdir" -- -Uv "$@" "$manifest" -} - BASEDIR=$(pwd) DISTRIBUTION= +EMPTY= echo "$@" @@ -52,6 +34,7 @@ while true; do case "$1" in (-d) DISTRIBUTION=$2; shift;; (-b) BASEDIR=$2; shift;; + (-e|--empty) EMPTY=1;; (--debug) set -x;; (--) shift; break ;; (*) echo "vserver-build.rpm: internal error: unrecognized option '$1'" >&2 @@ -61,12 +44,33 @@ while true; do shift done + +####### some basic initializations + getDistribution "template" base.initVariables pkgmgmt.initVariables rpm.initVariables +if test -z "$EMPTY" -a "$#" -eq 0; then + rpmlist.initByDistribution rpm_lists "$DISTRIBUTION" + set -- "${rpm_lists[@]}" +fi + +test -n "$EMPTY" -o "$#" -gt 0 || \ + panic $"\ +No rpm-lists specified and no list found for distribution '$DISTRIBUTION'. +When this is really indented, please use the '--empty' option." + +rpm_dflt_opts=() +test "$OPTION_DEBUG" -lt 2 || rpm_dflt_opts=( "${rpm_dflt_opts[@]}" -v ) +test "$OPTION_DEBUG" -lt 3 || rpm_dflt_opts=( "${rpm_dflt_opts[@]}" -v ) +test -n "$OPTION_SILENT" || rpm_dflt_opts=( "${rpm_dflt_opts[@]}" -vh ) + + +###### init the filesystem + base.initFilesystem "$OPTION_FORCE" pkgmgmt.initFilesystem "$OPTION_FORCE" rpm.initFilesystem @@ -74,6 +78,7 @@ rpm.initFilesystem setup_writeOption "$VSERVER_NAME" setup_writeInitialFstab + # when basedir is a non-local location, rpm will download it into the # current directory. Therefore, create and go into a temporay directory # before doing the operations. @@ -82,17 +87,21 @@ manifest=$($_MKTEMP /tmp/vserver-build.rpm.manifest.XXXXXX) trap "rm -rf $tmpdir $manifest" EXIT cd "$tmpdir" + +###### do the real work + test -z "$BUILD_INITPRE" || "$BUILD_INITPRE" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS" rpm.importGPGPubKeys "$SETUP_CONFDIR" "$CONFDIR/.distributions/$DISTRIBUTION/pubkeys" "$DISTRIBDIR/$DISTRIBUTION/pubkeys" rpm.initDB "$SETUP_CONFDIR" +opts=() for i; do case "$i" in (--force|--nodeps) opts=( "${opts[@]}" "$i" ); continue;; esac - installPackages "$VSERVER_NAME" "${opts[@]}" <"$i" - opts= + rpmlist.install "$VSERVER_NAME" "$BASEDIR" "$manifest" "$i" "${rpm_dflt_opts[@]}" "${opts[@]}" + opts=() done test -z "$BUILD_INITPOST" || "$BUILD_INITPOST" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS"