Adding upstream version 1.79+debian.
[live-boot-grml.git] / scripts / casper
index 3e7db03..776b57f 100644 (file)
@@ -91,7 +91,7 @@ setup_loop() {
     local pattern=$3
 
     modprobe -Qb "$module"
-    udevplug -W
+    udevsettle
  
     for loopdev in $pattern; do
         if [ "$(cat $loopdev/size)" -eq 0 ]; then
@@ -189,8 +189,12 @@ setup_unionfs() {
     rootmnt="$2"
     modprobe -Qb unionfs
 
-    croot="" # Should really be /casper, but run-init doesn't handle
-             # mount-points in subdirectories at all
+    # run-init can't deal with images in a subdir, but we're going to
+    # move all of these away before it runs anyway.  No, we're not,
+    # put them in / since move-mounting them into / breaks mono and
+    # some other apps.
+
+    croot="/"
 
     # Let's just mount the read-only file systems first
     mkdir -p "${croot}"
@@ -231,13 +235,19 @@ setup_unionfs() {
     
     mount -t unionfs -o dirs=/cow=rw:$rofsstring unionfs "$rootmnt"
 
+    # move the first mount; no head in busybox-initramfs
     for d in $(mount -t squashfs | cut -d\  -f 3); do
-        mkdir -p "${rootmnt}/casper/${d}"
-        mount -o bind "${d}" "${rootmnt}/${d}"
-        umount "${d}"
+        mkdir -p "${rootmnt}/rofs"
+        mount -o move "${d}" "${rootmnt}/rofs"
+        break
     done
 
-    if grep -q show-cow /proc/cmdline; then
+    if grep -q showmounts /proc/cmdline; then
+        for d in $(mount -t squashfs | cut -d\  -f 3); do
+            mkdir -p "${rootmnt}/casper/${d##*/}"
+            mount -o move "${d}" "${rootmnt}/casper/${d##*/}"
+        done
+
         mkdir -p "$rootmnt/cow"
         mount -o bind /cow "$rootmnt/cow"
     fi
@@ -246,7 +256,7 @@ setup_unionfs() {
 
 is_usb_device() {
     sysfs_path="${1#/sys}"
-    if /lib/udev/path_id "${sysfs_path}" | grep -q "ID_PATH=(usb|pci-[^-]*-usb)"; then
+    if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-usb)"; then
         return 0
     fi
     return 1
@@ -294,6 +304,12 @@ find_livefs() {
         done
 }
 
+pulsate() {
+    if [ -x /sbin/usplash_write ]; then
+        /sbin/usplash_write "PULSATE"
+    fi
+}
+
 set_usplash_timeout() {
     if [ -x /sbin/usplash_write ]; then
         /sbin/usplash_write "TIMEOUT 120"
@@ -308,6 +324,7 @@ mountroot() {
     
     set_usplash_timeout
     [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/casper-premount"
+    pulsate
     run_scripts /scripts/casper-premount
     [ "$quiet" != "y" ] && log_end_msg
 
@@ -333,6 +350,7 @@ mountroot() {
     maybe_break casper-bottom
     [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/casper-bottom"
 
+    pulsate
     run_scripts /scripts/casper-bottom
     [ "$quiet" != "y" ] && log_end_msg