Adding live-initramfs 1.87.1-1.
[live-boot-grml.git] / scripts / casper-helpers
index cfbc3c6..8402d93 100644 (file)
@@ -1,9 +1,11 @@
 ## Casper helper functions, used by casper on boot and by casper-snapshot
 
-if [ "${BUILD_SYSTEM}" == "Ubuntu" ]; then
+if [ "${BUILD_SYSTEM}" = "Ubuntu" ]; then
     MP_QUIET="-Q"
-else
+elif [ "${BUILD_SYSTEM}" = "Debian" ]; then
     MP_QUIET="-q"
+else
+    MP_QUIET=""
 fi
 
 if [ ! -x "/bin/fstype" ]; then
@@ -110,14 +112,19 @@ setup_loop() {
     local fspath=$1
     local module=$2
     local pattern=$3
+    local offset=$4
 
-    modprobe "${MP_QUIET}" -b "$module"
+    modprobe ${MP_QUIET} -b "$module"
     udevsettle
 
     for loopdev in $pattern; do
         if [ "$(cat $loopdev/size)" -eq 0 ]; then
             dev=$(sys2dev "${loopdev}")
-            losetup "$dev" "$fspath"
+            if [ -n "$offset" ]; then
+                losetup -o "$offset" "$dev" "$fspath"
+            else
+                losetup "$dev" "$fspath"
+            fi
             echo "$dev"
             return 0
         fi