1 # $Id: vserver-build.functions.yum,v 1.5 2005/04/16 21:20:45 ensc Exp $ --*- sh -*--
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.
18 function yum.installBasePackages
23 test "$dir" != / || return 0
24 for filelist in "$dir"/*; do
25 isRegularFile "$filelist" || continue
31 while test "$#" -gt 0; do
33 --reinstall) flags='';;
34 --can-fail) can_fail=true;;
39 "$_VYUM" "$name" -- -y install $flags $* || $can_fail
43 function yum.initVariables
45 findDir YUMREPOSDEFAULT \
46 "$__CONFDIR/.distributions/$DISTRIBUTION/yum.repos.d" \
47 "$__DISTRIBDIR/$DISTRIBUTION/yum.repos.d" \
51 function yum.__substituteConf
57 $_SED -e "s!@YUMETCDIR@!$prefix$PKGCFGDIR/yum/etc!g;
58 s!@YUMCACHEDIR@!$prefix$PKGCFGDIR/yum/cache!g;
59 s!@YUMLOGDIR@!$prefix$PKGCFGDIR/yum!g;
60 s!@YUMLOCKDIR@!$prefix$PKGCFGDIR/yum!g;
62 $_CMP -s "$f" "$f.tmp" || $_CAT "$f.tmp" >"$f"
67 function yum.initFilesystem
69 mkdir -p "$PKGCFGDIR"/yum/{etc,cache}
71 populateDirectory "$PKGCFGDIR/yum/etc" \
72 "$__DISTRIBDIR/defaults/yum" \
73 "$__DISTRIBDIR/$DISTRIBUTION/yum" \
74 "$__CONFDIR/.distributions/$DISTRIBUTION/yum"
76 ## workaround for yum's automatism to search the configuration in the chroot
78 local f0="$PKGCFGDIR"/yum/etc/yum.conf
79 local f1="$PKGCFGDIR"/yum/etc/yum-hack.conf
82 yum.__substituteConf "$f0" 'hostfs://'
83 yum.__substituteConf "$f1" '/../../../../../../../../../../../../'
85 test -z "$YUMREPOSDEFAULT" -o -e "$PKGCFGDIR/yum/etc/yum.repos.d" || \
86 $_LN_S "$YUMREPOSDEFAULT" "$PKGCFGDIR/yum/etc/yum.repos.d"