+++ /dev/null
-# $Id: vserver-build.functions.rpm 2311 2006-09-13 22:18:55Z dhozac $ --*- sh -*--
-
-# Copyright (C) 2003 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.
-
-RPMDB_PATH=
-RPMLIBDIR=
-
-function rpm.importGPGPubKeys
-{
- local dst=$1
- local pkgs
- declare -a pkgs
- local i
-
- shift
- for i; do
- local file=
- for file in "$i"/*; do
- isRegularFile "$file" || continue
-
- pkgs=( "${pkgs[@]}" "$file" )
- done
- done
-
- test -n "$pkgs" || return 0
- "$_VRPM" "$dst" -- --import "${pkgs[@]}"
-}
-
-function rpm.initVariables
-{
- test -n "$WORKAROUND_106057" && \
- RPMDB_PATH=/.rpmdb || \
- RPMDB_PATH=/dev
-
- findDir RPMLIBDIR "$__CONFDIR/.distributions/$DISTRIBUTION/rpmlib" "$__DISTRIBDIR/$DISTRIBUTION/rpmlib" /
-}
-
-function rpm.initFilesystem
-{
- test -z "$WORKAROUND_106057" || mkdir -p "$RPMDB_PATH"
- mkdir -p "$VDIR$RPMDB_PATH"
- mkdir -p "$VDIR/var/lock/rpm"
-
- test -z "$WORKAROUND_APT_DBPATH" || {
- mkdir -p "$VDIR/var/lib"
- ln -s "$RPMDB_PATH" "$VDIR/var/lib/rpm"
- }
-
- mkdir -p "$PKGCFGDIR"/rpm/{etc,state}
- populateDirectory "$PKGCFGDIR/rpm/etc" \
- "$__DISTRIBDIR/defaults/rpm" \
- "$__DISTRIBDIR/$DISTRIBUTION/rpm" \
- "$__CONFDIR/.distributions/$DISTRIBUTION/rpm"
-
- echo "%_dbpath $RPMDB_PATH" >>"$PKGCFGDIR/rpm/etc/macros"
-
- test "$RPMLIBDIR" = / || ln -s "$RPMLIB" "$SETUP_CONFDIR/apps/pkgmgmt/rpmlib"
-}
-
-function rpm.initDB
-{
- RPM_FLAVOR=d "$_VRPM" "$1" -- --initdb
-}
-
-
-
-## Usage: rpmlist.install <vserver> <basedir> <tmpfile> <listfile> <rpm-options>*
-function rpmlist.install()
-{
- local cfgdir=$1
- local basedir=$2
- local manifest=$3
- local listfile=$4
- shift 4
-
- while read; do
- case x"$REPLY" in
- (x|\#*) continue;;
- esac
-
- echo "$basedir/$REPLY"
- done >"$manifest" <"$listfile"
-
- test "$OPTION_DEBUG" -eq 0 || cat "$manifest"
- test ! -s "$manifest" || $_VRPM "$cfgdir" -- -U "$@" "$manifest"
-}
-
-
-## Usage: rpmlist.initByDistribution <result-var> <distribution>
-function rpmlist.initByDistribution()
-{
- local _rlid_listdir
- declare -a _rlid_res=()
-
-
- findDir _rlid_listdir "$__CONFDIR/.distributions/$2/rpmlist.d" \
- "$__DISTRIBDIR/$2/rpmlist.d" \
- ''
-
- test -d "$_rlid_listdir" || return 0
-
- local _rlid_lst
- for _rlid_lst in "$_rlid_listdir"/*.lst; do
- isRegularFile "$_rlid_lst" || continue
-
- local _rlid_opts=${_rlid_lst%%lst}cmd
- declare -a _rlid_tmp=()
-
- test ! -e "$_rlid_opts" || getFileArray _rlid_tmp "$_rlid_opts"
- _rlid_res=( "${_rlid_res[@]}" "${_rlid_tmp[@]}" "$_rlid_lst" )
- done
-
- eval "$1"='( "${_rlid_res[@]}" )'
-}
-
-
-## Usage: rpm.sanityCheck
-function rpm.sanityCheck
-{
- test -x "$BUILD_INITPRE" || colorize warn warning $"\
-WARNING: you are going to use an rpm-based installation method without
- having an 'initpre' script. Such a script is highly recommend to
- workaround bugs in rpm which can cause messages like
-
- | error: unpacking of archive failed on file /usr/bin/X11;42dd8791:
-
- Please read http://linux-vserver.org/HowToRegisterNewDistributions
- for information how to add support for your own distribution."
-}