Enabling whiteouts support for aufs.
[live-boot-grml.git] / scripts / live
index 952d479..e69396e 100755 (executable)
@@ -253,6 +253,11 @@ Arguments ()
                                export PERSISTENT
                                ;;
 
+                       persistent-media=*)
+                               PERSISTENT_MEDIA="${ARGUMENT#*=}"
+                               export PERSISTENT_MEDIA
+                               ;;
+
                        persistent-path=*)
                                PERSISTENT_PATH="${ARGUMENT#persistent-path=}"
                                export PERSISTENT_PATH
@@ -480,7 +485,7 @@ is_nice_device ()
 {
        sysfs_path="${1#/sys}"
 
-       if /lib/udev/path_id "${sysfs_path}" | egrep -q "ID_PATH=(usb|pci-|platform-sata_mv|platform-orion-ehci|platform-mmc|platform-mxsdhci|)"
+       if /lib/udev/path_id "${sysfs_path}" | egrep -q "ID_PATH=(usb|pci-[^-]*-(ide|sas|scsi|usb|virtio)|platform-sata_mv|platform-orion-ehci|platform-mmc|platform-mxsdhci)"
        then
                return 0
        elif echo "${sysfs_path}" | grep -q '^/block/vd[a-z]$'
@@ -1199,7 +1204,7 @@ setup_unionfs ()
 
        if [ "${UNIONTYPE}" = "aufs" ]
        then
-               roopt="rr"
+               roopt="rr+wh"
                noxino_opt="noxino,"
        elif [ "${UNIONTYPE}" = "unionfs-fuse" ]
        then
@@ -1324,6 +1329,7 @@ setup_unionfs ()
        # Looking for "${root_persistence}" device or file
        if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
        then
+
                if [ -z "${QUICKUSBMODULES}" ]
                then
                        # Load USB modules
@@ -1351,6 +1357,18 @@ setup_unionfs ()
                        done
                fi
 
+               case "${PERSISTENT_MEDIA}" in
+                       removable)
+                               whitelistdev="$(removable_dev)"
+                               ;;
+                       removable-usb)
+                               whitelistdev="$(removable_usb_dev)"
+                               ;;
+                       *)
+                               whitelistdev=""
+                               ;;
+               esac
+
                # search for label and files (this could be hugely optimized)
                cowprobe=$(find_cow_device "${root_persistence}" "${blacklistdev}" "${whitelistdev}")
                if [ -b "${cowprobe}" ]
@@ -1665,7 +1683,7 @@ check_dev ()
                        echo ${mountpoint}
                        return 0
                else
-                       umount ${mountpoint}
+                       umount ${mountpoint} 2>/dev/null
                fi
        fi