X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fvserver-build.template;h=77b73262033791d775ef7792b16ecf59234d0c2a;hb=5d9f260eb21ecde1babed2cea36a6e29a1a1b985;hp=7274dcd005428e3acf5406e69e0c67ac7a687ee5;hpb=d97ddf08e9d879d15196a5c433da731c424a37ce;p=util-vserver.git diff --git a/scripts/vserver-build.template b/scripts/vserver-build.template index 7274dcd..77b7326 100644 --- a/scripts/vserver-build.template +++ b/scripts/vserver-build.template @@ -1,4 +1,4 @@ -# $Id:$ --*- sh -*-- +# $Id$ --*- sh -*-- # Copyright (C) 2006 Enrico Scholz # @@ -15,19 +15,21 @@ # 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:t:' --long debug,pkgmgmt,template: -n "vserver-build.template" -- "$@") || exit 1 +tmp=$(getopt -o '+d:t:' --long debug,pkgmgmt,template:,nodevsanity -n "vserver-build.template" -- "$@") || exit 1 eval set -- "$tmp" . "$_LIB_VSERVER_BUILD_FUNCTIONS_PKGMGMT" DISTRIBUTION=: use_pkgmgmt= +no_dev_sanity= declare -a TEMPLATE=() while true; do case "$1" in -d) DISTRIBUTION=$2; shift;; --debug) set -x;; --pkgmgmt) use_pkgmgmt=1;; + --nodevsanity) no_dev_sanity=1;; -t|--template) case "$2" in /*) f="$2";; @@ -46,6 +48,13 @@ done getDistribution '' 1 +for d in "$__CONFDIR/.distributions/$DISTRIBUTION" \ + "$__DISTRIBDIR/$DISTRIBUTION"; do + if test -r "$d/template"; then + TEMPLATE=( "$d/template" "${TEMPLATE[@]}" ) + fi +done + base.init test -z "$use_pkgmgmt" || pkgmgmt.initVariables @@ -60,31 +69,21 @@ test -z "$BUILD_INITPRE" || "$BUILD_INITPRE" "$SETUP_CONFDIR" "$UTIL_VSERVER_V pushd "$SETUP_CONFDIR/vdir" &> /dev/null for t in "${TEMPLATE[@]}"; do - mime=$($_FILE -Nbiz -m "$_LIB_MAGIC" "$t") - compression=$(echo "$mime" | $_GREP '(' | $_SED 's!.*(\(.*\))$!\1!') - - case "$compression" in - application/x-bzip2) DECOMPRESS="$_BZIP2 -d -c";; - application/x-gzip) DECOMPRESS="$_GZIP -d -c";; - "") DECOMPRESS=$_CAT;; - *) - echo "Unsupported compression method: $compression" - exit 1 - ;; - esac + findFile DESC "$__CONFDIR/.defaults/apps/h2ext/desc" "$__PKGLIBDEFAULTDIR/h2ext.desc" + pipe=$($_H2EXT -d "$DESC" -q "$t") - case "$mime" in - application/x-tar*) EXTRACT="$_TAR -x";; - application/x-cpio*) EXTRACT="$_CPIO -i";; - application/x-dump*) EXTRACT="$_RESTORE -rf -";; - *) - echo "Unsupported packaging method: $mime" - exit 1 - ;; - esac + if echo "$pipe" | grep -q "unknown format"; then + echo "vserver-build.template: $t: Unknown format" >&2 + exit 1 + fi - $DECOMPRESS "$t" | $EXTRACT + eval `echo $_CAT "\$t" '|' $pipe` done + +test -z "$no_dev_sanity" && { + rm -rf dev/* + populateDev +} popd &> /dev/null test -z "$BUILD_INITPOST" || "$BUILD_INITPOST" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS"