# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2004-2006 The Trustees of Princeton University
#
-# $Id: mkfedora,v 1.22 2006/08/22 12:56:14 thierry Exp $
+# $Id$
#
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
exit 1
}
-### post-process output of createrepo --quiet or of yum-arch
-# replaces ^M with ^J, and removes whitespace-only lines
-function post-filter () {
- tr '\r' '\n' | grep -v '^ *$'
-}
-
# Get options
while getopts "l:r:a:g:p:x:kvh" opt ; do
case $opt in
l)
- if echo $OPTARG | grep -q -i '^\(file\|http[s]*\|ftp\)://' ; then
- mirrors=($OPTARG ${mirrors[@]})
+ if echo $OPTARG | grep -q -i '^\(file\|http[s]*\)://' ; then
+ mirrors=($OPTARG)
else
- mirrors=(file://$OPTARG ${mirrors[@]})
+ mirrors=(file://$OPTARG)
fi
;;
r)
usage
fi
-
exec 3>&1
exec 4>&2
if [ $verbose -eq 0 ] ; then
RPM_RPMS_DIR=$(cd $(dirname $RPM_BUILD_DIR)/RPMS && pwd -P)
# yum-2.0.x
if [ -x /usr/bin/yum-arch ] ; then
- yum-arch $RPM_RPMS_DIR | post-filter
+ yum-arch -q $RPM_RPMS_DIR
fi
# yum-2.4.x
if [ -x /usr/bin/createrepo ] ; then
if [ -f $RPM_RPMS_DIR/yumgroups.xml ] ; then
groupfile="-g yumgroups.xml"
fi
- createrepo --quiet $groupfile $RPM_RPMS_DIR | post-filter
+ createrepo --quiet $groupfile $RPM_RPMS_DIR
fi
# If run under sudo, allow user to delete the headers/ and
# repodata/ directories.
echo "* Installing glibc" >&3
yum -c $vroot/etc/yum.conf --installroot=$vroot -y $excludes install glibc
-#get rpm and yum
-yum -c $vroot/etc/yum.conf --installroot=$vroot -y install rpm yum
-
-# use host env resolv info
-cp /etc/resolv.conf $vroot/etc/resolv.conf
-
# Go, baby, go
if [ ${#packages[*]} -gt 0 ] ; then
echo "* Installing optional packages" "${packages[@]}" >&3
- chroot $vroot yum -c /etc/yum.conf -y $excludes install "${packages[@]}"
- if ! chroot $vroot rpm -q "${packages[@]}" >/dev/null ; then
+ yum -c $vroot/etc/yum.conf --installroot=$vroot -y $excludes \
+ install "${packages[@]}"
+ if ! rpm --root $vroot -q "${packages[@]}" >/dev/null ; then
echo "* Warning: Missing packages"
- chroot $vroot rpm -q "${packages[@]}" | grep "not installed"
+ rpm --root $vroot -q "${packages[@]}" | grep "not installed"
fi
fi
## call yum sequentially to get finer-grained info on dependencies
for grp in "${groups[@]}" ; do
echo "* Installing optional group $grp" >&3
- chroot $vroot yum -c /etc/yum.conf -y $excludes groupinstall "$grp"
+ yum -c $vroot/etc/yum.conf --installroot=$vroot -y $excludes \
+ groupinstall "$grp"
done
fi
# Clean yum cache
echo "* Cleaning up" >&3
-chroot $vroot yum -c /etc/yum.conf -y clean all
+yum -c $vroot/etc/yum.conf --installroot=$vroot -y \
+ clean all
# Clean RPM state
rm -f $vroot/var/lib/rpm/__db*