3 # Copyright (C) 2003 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.
21 function rpm.importGPGPubKeys
31 for file in "$i"/*; do
32 isRegularFile "$file" || continue
34 pkgs=( "${pkgs[@]}" "$file" )
38 test -n "$pkgs" || return 0
39 "$_VRPM" "$dst" -- --import "${pkgs[@]}"
42 function rpm.initVariables
44 test -n "$WORKAROUND_106057" && \
45 RPMDB_PATH=/.rpmdb || \
48 findDir RPMLIBDIR "$__CONFDIR/.distributions/$DISTRIBUTION/rpmlib" "$__DISTRIBDIR/$DISTRIBUTION/rpmlib" /
51 function rpm.initFilesystem
53 test -z "$WORKAROUND_106057" || mkdir -p "$RPMDB_PATH"
54 mkdir -p "$VDIR$RPMDB_PATH"
55 mkdir -p "$VDIR/var/lock/rpm"
57 test -z "$WORKAROUND_APT_DBPATH" || {
58 mkdir -p "$VDIR/var/lib"
59 ln -s "$RPMDB_PATH" "$VDIR/var/lib/rpm"
62 mkdir -p "$PKGCFGDIR"/rpm/{etc,state}
63 populateDirectory "$PKGCFGDIR/rpm/etc" \
64 "$__DISTRIBDIR/defaults/rpm" \
65 "$__DISTRIBDIR/$DISTRIBUTION/rpm" \
66 "$__CONFDIR/.distributions/$DISTRIBUTION/rpm"
68 echo "%_dbpath $RPMDB_PATH" >>"$PKGCFGDIR/rpm/etc/macros"
70 test "$RPMLIBDIR" = / || ln -s "$RPMLIB" "$SETUP_CONFDIR/apps/pkgmgmt/rpmlib"
75 RPM_FLAVOR=d "$_VRPM" "$1" -- --initdb
80 ## Usage: rpmlist.install <vserver> <basedir> <tmpfile> <listfile> <rpm-options>*
81 function rpmlist.install()
94 echo "$basedir/$REPLY"
95 done >"$manifest" <"$listfile"
97 test "$OPTION_DEBUG" -eq 0 || cat "$manifest"
98 test ! -s "$manifest" || $_VRPM "$cfgdir" -- -U "$@" "$manifest"
102 ## Usage: rpmlist.initByDistribution <result-var> <distribution>
103 function rpmlist.initByDistribution()
106 declare -a _rlid_res=()
109 findDir _rlid_listdir "$__CONFDIR/.distributions/$2/rpmlist.d" \
110 "$__DISTRIBDIR/$2/rpmlist.d" \
113 test -d "$_rlid_listdir" || return 0
116 for _rlid_lst in "$_rlid_listdir"/*.lst; do
117 isRegularFile "$_rlid_lst" || continue
119 local _rlid_opts=${_rlid_lst%%lst}cmd
120 declare -a _rlid_tmp=()
122 test ! -e "$_rlid_opts" || getFileArray _rlid_tmp "$_rlid_opts"
123 _rlid_res=( "${_rlid_res[@]}" "${_rlid_tmp[@]}" "$_rlid_lst" )
126 eval "$1"='( "${_rlid_res[@]}" )'
130 ## Usage: rpm.sanityCheck
131 function rpm.sanityCheck
133 test -x "$BUILD_INITPRE" || colorize warn warning $"\
134 WARNING: you are going to use an rpm-based installation method without
135 having an 'initpre' script. Such a script is highly recommend to
136 workaround bugs in rpm which can cause messages like
138 | error: unpacking of archive failed on file /usr/bin/X11;42dd8791:
140 Please read http://linux-vserver.org/HowToRegisterNewDistributions
141 for information how to add support for your own distribution."