1 # $Id: vserver-build.rpm 2263 2006-01-22 12:24:25Z ensc $ --*- sh -*--
3 # Copyright (C) 2005 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; version 2 of the License.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 tmp=$(getopt -o +d:b:e --long debug,empty -n "$0" -- "$@") || exit 1
21 . "$_LIB_VSERVER_BUILD_FUNCTIONS_RPM"
22 . "$_LIB_VSERVER_BUILD_FUNCTIONS_PKGMGMT"
35 (-d) DISTRIBUTION=$2; shift;;
36 (-b) BASEDIR=$2; shift;;
37 (-e|--empty) EMPTY=1;;
40 (*) echo "vserver-build.rpm: internal error: unrecognized option '$1'" >&2
48 ####### some basic initializations
50 getDistribution "template"
56 if test -z "$EMPTY" -a "$#" -eq 0; then
57 rpmlist.initByDistribution rpm_lists "$DISTRIBUTION"
58 set -- "${rpm_lists[@]}"
61 test -n "$EMPTY" -o "$#" -gt 0 || \
63 No rpm-lists specified and no list found for distribution '$DISTRIBUTION'.
64 When this is really indented, please use the '--empty' option."
67 test "$OPTION_DEBUG" -lt 2 || rpm_dflt_opts=( "${rpm_dflt_opts[@]}" -v )
68 test "$OPTION_DEBUG" -lt 3 || rpm_dflt_opts=( "${rpm_dflt_opts[@]}" -v )
69 test -n "$OPTION_SILENT" || rpm_dflt_opts=( "${rpm_dflt_opts[@]}" -vh )
74 ###### init the filesystem
76 base.initFilesystem "$OPTION_FORCE"
77 pkgmgmt.initFilesystem "$OPTION_FORCE"
81 setup_writeOption "$VSERVER_NAME"
82 setup_writeInitialFstab
85 # when basedir is a non-local location, rpm will download it into the
86 # current directory. Therefore, create and go into a temporay directory
87 # before doing the operations.
88 tmpdir=$($_MKTEMPDIR -p /var/tmp vserver-build.rpm.XXXXXX)
89 manifest=$($_MKTEMP vserver-build.rpm.manifest.XXXXXX)
90 trap "rm -rf $tmpdir $manifest" EXIT
93 ###### do the real work
95 test -z "$BUILD_INITPRE" || "$BUILD_INITPRE" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS"
96 rpm.initDB "$SETUP_CONFDIR"
97 rpm.importGPGPubKeys "$SETUP_CONFDIR" \
98 "$__CONFDIR/.distributions/$DISTRIBUTION/pubkeys" \
99 "$__CONFDIR/.distributions/.common/pubkeys" \
100 "$__DISTRIBDIR/$DISTRIBUTION/pubkeys"
105 (--force|--nodeps) opts=( "${opts[@]}" "$i" ); continue;;
108 rpmlist.install "$VSERVER_NAME" "$BASEDIR" "$manifest" "$i" "${rpm_dflt_opts[@]}" "${opts[@]}"
112 test -z "$BUILD_INITPOST" || "$BUILD_INITPOST" "$SETUP_CONFDIR" "$UTIL_VSERVER_VARS"