use $(LIBENSCVECTOR) instead of libensc_vector.a
[util-vserver.git] / util-vserver / scripts / vserver-build
index 4355d67..dfa832c 100755 (executable)
@@ -1,7 +1,7 @@
 #! /bin/bash
 # $Id$
 
-# Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+# Copyright (C) 2003,2004,2005 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
@@ -16,9 +16,9 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-: ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars}
+: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars}
 test -e "$UTIL_VSERVER_VARS" || {
-    echo "Can not find util-vserver installation; aborting..."
+    echo $"Can not find util-vserver installation (the file '$UTIL_VSERVER_VARS' would be expected); aborting..." >&2
     exit 1
 }
 . "$UTIL_VSERVER_VARS"
@@ -32,15 +32,15 @@ function showHelp()
 {
     echo \
 $"Usage: $(basename $0) -m <method> -n <name> --force <cfg-options>*
-    --rootdir <dir> --pkgcfgbase <dir> [--] <method-args>*
+    --rootdir <dir> --pkgbase <dir> [--] <method-args>*
 
 Options:
     --force     ...  remove/rename already existing vservers with the same name
     -m <method> ...  use method <method>; see below for possible values
     --rootdir <dir>
-                ...  [default: $DEFAULT_VSERVERDIR]
-    --pkgcfgbase <dir>
-                ...  [default: $DEFAULT_VSERVERPKGDIR]
+                ...  [default: $__DEFAULT_VSERVERDIR]
+    --pkgbase <dir>
+                ...  [default: $__DEFAULT_VSERVERPKGDIR]
       
 cfg-options are: $SETUP_HELPMSG
 
@@ -50,9 +50,19 @@ Possible methods are:
                     cfg-options will be ignored
     copy        ...  the copy-all-from-host method which uses the recent
                      configuration scheme
-    apt-rpm -d <distribution>
+    apt-rpm ... -- -d <distribution>
                 ...  installs the base-packages of the given distribution with
                     help of 'vapt-get'
+    yum     ... -- -d <distribution>
+                ...  installs the base-packages of the given distribution with
+                    help of 'vyum'
+    rpm     ... -- [-d <distribution>] --empty|([--force] [--nodeps] <manifest>)+
+                ...  installs lists of rpm-packages
+    skeleton ... -- [<cmd> <args>*]
+                ...  installs a minimal skeleton filesystem, creates the
+                    configuration file and calls an optional command then
+    debootstrap ... -- -d <distribution> [-m <mirror>] [-- <debootstrap-options>*]
+                     bootstraps the vserver with Debian's 'debootstrap' package
 
 Please report bugs to $PACKAGE_BUGREPORT"
     exit 0
@@ -64,7 +74,7 @@ function showVersion()
 $"vserver-build $PACKAGE_VERSION -- initializes a vserver
 This program is part of $PACKAGE_STRING
 
-Copyright (C) 2003 Enrico Scholz
+Copyright (C) 2003,2004,2005 Enrico Scholz
 This program is free software; you may redistribute it under the terms of
 the GNU General Public License.  This program has absolutely no warranty."
     exit 0
@@ -75,7 +85,7 @@ the GNU General Public License.  This program has absolutely no warranty."
 set -e
 
 declare -a default_opts=()
-test "$NO_DEFAULT_OPTS" || getFileArray default_opts "$CONFDIR/.defaults/apps/build/options"
+test -n "$NO_DEFAULT_OPTS" || getFileArray default_opts "$__CONFDIR/.defaults/apps/build/options" || :
 
 tmp=$(getopt -o +m:n: --long force,debug,help,version,rootdir:,pkgbase:,$SETUP_OPTIONS -n "$(basename $0)" -- \
        "${default_opts[@]}" "$@") || exit 1
@@ -83,42 +93,37 @@ eval set -- "$tmp"
 
 VSERVER_NAME=
 OPTION_FORCE=
+OPTION_DEBUG=0
 
 while true; do
     case "$1" in
-       --help)    showHelp $0 ;;
-       --version) showVersion ;;
-       --force)   OPTION_FORCE=1;;
-       --debug)   set -x;;
-       --rootdir) ROOTDIR=$2;      shift;;
-       --pkgbase) PKGCFGBASE=$2;   shift;;
-       -m)        method=$2;       shift;;
-       -n)        VSERVER_NAME=$2; shift;;
-       --)        shift; break;;
-       *)
+       (--help)    showHelp $0 ;;
+       (--version) showVersion ;;
+       (--force)   OPTION_FORCE=1;;
+       (--debug)   let ++OPTION_DEBUG;  set -x;;
+       (--rootdir) ROOTDIR=$2;      shift;;
+       (--pkgbase) PKGCFGBASE=$2;   shift;;
+       (-m)        method=$2;       shift;;
+       (-n)        VSERVER_NAME=$2; shift;;
+       (--)        shift; break;;
+       (*)
            { setup_setOption2 "$1" "$2" && shift; } || \
-           { echo $"vserver-build: internal error."; exit 1; }
+             panic $"vserver-build: internal error."
            ;;
     esac
     shift
 done
 
-test "$VSERVER_NAME" || {
-    echo $"Name of vserver not specified"
-    exit 1
-}
+test -n "$VSERVER_NAME" ||
+    panic $"Name of vserver not specified"
 
 setup_setDefaults "$VSERVER_NAME"
 
 case x"$method" in
-    xlegacy)   exec $_VSERVER_LEGACY "$VSERVER_NAME" build "$@" ;;
-    xapt-rpm|xcopy)
-               . $PKGLIBDIR/vserver-build.$method
-               ;;
-    x)         echo $"No build-method specified" >&2
-               exit 1
-               ;;
-    *)         echo $"Unknown build-method '$method'" >&2
-               exit 1
+    (xlegacy)  exec $_VSERVER_LEGACY "$VSERVER_NAME" build "$@" ;;
+    (xapt-rpm|xcopy|xskeleton|xdebootstrap|xyum|xrpm)
+               . $__PKGLIBDIR/vserver-build.$method
                ;;
+    (x)                panic $"No build-method specified";;
+    (*)                panic $"Unknown build-method '$method'";;
 esac