4 # Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; version 2 of the License.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 : ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
20 test -e "$UTIL_VSERVER_VARS" || {
21 echo "Can not find util-vserver installation; aborting..." >&2
24 . "$UTIL_VSERVER_VARS"
26 . "$_LIB_VSERVER_SETUP_FUNCTIONS"
27 . "$_LIB_VSERVER_BUILD_FUNCTIONS"
29 ### Some local functions
34 $"Usage: $(basename $0) -m <method> -n <name> --force <cfg-options>*
35 --rootdir <dir> --pkgcfgbase <dir> [--] <method-args>*
38 --force ... remove/rename already existing vservers with the same name
39 -m <method> ... use method <method>; see below for possible values
41 ... [default: $DEFAULT_VSERVERDIR]
43 ... [default: $DEFAULT_VSERVERPKGDIR]
45 cfg-options are: $SETUP_HELPMSG
48 legacy ... the \"old\" copy-all-from-host method, which requires the
49 old legacy vserver-legacy script; with this method the
50 cfg-options will be ignored
51 copy ... the copy-all-from-host method which uses the recent
53 apt-rpm ... -- -d <distribution>
54 ... installs the base-packages of the given distribution with
56 skeleton ... -- [<cmd> <args>*]
57 ... installs a minimal skeleton filesystem, creates the
58 configuration file and calls an optional command then
59 debootstrap ... -- -d <distribution> [-m <mirror>]
60 bootstraps the vserver with Debian's 'debootstrap' package
62 Please report bugs to $PACKAGE_BUGREPORT"
66 function showVersion()
69 $"vserver-build $PACKAGE_VERSION -- initializes a vserver
70 This program is part of $PACKAGE_STRING
72 Copyright (C) 2003 Enrico Scholz
73 This program is free software; you may redistribute it under the terms of
74 the GNU General Public License. This program has absolutely no warranty."
82 declare -a default_opts=()
83 test "$NO_DEFAULT_OPTS" || getFileArray default_opts "$CONFDIR/.defaults/apps/build/options" || :
85 tmp=$(getopt -o +m:n: --long force,debug,help,version,rootdir:,pkgbase:,$SETUP_OPTIONS -n "$(basename $0)" -- \
86 "${default_opts[@]}" "$@") || exit 1
94 (--help) showHelp $0 ;;
95 (--version) showVersion ;;
96 (--force) OPTION_FORCE=1;;
98 (--rootdir) ROOTDIR=$2; shift;;
99 (--pkgbase) PKGCFGBASE=$2; shift;;
100 (-m) method=$2; shift;;
101 (-n) VSERVER_NAME=$2; shift;;
104 { setup_setOption2 "$1" "$2" && shift; } || \
105 { echo $"vserver-build: internal error."; exit 1; } >&2
111 test "$VSERVER_NAME" || {
112 echo $"Name of vserver not specified"
116 setup_setDefaults "$VSERVER_NAME"
119 (xlegacy) exec $_VSERVER_LEGACY "$VSERVER_NAME" build "$@" ;;
120 (xapt-rpm|xcopy|xskeleton|xdebootstrap)
121 . $PKGLIBDIR/vserver-build.$method
123 (x) echo $"No build-method specified" >&2
126 (*) echo $"Unknown build-method '$method'" >&2