ENSC_PATHPROG(RMMOD, rmmod)
ENSC_PATHPROG(VCONFIG, vconfig,, [See http://www.candelatech.com/~greear/vlan.html; usually this tool is shipped in the 'vconfig' or 'vlan' package of your distribution])
ENSC_PATHPROG(WGET, wget)
+ENSC_PATHPROG(FILE, file, [file])
+ENSC_PATHPROG(GZIP, gzip, [gzip])
+ENSC_PATHPROG(BZIP2, bzip2, [bzip2])
+ENSC_PATHPROG(CPIO, cpio, [cpio])
+ENSC_PATHPROG(RESTORE, restore, [restore])
ENSC_PATHPROG(DOXYGEN, doxygen, [:])
ENSC_PATHPROG(XSLTP, xsltp, [:])
build @PKGLIBDIR@/vserver-build.debootstrap
build @PKGLIBDIR@/vserver-build.yum
build @PKGLIBDIR@/vserver-build.rpm
+build @PKGLIBDIR@/vserver-build.template
build @PKGLIBDIR@/vserver-build.functions
build @PKGLIBDIR@/vserver-build.functions.apt
build @PKGLIBDIR@/vserver-build.functions.rpm
scripts_pkglib_src_DTA = scripts/functions \
+ scripts/magic.mime \
scripts/vserver-build.apt-rpm \
scripts/vserver-build.skeleton \
scripts/vserver-build.debootstrap \
scripts/vserver-build.rpm \
scripts/vserver-build.yum \
+ scripts/vserver-build.template \
scripts/vserver-build.functions \
scripts/vserver-build.functions.apt \
scripts/vserver-build.functions.rpm \
--- /dev/null
+# Borrowed from file(1)
+# gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver)
+0 string \037\213 application/x-gzip
+# tar posix
+257 string ustar\0 application/x-tar
+# tar gnu
+257 string ustar\040\040\0 application/x-tar
+# cpio
+0 short 070707 application/x-cpio
+# cpio swapped
+0 short 0143561 application/x-cpio
+# bzip2
+0 string BZh application/x-bzip2
+# dump/restore new-fs big and little endian
+24 belong 60012 application/x-dump
+24 lelong 60012 application/x-dump
+# dump/restore old-fs big and little endian
+24 belong 60011 application/x-dump
+24 lelong 60011 application/x-dump
_INITSYNC_MINIT_START=:
_KEEP_CTX_ALIVE="$__PKGLIBDIR/keep-ctx-alive"
_LIB_FUNCTIONS="$__PKGLIBDIR/functions"
+_LIB_MAGIC="$__PKGLIBDIR/magic"
_LIB_VSERVER_SETUP_FUNCTIONS="$__PKGLIBDIR/vserver-setup.functions"
_LIB_VSERVER_BUILD_FUNCTIONS="$__PKGLIBDIR/vserver-build.functions"
_LIB_VSERVER_BUILD_FUNCTIONS_APT="$__PKGLIBDIR/vserver-build.functions.apt"
_VYUM_WORKER="$__PKGLIBDIR/vyum-worker"
_AWK="@AWK@"
+_BZIP2="@BZIP2@"
_CAT="@CAT@"
_CHOWN="@CHOWN@"
_CMP="@CMP@"
_CP="@CP@"
+_CPIO="@CPIO@"
_DIRNAME="@DIRNAME@"
_EGREP="@EGREP@"
_ENV="@ENV@"
+_FILE="@FILE@"
_GREP="@GREP@"
+_GZIP="@GZIP@"
_IP="@IP@"
_IPTABLES="@IPTABLES@"
_LN="@LN@"
_NAMEIF="@NAMEIF@"
_NICE="@NICE@"
_NOHUP="@NOHUP@"
+_RESTORE="@RESTORE@"
_RM="@RM@"
_RMDIR="@RMDIR@"
_RMMOD="@RMMOD@"
configuration file and calls an optional command then
debootstrap ... -- -d <distribution> [-m <mirror>] [-s <script> ] [-- <debootstrap-options>*]
bootstraps the vserver with Debian's 'debootstrap' package
+ template ... -- (-t <tarball>)+
+ ... installs a guest using tarball(s)
Please report bugs to $PACKAGE_BUGREPORT"
exit 0
case x"$method" in
(xlegacy) exec $_VSERVER_LEGACY "$VSERVER_NAME" build "$@" ;;
- (xapt-rpm|xcopy|xskeleton|xdebootstrap|xyum|xrpm)
+ (xapt-rpm|xcopy|xskeleton|xdebootstrap|xyum|xrpm|xtemplate)
. $__PKGLIBDIR/vserver-build.$method
;;
(x) panic $"No build-method specified";;
--- /dev/null
+# $Id:$ --*- sh -*--
+
+# Copyright (C) 2006 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:t:' --long debug,pkgmgmt,template: -n "vserver-build.template" -- "$@") || exit 1
+eval set -- "$tmp"
+
+. "$_LIB_VSERVER_BUILD_FUNCTIONS_PKGMGMT"
+
+DISTRIBUTION=:
+use_pkgmgmt=
+declare -a TEMPLATE=()
+while true; do
+ case "$1" in
+ -d) DISTRIBUTION=$2; shift;;
+ --debug) set -x;;
+ --pkgmgmt) use_pkgmgmt=1;;
+ -t|--template)
+ case "$2" in
+ /*) f="$2";;
+ *) f=`pwd`/"$2";;
+ esac
+ TEMPLATE=( "${TEMPLATE[@]}" "$f" )
+ shift
+ ;;
+ --) shift; break ;;
+ *) echo "vserver-build.template: internal error: unrecognized option '$1'" >&2
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+getDistribution '' 1
+
+base.init
+test -z "$use_pkgmgmt" || pkgmgmt.initVariables
+
+base.initFilesystem "$OPTION_FORCE"
+test -z "$use_pkgmgmt" || pkgmgmt.initFilesystem "$OPTION_FORCE"
+
+
+setup_writeOption "$VSERVER_NAME"
+setup_writeInitialFstab
+
+test -z "$BUILD_INITPRE" || "$BUILD_INITPRE" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS"
+
+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
+
+ 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
+
+ $DECOMPRESS "$t" | $EXTRACT
+done
+popd &> /dev/null
+
+test -z "$BUILD_INITPOST" || "$BUILD_INITPOST" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS"
+
+base.setSuccess