# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2004-2006 The Trustees of Princeton University
#
-# $Id: mkfedora,v 1.6 2006/04/03 19:11:46 mlhuang Exp $
+# $Id: mkfedora,v 1.7 2006/04/03 19:51:42 mlhuang Exp $
#
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
exit 1
fi
-# Old versions of curl don't understand file:// URLs
fetch ()
{
- url=$1
- if curl --fail --silent --max-time 60 $url ; then
- return 0
- else
- if [ -f ${url#file://} ] ; then
- cat ${url#file://}
- return 0
- fi
- fi
- return 1
+ curl --fail --silent --max-time 60 "$1"
}
for mirror in "${mirrors[@]}" ; do
exec 2>/dev/null
fi
-# Scratch space
-tmp=$(mktemp -d /tmp/mkfedora.XXXXXX)
-
# Minimally initialize /dev in reference image. If installed, the dev
# or udev RPMs will fill in the rest.
mkdir -p $vroot/dev
# For df and linuxconf
touch $vroot/dev/hdv1
+# Do not tolerate errors
+set -e
+
# Mount /dev/pts in reference image
mkdir -p $vroot/dev/pts
mount -t devpts none $vroot/dev/pts
umount $vroot/proc
umount $vroot/dev/shm
umount $vroot/dev/pts
- rm -rf $tmp
}
# Clean up before exiting if anything goes wrong
-trap "cleanup; exit 1" ERR
+trap "cleanup" ERR
# Create a dummy /etc/fstab in reference image
mkdir -p $vroot/etc