1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
# $Id$ --*- 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.
function yum.installBasePackages
{
local name="$1"
local dir="$2"
test "$dir" != / || return 0
for filelist in "$dir"/*; do
isRegularFile "$filelist" || continue
local idx=0
local can_fail=false
local flags=
set -- $(<$filelist)
while test "$#" -gt 0; do
case "$1" in
--reinstall) flags='';;
--can-fail) can_fail=true;;
*) break;;
esac
shift
done
"$_VYUM" "$name" -- -y install $flags $* || $can_fail
done
}
function yum.initVariables
{
findDir YUMREPOSDEFAULT \
"$__CONFDIR/.distributions/$DISTRIBUTION/yum.repos.d" \
"$__DISTRIBDIR/$DISTRIBUTION/yum.repos.d" \
''
}
function yum.__substituteConf
{
local f=$1
local prefix=$2
if test -e "$f"; then
$_SED -e "s!@YUMETCDIR@!$prefix$PKGCFGDIR/yum/etc!g;
s!@YUMCACHEDIR@!$prefix$PKGCFGDIR/yum/cache!g;
s!@YUMLIBDIR@!$prefix$PKGCFGDIR/yum/lib!g;
s!@YUMLOGDIR@!$prefix$PKGCFGDIR/yum!g;
s!@YUMLOCKDIR@!$prefix$PKGCFGDIR/yum!g;
" "$f" >"$f.tmp"
$_CMP -s "$f" "$f.tmp" || $_CAT "$f.tmp" >"$f"
$_RM -f "$f.tmp"
fi
}
function yum.initFilesystem
{
mkdir -p "$PKGCFGDIR"/yum/{etc,cache,lib}
populateDirectory "$PKGCFGDIR/yum/etc" \
"$__DISTRIBDIR/defaults/yum" \
"$__DISTRIBDIR/$DISTRIBUTION/yum" \
"$__CONFDIR/.distributions/$DISTRIBUTION/yum"
## workaround for yum's automatism to search the configuration in the chroot
local f0="$PKGCFGDIR"/yum/etc/yum.conf
local f1="$PKGCFGDIR"/yum/etc/yum-hack.conf
cp -a "$f0" "$f1"
yum.__substituteConf "$f0" 'hostfs://'
yum.__substituteConf "$f1" '/../../../../../../../../../../../../'
test -z "$YUMREPOSDEFAULT" -o -e "$PKGCFGDIR/yum/etc/yum.repos.d" || \
$_LN_S "$YUMREPOSDEFAULT" "$PKGCFGDIR/yum/etc/yum.repos.d"
}
|