# 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"
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
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
-popd &> /dev/null
-test -z "$no_dev_sanity" || {
+test -z "$no_dev_sanity" && {
rm -rf dev/*
populateDev
}
+popd &> /dev/null
test -z "$BUILD_INITPOST" || "$BUILD_INITPOST" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS"