Setting tag bootcd-4.2-25
[bootcd.git] / build.sh
index 0d7dff1..e784052 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -233,7 +233,9 @@ function build_overlay () {
     for i in "$ISOREF"/isofs/{bootcd.img,kernel}; do
        ln -s "$i" "${BUILDTMP}/isofs"
     done
-    cp "/usr/lib/syslinux/isolinux.bin" "${BUILDTMP}/isofs"
+    # the syslinux that comes with f12 has this file in a new location
+    cp "/usr/lib/syslinux/isolinux.bin" "${BUILDTMP}/isofs" \
+       || cp "/usr/share/syslinux/isolinux.bin" "${BUILDTMP}/isofs" 
     ISOFS="${BUILDTMP}/isofs"
 
     # Root of the ISO and USB images
@@ -395,8 +397,12 @@ function build_usb_partition() {
     local cylinders=$(( ($size*1024*2)/($heads*$sectors) ))
     local offset=$(( $sectors*512 ))
 
-    /usr/lib/syslinux/mkdiskimage -M -4 "$usb" $size $heads $sectors
-    
+    if [ -f  /usr/lib/syslinux/mkdiskimage ] ; then
+        /usr/lib/syslinux/mkdiskimage -M -4 "$usb" $size $heads $sectors
+    else
+        mkdiskimage -M -4 "$usb" $size $heads $sectors
+    fi
+
     cat >${BUILDTMP}/mtools.conf<<EOF
 drive z:
 file="${usb}"
@@ -405,6 +411,7 @@ heads=$heads
 sectors=$sectors
 offset=$offset
 mformat_only
+mtools_skip_check=1
 EOF
     # environment variable for mtools
     export MTOOLSRC="${BUILDTMP}/mtools.conf"
@@ -426,7 +433,7 @@ EOF
     mdel -i "$usb" z:/isolinux.cfg 2>/dev/null || :
     mcopy -i "$usb" "$tmp" z:/syslinux.cfg
     rm -f "$tmp"
-    rm -f "${BUILDTMP}/mtools.conf"
+    rm -f "${MTOOLSRC}"
     unset MTOOLSRC
 
     echo "making USB image bootable."
@@ -443,6 +450,12 @@ function build_usb() {
     rm -f "$usb"
     mkfs.vfat -C "$usb" $(($(du -Lsk $ISOFS | awk '{ print $1; }') + $FREE_SPACE))
 
+    cat >${BUILDTMP}/mtools.conf<<EOF
+mtools_skip_check=1
+EOF
+    # environment variable for mtools
+    export MTOOLSRC="${BUILDTMP}/mtools.conf"
+
     # Populate it
     echo -n " populating USB image... "
     mcopy -bsQ -i "$usb" "$ISOFS"/* ::/
@@ -460,6 +473,8 @@ EOF
     mdel -i "$usb" ::/isolinux.cfg 2>/dev/null || :
     mcopy -i "$usb" "$tmp" ::/syslinux.cfg
     rm -f "$tmp"
+    rm -f "${MTOOLSRC}"
+    unset MTOOLSRC
 
     echo "making USB image bootable."
     syslinux "$usb"
@@ -533,9 +548,12 @@ EOF
     popd
 
     # update etc/inittab to start with pl_rsysinit
-    sed -i 's,pl_sysinit,pl_rsysinit,' etc/inittab
+    for file in etc/inittab etc/event.d/rcS etc/init/rcS.conf; do
+       [ -f $file ] && sed -i 's,pl_sysinit,pl_rsysinit,' $file
+    done
 
     # modify inittab to have a serial console
+    # xxx this might well be broken with f12 and above xxx
     if [ -n "$serial" ] ; then
        echo "T0:23:respawn:/sbin/agetty -L $console_dev $console_baud vt100" >> etc/inittab
         # and let root log in