# $Id: vserver-build.functions.yum 2612 2007-09-11 21:26:41Z ensc $ --*- sh -*-- # Copyright (C) 2003 Enrico Scholz # # 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" }