Adding casper 1.79+debian-2.
[live-boot-grml.git] / scripts / casper
index 8cfc0df..17e19ae 100644 (file)
@@ -73,6 +73,8 @@ parse_cmdline ()
                 export LIVEMEDIA=${x#*=} ;;
             live-media-timeout=*)
                 export LIVEMEDIA_TIMEOUT=${x#live-media-timeout=} ;;
+            live-media-offset=*)
+                export LIVEMEDIA_OFFSET=${x#live-media-offset=} ;;
             locale=*|debian-installer/locale=*)
                 export LOCALE=${x#*=} ;;
             keyb=*|kbd-chooser/method=*)
@@ -224,7 +226,7 @@ do_netmount() {
 
     modprobe "${MP_QUIET}" af_packet # For DHCP
 
-    ipconfig ${DEVICE} /tmp/net-${DEVICE}.conf
+    ipconfig ${DEVICE} /tmp/net-${DEVICE}.conf | tee /netboot.config
 
     if [ "${NFSROOT}" = "auto" ]; then
         NFSROOT=${ROOTSERVER}:${ROOTPATH}
@@ -424,6 +426,7 @@ setup_unionfs() {
     rofsstring=${rofsstring%:}
 
     mkdir -p /cow
+
     cowdevice="tmpfs"
     cow_fstype="tmpfs"
 
@@ -482,6 +485,12 @@ check_dev ()
     if [ -z "${devname}" ]; then
         devname=$(sys2dev "${sysdev}")
     fi
+
+    if [ -n "${LIVEMEDIA_OFFSET}" ]; then
+        loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVEMEDIA_OFFSET}")
+        devname="${loopdevname}" 
+    fi
+
     fstype=$(get_fstype "${devname}")
     if is_supported_fs ${fstype}; then
         mount -t ${fstype} -o ro "${devname}" $mountpoint || continue
@@ -492,6 +501,10 @@ check_dev ()
             umount $mountpoint
         fi
     fi
+
+    if [ -n "${LIVEMEDIA_OFFSET}" ]; then
+        losetup -d "${loopdevname}"
+    fi
     return 1
 }
 
@@ -576,7 +589,7 @@ mountroot() {
         fi
     else
         # Scan local devices for the image
-        for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13; do
+        for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19; do
             livefs_root=$(find_livefs $i)
             if [ -n "${livefs_root}" ]; then
                 break