Merge 0.30.214.
[util-vserver.git] / scripts / vserver-build.template
index bd495ca..be73e10 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: vserver-build.template 2532 2007-04-21 14:05:32Z dhozac $       --*- sh -*--
+# $Id: vserver-build.template 2558 2007-07-10 20:34:48Z dhozac $       --*- sh -*--
 
 # Copyright (C) 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
 #  
@@ -48,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
 
@@ -62,30 +69,15 @@ 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" && {