[Fai-commit] r4471 - trunk/bin

lange at alioth.debian.org lange at alioth.debian.org
Sat Aug 4 20:30:55 UTC 2007


Author: lange
Date: 2007-08-04 20:30:55 +0000 (Sat, 04 Aug 2007)
New Revision: 4471

Modified:
   trunk/bin/fai-cd
Log:
add option -u, add USB support, means copy the fai-cd data to a directory


Modified: trunk/bin/fai-cd
===================================================================
--- trunk/bin/fai-cd	2007-08-04 19:55:59 UTC (rev 4470)
+++ trunk/bin/fai-cd	2007-08-04 20:30:55 UTC (rev 4471)
@@ -30,12 +30,13 @@
 #*********************************************************************
 
 set -e 
-version="fai-cd 3.0.1, 13 june 2007"
+version="fai-cd 3.1, 4 august 2007"
 
 forceremoval=0;
 burn=0
 keep=0
 makeiso=1
+makeusb=0
 hidedirs="/usr/share/locale /usr/share/doc /var/lib/apt /var/cache/apt /usr/share/man /var/lib/dpkg/info /media/mirror/aptcache /media/mirror/.apt-move"
 
 # we need FAI_CONFIGDIR, NFSROOT
@@ -153,10 +154,11 @@
 
     mount --bind $tmp1 $nfsrootdir/etc/apt/sources.list
     customize_nfsroot
+
     if [ $keep -eq 1 ]; then
 	echo "fai-cd script stopped for 6666 seconds. The filesystem is now available in $tmp."
 	echo "To continue the script and call the cleanup call: pkill -f 'sleep 6666'"
-	sleep_now 2>/dev/null
+	sleep_now 2>/dev/null || true
 	echo "Continue cleanup."
     fi
 
@@ -166,6 +168,12 @@
 	echo -n "ISO image size and filename: "; du -h $isoname
     fi
 
+    if [ $makeusb -eq 1 ]; then
+	# TODO: If usbdir is a device (matches /dev/) mount it
+	echo "Writing FAI data to USB device $usbdir"
+	cp -a $tmp/live $usbdir 2>/dev/null || true
+    fi
+
     rm $tmp1
     unhide_dirs
     umount_dirs
@@ -179,7 +187,7 @@
 # main program
 
 # Parse commandline options
-while getopts "nkfhg:bm:C:" opt ; do
+while getopts "nkfhg:bm:C:u:" opt ; do
     case "$opt" in
         C)  cfdir=$OPTARG ;;
 	f)  forceremoval=1 ;;
@@ -189,6 +197,11 @@
 	m)  mirrordir="$OPTARG" ;;
 	n)  makeiso=0 ;;
 	b)  burn=1 ;;
+	u)  usbdir="$OPTARG"
+	    makeusb=1
+	    makeiso=0
+	    [ -e $usbdir/live ] && die 11 "Please remove $usbdir/live. Aborting."
+	    ;;
 	?)  usage ;;
     esac
 done
@@ -202,7 +215,9 @@
 [ -f "$isoname" ]     && die 3 "Outputfile $isoname already exists. Please remove it or use -f."
 [ $(id -u) != "0" ]   && die 9 "Run this program as root."
 
-[ -x "$(which mkisofs)" ] || die 8 "mkisofs not found. Please install package."
+if [ $makeiso -eq 1 ]; then
+    [ -x "$(which mkisofs)" ] || die 8 "mkisofs not found. Please install package."
+fi
 
 # use FAI_ETC_DIR from environment variable
 if [ -n "$FAI_ETC_DIR" -a -z "$cfdir" ]; then




More information about the Fai-commit mailing list