builds myplc-native
[build.git] / mkfedora
index d0751f3..9dc3cac 100755 (executable)
--- a/mkfedora
+++ b/mkfedora
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2004-2006 The Trustees of Princeton University
 #
-# $Id: mkfedora 1073 2007-11-15 09:56:03Z thierry $
+# $Id$
 #
 
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
+echo "* Entering mkfedora " "$@"
+
 # Verbosity
 verbose=0
 
@@ -25,13 +27,11 @@ verbose=0
 mirrors=(
 file:///data/fedora
 http://localhost/fedora
-ftp://smoke.cs.princeton.edu/pub/mirrors/fedora
+http://build.planet-lab.org/fedora
 http://coblitz.codeen.org/coblitz.planet-lab.org/pub/fedora
 ftp://mirror.cs.princeton.edu/pub/mirrors/fedora
-http://coblitz.planet-lab.org/pub/fedora
 ftp://mirror.stanford.edu/pub/mirrors/fedora
 ftp://rpmfind.net/linux/fedora
-http://fedora.laptop.org/fedora-linux-releases
 )
 
 # Release and architecture to install
@@ -54,6 +54,7 @@ exclude_kernel=
 if [ -f /etc/planetlab/plc_config ] ; then
     . /etc/planetlab/plc_config
     if [ -n "$PLC_DEVEL_FEDORA_URL" ] ; then
+       echo "* mkfedora : setting mirrors from /etc/planetlab/config"
        mirrors=($PLC_DEVEL_FEDORA_URL)
     fi
 fi
@@ -138,8 +139,9 @@ fetch ()
 # set list of attempted locations according to releasever
 if [ $releasever -ge 7 ] ; then
     attempts="
+linux/releases/$releasever/Everything/$basearch/os
 $releasever/Everything/$basearch/os
-core/$releasever/Everything/$basearch/os \
+core/$releasever/Everything/$basearch/os
 linux/core/$releasever/$basearch/os
 "
 else
@@ -150,18 +152,19 @@ $releasever/$basearch/os
 "
 fi
 
+echo "$0: candidate mirrors"
+for mirror in "${mirrors[@]}" ; do
+    echo "* candidate mirror $mirror"
+done
+baseurl=""
 for mirror in "${mirrors[@]}" ; do
     for attempt in $attempts; do 
-       baseurl=$mirror/$attempt
-       if fetch $baseurl/repodata/repomd.xml >/dev/null ; then
-           break
+       attempturl=$mirror/$attempt
+       if fetch $attempturl/repodata/repomd.xml >/dev/null ; then
+           baseurl=$attempturl
+           break 2
        fi
-       unset baseurl
     done
-    if [ -n "$baseurl" ] ; then
-       break
-    fi
-    unset baseurl
 done
 
 if [ -z "$baseurl" ] ; then
@@ -187,11 +190,21 @@ fi
 # Do not tolerate errors
 set -e
 
-# Mount /dev/pts and /dev/shm in reference image
+## make rpms ignore installing stuff to special fs entries like /proc
+# Because of https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=52725
+# you have to use at least one language beside 'C'
+cat > /etc/rpm/macros <<EOF
+%_install_langs C:de:en:es:fr
+%_netsharedpath /proc:/dev/pts
+%_excludedocs yes
+EOF
+# copy to the vserver's rpm macros
+mkdir -p $vroot/etc/rpm
+cp /etc/rpm/macros $vroot/etc/rpm/macros
+
+# Mount in reference image
 mount -t devpts none $vroot/dev/pts
 mount -t tmpfs none $vroot/dev/shm
-
-# Mount /proc in reference image
 mkdir -p $vroot/proc
 mount -t proc none $vroot/proc