Accept using several persistent media with custom-ov label.
authorTails developers <amnesia@boum.org>
Sat, 11 Feb 2012 20:27:48 +0000 (21:27 +0100)
committerDaniel Baumann <daniel@debian.org>
Sun, 1 Apr 2012 20:13:28 +0000 (22:13 +0200)
We didn't want this before with live-{rw,sn} and home-{rw,sn} style
persistence, so this was just a left-over. But we still can only allow
one each of root-ov, root-sn and home-sn.

scripts/live
scripts/live-helpers

index 6f0dc48..494abc7 100755 (executable)
@@ -1403,23 +1403,35 @@ setup_unionfs ()
                        snapshots="${root_snapshot_label} ${home_snapshot_label}"
                fi
 
-               overlay_devices=""
+               local root_snapdata=""
+               local home_snapshot_label=""
+               local root_overlay_label=""
+               local overlay_devices=""
                for media in $(find_persistent_media "${overlays}" "${snapshots}" "${blacklistdev}" "${whitelistdev}")
                do
                        media="$(echo ${media} | tr ":" " ")"
                        case ${media} in
                                ${root_snapshot_label}=*)
-                                       root_snapdata="${media#*=}"
+                                       if [ -z "${root_snapdata}" ]
+                                       then
+                                               root_snapdata="${media#*=}"
+                                       fi
                                        ;;
                                ${home_snapshot_label}=*)
                                        # This second type should be removed when snapshot will get smarter,
                                        # hence when "/etc/live-snapshot*list" will be supported also by
                                        # ext2|ext3|ext4|jffs2 snapshot types.
-                                       home_snapdata="${media#*=}"
+                                       if [ -z "${home_snapdata}" ]
+                                       then
+                                               home_snapdata="${media#*=}"
+                                       fi
                                        ;;
                                ${root_overlay_label}=*)
-                                       device="${media#*=}"
-                                       root_overlay_device="${device}"
+                                       if [ -z "${root_overlay_device}" ]
+                                       then
+                                               device="${media#*=}"
+                                               root_overlay_device="${device}"
+                                       fi
                                        ;;
                                ${custom_overlay_label}=*)
                                        device="${media#*=}"
index c1efeec..f1ebe86 100644 (file)
@@ -401,8 +401,6 @@ find_persistent_media ()
                        do
                                if [ "$(/sbin/blkid -s LABEL -o value $dev 2>/dev/null)" = "${label}" ]
                                then
-                                       overlays=$(echo ${overlays} | sed -e "s|\<${label}\>||")
-                                       snapshots=$(echo ${snapshots} | sed -e "s|\<${label}\>||")
                                        echo "${label}=${dev}"
                                        # skip to the next device
                                        continue 2
@@ -424,7 +422,6 @@ find_persistent_media ()
                                        path=${backing}/${PERSISTENT_PATH}${label}
                                        if [ -f "${path}" ]
                                        then
-                                               overlays=$(echo ${overlays} | sed -e "s|\<${label}\>||")
                                                overlay_on_dev="yes"
                                                echo "${label}=$(setup_loop "${path}" "loop" "/sys/block/loop*")"
                                        fi
@@ -437,7 +434,6 @@ find_persistent_media ()
                                                path="${PERSISTENT_PATH}${label}.${ext}"
                                                if [ -f "${backing}/${path}" ]
                                                then
-                                                       snapshots=$(echo ${snapshots} | sed -e "s|\<${label}\>||")
                                                        snapshot_on_dev="yes"
                                                        echo "${label}=${dev}:${backing}:${path}"
                                                fi