- Change -l option behavior to add newly specified mirror at head of mirror lists
authorMarc Fiuczynski <mef@cs.princeton.edu>
Fri, 19 Jan 2007 19:14:06 +0000 (19:14 +0000)
committerMarc Fiuczynski <mef@cs.princeton.edu>
Fri, 19 Jan 2007 19:14:06 +0000 (19:14 +0000)
  rather than replacing the mirror list altogether.

- Do yum install of the native yum,rpm of the FC distribution being pulled in; and,
  use those native FC yum,rpm from within the chroot area rather than yum,rpm from
  the host.

mkfedora

index 7465ce3..8210c21 100755 (executable)
--- a/mkfedora
+++ b/mkfedora
@@ -13,7 +13,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2004-2006 The Trustees of Princeton University
 #
-# $Id: mkfedora,v 1.21 2006/08/22 12:37:08 thierry Exp $
+# $Id: mkfedora,v 1.22 2006/08/22 12:56:14 thierry Exp $
 #
 
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -85,10 +85,10 @@ function post-filter () {
 while getopts "l:r:a:g:p:x:kvh" opt ; do
     case $opt in
        l)
-           if echo $OPTARG | grep -q -i '^\(file\|http[s]*\)://' ; then
-               mirrors=($OPTARG)
+           if echo $OPTARG | grep -q -i '^\(file\|http[s]*\|ftp\)://' ; then
+               mirrors=($OPTARG ${mirrors[@]})
            else
-               mirrors=(file://$OPTARG)
+               mirrors=(file://$OPTARG ${mirrors[@]})
            fi
            ;;
        r)
@@ -165,6 +165,7 @@ if [ -z "$baseurl" ] ; then
     usage
 fi
 
+
 exec 3>&1
 exec 4>&2
 if [ $verbose -eq 0 ] ; then
@@ -331,14 +332,19 @@ done
 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
-   yum -c $vroot/etc/yum.conf --installroot=$vroot -y $excludes \
-         install "${packages[@]}"
-   if ! rpm --root $vroot -q "${packages[@]}" >/dev/null ; then
+   chroot $vroot yum -c /etc/yum.conf -y $excludes install "${packages[@]}"
+   if ! chroot $vroot rpm -q "${packages[@]}" >/dev/null ; then
        echo "* Warning: Missing packages"
-       rpm --root $vroot -q "${packages[@]}" | grep "not installed"
+       chroot $vroot rpm -q "${packages[@]}" | grep "not installed"
    fi
 fi
 
@@ -346,8 +352,7 @@ if [ ${#groups[*]} -gt 0 ] ; then
    ## call yum sequentially to get finer-grained info on dependencies
    for grp in "${groups[@]}" ; do
       echo "* Installing optional group $grp" >&3
-      yum -c $vroot/etc/yum.conf --installroot=$vroot -y $excludes \
-       groupinstall "$grp"
+      chroot $vroot yum -c /etc/yum.conf -y $excludes groupinstall "$grp"
    done
 fi
 
@@ -369,8 +374,7 @@ fi
 
 # Clean yum cache
 echo "* Cleaning up" >&3
-yum -c $vroot/etc/yum.conf --installroot=$vroot -y \
-    clean all
+chroot $vroot yum -c /etc/yum.conf -y clean all
 
 # Clean RPM state
 rm -f $vroot/var/lib/rpm/__db*