Adding upstream version 4.0~a2. upstream/4.0_a2
authorDaniel Baumann <mail@daniel-baumann.ch>
Mon, 6 May 2013 12:35:22 +0000 (14:35 +0200)
committerDaniel Baumann <mail@daniel-baumann.ch>
Mon, 6 May 2013 12:35:22 +0000 (14:35 +0200)
17 files changed:
VERSION
manpages/de/live-boot.de.7
manpages/de/persistence.conf.de.5
manpages/en/live-boot.7
manpages/en/persistence.conf.5
manpages/es/live-boot.es.7
manpages/es/persistence.conf.es.5
manpages/po/de/live-boot.7.po
manpages/po/de/persistence.conf.5.po
manpages/po/es/live-boot.7.po
manpages/po/es/persistence.conf.5.po
manpages/pot/live-boot.7.pot
manpages/pot/persistence.conf.5.pot
scripts/boot/9990-misc-helpers.sh
scripts/boot/9990-mount-http.sh
scripts/boot/9990-mount-iscsi.sh
scripts/boot/9990-overlay.sh

diff --git a/VERSION b/VERSION
index c3b296a..74e367d 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.0~a1-1
+4.0~a2-1
index ae21ae1..99f66cc 100644 (file)
@@ -3,7 +3,7 @@
 .\" This file was generated with po4a. Translate the source file.
 .\"
 .\"*******************************************************************
-.TH LIVE\-BOOT 7 30.11.2012 4.0~a1\-1 "Debian Live Project"
+.TH LIVE\-BOOT 7 10.12.2012 4.0~a2\-1 "Debian Live Project"
 
 .SH NAME
 \fBlive\-boot\fP \- System Boot Scripts
index c8d2d5d..cb2450a 100644 (file)
@@ -3,7 +3,7 @@
 .\" This file was generated with po4a. Translate the source file.
 .\"
 .\"*******************************************************************
-.TH LIVE\-BOOT conf 30.11.2012 4.0~a1\-1 "Debian Live Project"
+.TH LIVE\-BOOT conf 10.12.2012 4.0~a2\-1 "Debian Live Project"
 
 .SH NAME
 \fBpersistence.conf\fP \- Configuration file for persistence media in live\-boot
index 2dfe725..1137f09 100644 (file)
@@ -1,4 +1,4 @@
-.TH LIVE\-BOOT 7 2012\-11\-30 4.0~a1-1 "Debian Live Project"
+.TH LIVE\-BOOT 7 2012\-12\-10 4.0~a2-1 "Debian Live Project"
 
 .SH NAME
 \fBlive\-boot\fR \- System Boot Scripts
index 37f69ef..b886cc2 100644 (file)
@@ -1,4 +1,4 @@
-.TH LIVE\-BOOT conf 2012\-11\-30 4.0~a1-1 "Debian Live Project"
+.TH LIVE\-BOOT conf 2012\-12\-10 4.0~a2-1 "Debian Live Project"
 
 .SH NAME
 \fBpersistence.conf\fR \- Configuration file for persistence media in
index e303e1e..6d35b55 100644 (file)
@@ -3,7 +3,7 @@
 .\" This file was generated with po4a. Translate the source file.
 .\"
 .\"*******************************************************************
-.TH LIVE\-BOOT 7 30.11.2012 4.0~a1\-1 "Proyecto Debian Live"
+.TH LIVE\-BOOT 7 10.12.2012 4.0~a2\-1 "Proyecto Debian Live"
 
 .SH NOMBRE
 \fBlive\-boot\fP \- Scripts de Arranque del Sistema
index 14be4b7..d5fd5e2 100644 (file)
@@ -3,7 +3,7 @@
 .\" This file was generated with po4a. Translate the source file.
 .\"
 .\"*******************************************************************
-.TH LIVE\-BOOT conf 30.11.2012 4.0~a1\-1 "Proyecto Debian Live"
+.TH LIVE\-BOOT conf 10.12.2012 4.0~a2\-1 "Proyecto Debian Live"
 
 .SH NOMBRE
 \fBpersistence.conf\fP \- Fichero para configurar medios de almacenamiento con
index 6d3910a..2f785f9 100644 (file)
@@ -4,8 +4,8 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: live-boot 4.0~a1-1\n"
-"POT-Creation-Date: 2012-11-30 14:56+0100\n"
+"Project-Id-Version: live-boot 4.0~a2-1\n"
+"POT-Creation-Date: 2012-12-10 20:04+0100\n"
 "PO-Revision-Date: 2012-04-08 22:48+0300\n"
 "Last-Translator: Daniel Baumann <daniel@debian.org>\n"
 "Language-Team: none\n"
@@ -24,14 +24,14 @@ msgstr ""
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
 #, no-wrap
-msgid "2012-11-30"
-msgstr "30.11.2012"
+msgid "2012-12-10"
+msgstr "10.12.2012"
 
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
 #, no-wrap
-msgid "4.0~a1-1"
-msgstr ""
+msgid "4.0~a2-1"
+msgstr "4.0~a2-1"
 
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
index 6e4559a..0ccb9d2 100644 (file)
@@ -4,8 +4,8 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: live-boot 4.0~a1-1\n"
-"POT-Creation-Date: 2012-11-30 14:56+0100\n"
+"Project-Id-Version: live-boot 4.0~a2-1\n"
+"POT-Creation-Date: 2012-12-10 20:04+0100\n"
 "PO-Revision-Date: 2012-04-08 22:48+0300\n"
 "Last-Translator: Daniel Baumann <daniel@debian.org>\n"
 "Language-Team: none\n"
@@ -24,14 +24,14 @@ msgstr ""
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
 #, no-wrap
-msgid "2012-11-30"
-msgstr "30.11.2012"
+msgid "2012-12-10"
+msgstr "10.12.2012"
 
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
 #, no-wrap
-msgid "4.0~a1-1"
-msgstr ""
+msgid "4.0~a2-1"
+msgstr "4.0~a2-1"
 
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
index 255db5a..95fcaaa 100644 (file)
@@ -4,8 +4,8 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: live-boot 4.0~a1-1\n"
-"POT-Creation-Date: 2012-11-30 14:56+0100\n"
+"Project-Id-Version: live-boot 4.0~a2-1\n"
+"POT-Creation-Date: 2012-12-10 20:04+0100\n"
 "PO-Revision-Date: 2012-06-07 20:29+0200\n"
 "Last-Translator: Carlos Zuferri «chals» <chals@altorricon.com>\n"
 "Language-Team:  none\n"
@@ -24,14 +24,14 @@ msgstr "LIVE-BOOT"
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
 #, no-wrap
-msgid "2012-11-30"
-msgstr "30.11.2012"
+msgid "2012-12-10"
+msgstr "10.12.2012"
 
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
 #, no-wrap
-msgid "4.0~a1-1"
-msgstr "4.0~a1-1"
+msgid "4.0~a2-1"
+msgstr "4.0~a2-1"
 
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
index 349849a..81b897b 100644 (file)
@@ -4,8 +4,8 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: live-boot 4.0~a1-1\n"
-"POT-Creation-Date: 2012-11-30 14:56+0100\n"
+"Project-Id-Version: live-boot 4.0~a2-1\n"
+"POT-Creation-Date: 2012-12-10 20:04+0100\n"
 "PO-Revision-Date: 2012-06-07 19:11+0200\n"
 "Last-Translator: Carlos Zuferri «chals» <chals@altorricon.com>\n"
 "Language-Team:  none\n"
@@ -23,14 +23,14 @@ msgstr "LIVE-BOOT"
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
 #, no-wrap
-msgid "2012-11-30"
-msgstr "30.11.2012"
+msgid "2012-12-10"
+msgstr "10.12.2012"
 
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
 #, no-wrap
-msgid "4.0~a1-1"
-msgstr "4.0~a1-1"
+msgid "4.0~a2-1"
+msgstr "4.0~a2-1"
 
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
index 2b94356..3e96638 100644 (file)
@@ -7,7 +7,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: live-boot VERSION\n"
-"POT-Creation-Date: 2012-11-30 14:56+0100\n"
+"POT-Creation-Date: 2012-12-10 20:04+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -25,13 +25,13 @@ msgstr ""
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
 #, no-wrap
-msgid "2012-11-30"
+msgid "2012-12-10"
 msgstr ""
 
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
 #, no-wrap
-msgid "4.0~a1-1"
+msgid "4.0~a2-1"
 msgstr ""
 
 #. type: TH
index 2751003..4f76c9b 100644 (file)
@@ -7,7 +7,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: live-boot VERSION\n"
-"POT-Creation-Date: 2012-11-30 14:56+0100\n"
+"POT-Creation-Date: 2012-12-10 20:04+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -25,13 +25,13 @@ msgstr ""
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
 #, no-wrap
-msgid "2012-11-30"
+msgid "2012-12-10"
 msgstr ""
 
 #. type: TH
 #: en/live-boot.7:1 en/persistence.conf.5:1
 #, no-wrap
-msgid "4.0~a1-1"
+msgid "4.0~a2-1"
 msgstr ""
 
 #. type: TH
index 358448b..356fe6d 100755 (executable)
@@ -65,7 +65,8 @@ get_backing_device ()
 match_files_in_dir ()
 {
        # Does any files match pattern ${1} ?
-       local pattern="${1}"
+       local pattern
+       pattern="${1}"
 
        if [ "$(echo ${pattern})" != "${pattern}" ]
        then
@@ -369,24 +370,27 @@ really_export ()
 
 is_in_list_separator_helper ()
 {
-       local sep=${1}
+       local sep element list
+       sep=${1}
        shift
-       local element=${1}
+       element=${1}
        shift
-       local list=${*}
+       list=${*}
        echo ${list} | grep -qe "^\(.*${sep}\)\?${element}\(${sep}.*\)\?$"
 }
 
 is_in_space_sep_list ()
 {
-       local element=${1}
+       local element
+       element=${1}
        shift
        is_in_list_separator_helper "[[:space:]]" "${element}" "${*}"
 }
 
 is_in_comma_sep_list ()
 {
-       local element=${1}
+       local element
+       element=${1}
        shift
        is_in_list_separator_helper "," "${element}" "${*}"
 }
@@ -503,25 +507,28 @@ trim_path ()
 
 what_is_mounted_on ()
 {
-       local dir="$(trim_path ${1})"
+       local dir
+       dir="$(trim_path ${1})"
        grep -m1 "^[^ ]\+ ${dir} " /proc/mounts | cut -d' ' -f1
 }
 
 chown_ref ()
 {
-       local reference="${1}"
+       local reference targets owner
+       reference="${1}"
        shift
-       local targets=${@}
-       local owner=$(stat -c %u:%g "${reference}")
+       targets=${@}
+       owner=$(stat -c %u:%g "${reference}")
        chown -h ${owner} ${targets}
 }
 
 chmod_ref ()
 {
-       local reference="${1}"
+       local reference targets rights
+       reference="${1}"
        shift
-       local targets=${@}
-       local rights=$(stat -c %a "${reference}")
+       targets=${@}
+       rights=$(stat -c %a "${reference}")
        chmod ${rights} ${targets}
 }
 
@@ -607,12 +614,13 @@ load_keymap ()
 
 setup_loop ()
 {
-       local fspath=${1}
-       local module=${2}
-       local pattern=${3}
-       local offset=${4}
-       local encryption=${5}
-       local readonly=${6}
+       local fspath module pattern offset encryption readonly
+       fspath=${1}
+       module=${2}
+       pattern=${3}
+       offset=${4}
+       encryption=${5}
+       readonly=${6}
 
        # the output of setup_loop is evaluated in other functions,
        # modprobe leaks kernel options like "libata.dma=0"
@@ -714,19 +722,25 @@ try_mount ()
        fi
 }
 
+# Try to mount $device to the place expected by live-boot. If $device
+# is already mounted somewhere, move it to the expected place. If
+# we're only probing $device (to check if it has custom persistence)
+# $probe should be set, which suppresses warnings upon failure. On
+# success, print the mount point for $device.
 mount_persistence_media ()
 {
-       local device=${1}
-       local probe=${2}
+       local device probe backing old_backing fstype mount_opts
+       device=${1}
+       probe=${2}
 
-       local backing="/live/persistence/$(basename ${device})"
+       backing="${rootmnt}/lib/live/mount/persistence/$(basename ${device})"
 
        mkdir -p "${backing}"
-       local old_backing="$(where_is_mounted ${device})"
+       old_backing="$(where_is_mounted ${device})"
        if [ -z "${old_backing}" ]
        then
-               local fstype="$(get_fstype ${device})"
-               local mount_opts="rw,noatime"
+               fstype="$(get_fstype ${device})"
+               mount_opts="rw,noatime"
                if [ -n "${PERSISTENCE_READONLY}" ]
                then
                        mount_opts="ro,noatime"
@@ -751,14 +765,19 @@ mount_persistence_media ()
                        rmdir "${backing}"
                        return 1
                fi
+       else
+               # This means that $device has already been mounted on
+               # the place expected by live-boot, so we're done.
+               echo ${backing}
+               return 0
        fi
-       return 0
 }
 
 close_persistence_media ()
 {
-       local device=${1}
-       local backing="$(where_is_mounted ${device})"
+       local device backing
+       device=${1}
+       backing="$(where_is_mounted ${device})"
 
        if [ -d "${backing}" ]
        then
@@ -824,22 +843,25 @@ open_luks_device ()
 
 get_gpt_name ()
 {
-    local dev="${1}"
+    local dev
+    dev="${1}"
     /sbin/blkid -s PART_ENTRY_NAME -p -o value ${dev} 2>/dev/null
 }
 
 is_gpt_device ()
 {
-    local dev="${1}"
+    local dev
+    dev="${1}"
     [ "$(/sbin/blkid -s PART_ENTRY_SCHEME -p -o value ${dev} 2>/dev/null)" = "gpt" ]
 }
 
 probe_for_gpt_name ()
 {
-       local overlays="${1}"
-       local dev="${2}"
+       local overlays dev gpt_dev gpt_name
+       overlays="${1}"
+       dev="${2}"
 
-       local gpt_dev="${dev}"
+       gpt_dev="${dev}"
        if is_active_luks_mapping ${dev}
        then
                # if $dev is an opened luks device, we need to check
@@ -852,7 +874,7 @@ probe_for_gpt_name ()
                return
        fi
 
-       local gpt_name=$(get_gpt_name ${gpt_dev})
+       gpt_name=$(get_gpt_name ${gpt_dev})
        for label in ${overlays}
        do
                if [ "${gpt_name}" = "${label}" ]
@@ -864,8 +886,9 @@ probe_for_gpt_name ()
 
 probe_for_fs_label ()
 {
-       local overlays="${1}"
-       local dev="${2}"
+       local overlays dev
+       overlays="${1}"
+       dev="${2}"
 
        for label in ${overlays}
        do
@@ -878,11 +901,12 @@ probe_for_fs_label ()
 
 probe_for_file_name ()
 {
-       local overlays="${1}"
-       local dev="${2}"
+       local overlays dev ret backing
+       overlays="${1}"
+       dev="${2}"
 
-       local ret=""
-       local backing="$(mount_persistence_media ${dev} probe)"
+       ret=""
+       backing="$(mount_persistence_media ${dev} probe)"
        if [ -z "${backing}" ]
        then
            return
@@ -893,7 +917,8 @@ probe_for_file_name ()
                path=${backing}/${PERSISTENCE_PATH}${label}
                if [ -f "${path}" ]
                then
-                       local loopdev=$(setup_loop "${path}" "loop" "/sys/block/loop*")
+                       local loopdev
+                       loopdev=$(setup_loop "${path}" "loop" "/sys/block/loop*")
                        ret="${ret} ${label}=${loopdev}"
                fi
        done
@@ -927,17 +952,19 @@ find_persistence_media ()
        # ${white_list_devices} is non-empty, only devices in it will be
        # scanned.
 
-       local overlays="${1}"
-       local white_listed_devices="${2}"
-       local ret=""
+       local overlays white_listed_devices ret black_listed_devices
+       overlays="${1}"
+       white_listed_devices="${2}"
+       ret=""
 
-       local black_listed_devices="$(what_is_mounted_on /live/medium)"
+       black_listed_devices="$(what_is_mounted_on ${rootmnt}/lib/live/medium)"
 
        for dev in $(storage_devices "${black_listed_devices}" "${white_listed_devices}")
        do
-               local result=""
+               local result luks_device
+               result=""
 
-               local luks_device=""
+               luks_device=""
                # Check if it's a luks device; we'll have to open the device
                # in order to probe any filesystem it contains, like we do
                # below. activate_custom_mounts() also depends on that any luks
@@ -1113,11 +1140,12 @@ link_files ()
        # is non-empty, remove mask from all source paths when
        # creating links (will be necessary if we change root, which
        # live-boot normally does (into $rootmnt)).
+       local src_dir dest_dir src_mask
 
        # remove multiple /:s and ensure ending on /
-       local src_dir="$(trim_path ${1})/"
-       local dest_dir="$(trim_path ${2})/"
-       local src_mask="${3}"
+       src_dir="$(trim_path ${1})/"
+       dest_dir="$(trim_path ${2})/"
+       src_mask="${3}"
 
        # This check can only trigger on the inital, non-recursive call since
        # we create the destination before recursive calls
@@ -1130,7 +1158,8 @@ link_files ()
        find "${src_dir}" -mindepth 1 -maxdepth 1 | \
        while read src
        do
-               local dest="${dest_dir}$(basename "${src}")"
+               local dest final_src
+               dest="${dest_dir}$(basename "${src}")"
                if [ -d "${src}" ]
                then
                        if [ -z "$(ls -A "${src}")" ]
@@ -1145,7 +1174,7 @@ link_files ()
                        fi
                        link_files "${src}" "${dest}" "${src_mask}"
                else
-                       local final_src=${src}
+                       final_src=${src}
                        if [ -n "${src_mask}" ]
                        then
                                final_src="$(echo ${final_src} | sed "s|^${src_mask}||")"
@@ -1159,10 +1188,11 @@ link_files ()
 
 do_union ()
 {
-       local unionmountpoint="${1}"    # directory where the union is mounted
-       local unionrw="${2}"            # branch where the union changes are stored
-       local unionro1="${3}"           # first underlying read-only branch (optional)
-       local unionro2="${4}"           # second underlying read-only branch (optional)
+       local unionmountpoint unionrw unionro1 unionro2
+       unionmountpoint="${1}"  # directory where the union is mounted
+       unionrw="${2}"          # branch where the union changes are stored
+       unionro1="${3}"         # first underlying read-only branch (optional)
+       unionro2="${4}"         # second underlying read-only branch (optional)
 
        case "${UNIONTYPE}" in
                aufs)
@@ -1224,15 +1254,16 @@ do_union ()
 
 get_custom_mounts ()
 {
-       # Side-effect: leaves $devices with persistence.conf mounted in /live/persistence
+       # Side-effect: leaves $devices with persistence.conf mounted in ${rootmnt}/lib/live/mount/persistence
        # Side-effect: prints info to file $custom_mounts
 
-       local custom_mounts=${1}
+       local custom_mounts devices bindings links
+       custom_mounts=${1}
        shift
-       local devices=${@}
+       devices=${@}
 
-       local bindings="/tmp/bindings.list"
-       local links="/tmp/links.list"
+       bindings="/tmp/bindings.list"
+       links="/tmp/links.list"
        rm -rf ${bindings} ${links} 2> /dev/null
 
        for device in ${devices}
@@ -1242,14 +1273,14 @@ get_custom_mounts ()
                        continue
                fi
 
-               local device_name="$(basename ${device})"
-               local backing=$(mount_persistence_media ${device})
+               local device_name backing include_list
+               device_name="$(basename ${device})"
+               backing=$(mount_persistence_media ${device})
                if [ -z "${backing}" ]
                then
                        continue
                fi
 
-               local include_list
                if [ -r "${backing}/${persistence_list}" ]
                then
                        include_list="${backing}/${persistence_list}"
@@ -1262,7 +1293,7 @@ get_custom_mounts ()
 
                if [ -n "${DEBUG}" ] && [ -e "${include_list}" ]
                then
-                       cp ${include_list} /live/persistence/${persistence_list}.${device_name}
+                       cp ${include_list} ${rootmnt}/lib/live/mount/persistence/${persistence_list}.${device_name}
                fi
 
                while read dir options # < ${include_list}
@@ -1273,14 +1304,15 @@ get_custom_mounts ()
                                continue
                        fi
 
-                       if trim_path ${dir} | grep -q -e "^[^/]" -e "^/live\(/.*\)\?$" -e "^/\(.*/\)\?\.\.\?\(/.*\)\?$"
+                       if trim_path ${dir} | grep -q -e "^[^/]" -e "^/lib" -e "^/lib/live\(/.*\)\?$" -e "^/\(.*/\)\?\.\.\?\(/.*\)\?$"
                        then
-                               log_warning_msg "Skipping unsafe custom mount ${dir}: must be an absolute path containing neither the \".\" nor \"..\" special dirs, and cannot be \"/live\" or any sub-directory therein."
+                               log_warning_msg "Skipping unsafe custom mount ${dir}: must be an absolute path containing neither the \".\" nor \"..\" special dirs, and cannot be \"/lib\", or \"/lib/live\" or any of its sub-directories."
                                continue
                        fi
 
-                       local opt_source=""
-                       local opt_link=""
+                       local opt_source opt_link source full_source full_dest
+                       opt_source=""
+                       opt_link=""
                        for opt in $(echo ${options} | tr ',' ' ');
                        do
                                case "${opt}" in
@@ -1299,7 +1331,7 @@ get_custom_mounts ()
                                esac
                        done
 
-                       local source="${dir}"
+                       source="${dir}"
                        if [ -n "${opt_source}" ]
                        then
                                if echo ${opt_source} | grep -q -e "^/" -e "^\(.*/\)\?\.\.\?\(/.*\)\?$" && [ "${opt_source}" != "." ]
@@ -1311,8 +1343,8 @@ get_custom_mounts ()
                                fi
                        fi
 
-                       local full_source="$(trim_path ${backing}/${source})"
-                       local full_dest="$(trim_path ${rootmnt}/${dir})"
+                       full_source="$(trim_path ${backing}/${source})"
+                       full_dest="$(trim_path ${rootmnt}/${dir})"
                        if [ -n "${opt_link}" ]
                        then
                                echo "${device} ${full_source} ${full_dest} ${options}" >> ${links}
@@ -1333,8 +1365,9 @@ get_custom_mounts ()
 
        # We need to make sure that no two custom mounts have the same sources
        # or are nested; if that is the case, too much weird stuff can happen.
-       local prev_source="impossible source" # first iteration must not match
-       local prev_dest=""
+       local prev_source prev_dest
+       prev_source="impossible source" # first iteration must not match
+       prev_dest=""
        # This sort will ensure that a source /a comes right before a source
        # /a/b so we only need to look at the previous source
        sort -k2 -b ${custom_mounts} |
@@ -1351,14 +1384,16 @@ get_custom_mounts ()
 
 activate_custom_mounts ()
 {
-       local custom_mounts="${1}" # the ouput from get_custom_mounts()
-       local used_devices=""
+       local custom_mounts used_devices
+       custom_mounts="${1}" # the ouput from get_custom_mounts()
+       used_devices=""
 
        while read device source dest options # < ${custom_mounts}
        do
-               local opt_bind="true"
-               local opt_link=""
-               local opt_union=""
+               local opt_bind opt_link opt_union
+               opt_bind="true"
+               opt_link=""
+               opt_union=""
                for opt in $(echo ${options} | tr ',' ' ');
                do
                        case "${opt}" in
@@ -1439,10 +1474,11 @@ activate_custom_mounts ()
 
                # XXX: If CONFIG_AUFS_ROBR is added to the Debian kernel we can
                # ignore the loop below and set rootfs_dest_backing=$dest
-               local rootfs_dest_backing=""
+               local rootfs_dest_backing
+               rootfs_dest_backing=""
                if [ -n "${opt_link}"]
                then
-                       for d in /live/rootfs/*
+                       for d in ${rootmnt}/lib/live/mount/rootfs/*
                        do
                                if [ -n "${rootmnt}" ]
                                then
@@ -1459,13 +1495,14 @@ activate_custom_mounts ()
                        done
                fi
 
+               local cow_dir links_source
                if [ -n "${opt_link}" ] && [ -z "${PERSISTENCE_READONLY}" ]
                then
                        link_files ${source} ${dest} ${rootmnt}
                elif [ -n "${opt_link}" ] && [ -n "${PERSISTENCE_READONLY}" ]
                then
-                       mkdir -p /live/persistence
-                       local links_source=$(mktemp -d /live/persistence/links-source-XXXXXX)
+                       mkdir -p ${rootmnt}/lib/live/mount/persistence
+                       links_source=$(mktemp -d ${rootmnt}/lib/live/mount/persistence/links-source-XXXXXX)
                        chown_ref ${source} ${links_source}
                        chmod_ref ${source} ${links_source}
                        # We put the cow dir in the below strange place to
@@ -1473,7 +1510,7 @@ activate_custom_mounts ()
                        # has its own directory and isn't nested with some
                        # other custom mount (if so that mount's files would
                        # be linked, causing breakage.
-                       local cow_dir="/live/overlay/live/persistence/$(basename ${links_source})"
+                       cow_dir="${rootmnt}/lib/live/mount/overlay/lib/live/mount/persistence/$(basename ${links_source})"
                        mkdir -p ${cow_dir}
                        chown_ref "${source}" "${cow_dir}"
                        chmod_ref "${source}" "${cow_dir}"
@@ -1490,14 +1527,7 @@ activate_custom_mounts ()
                        # bind-mount and union mount are handled the same
                        # in read-only mode, but note that rootfs_dest_backing
                        # is non-empty (and necessary) only for unions
-                       if [ -n "${rootmnt}" ]
-                       then
-                               local cow_dir="$(echo ${dest} | sed -e "s|^${rootmnt}|/live/overlay/|")"
-                       else
-                               # This is happens if persistence is activated
-                               # post boot
-                               local cow_dir="/live/overlay/${dest}"
-                       fi
+                       cow_dir="${rootmnt}/lib/live/mount/overlay/${dest}"
                        if [ -e "${cow_dir}" ] && [ -z "${opt_link}" ]
                        then
                                # If an earlier custom mount has files here
index 1b718c0..b557404 100755 (executable)
@@ -8,8 +8,9 @@ do_httpmount ()
 
        for webfile in HTTPFS FTPFS FETCH
        do
-               local url="$(eval echo \"\$\{${webfile}\}\")"
-               local extension="$(echo "${url}" | sed 's/\(.*\)\.\(.*\)/\2/')"
+               local url extension dest
+               url="$(eval echo \"\$\{${webfile}\}\")"
+               extension="$(echo "${url}" | sed 's/\(.*\)\.\(.*\)/\2/')"
 
                if [ -n "$url" ]
                then
@@ -20,7 +21,7 @@ do_httpmount ()
                                                mkdir -p "${alt_mountpoint}"
                                                dest="${alt_mountpoint}"
                                        else
-                                               local dest="${mountpoint}/${LIVE_MEDIA_PATH}"
+                                               dest="${mountpoint}/${LIVE_MEDIA_PATH}"
                                                mount -t ramfs ram "${mountpoint}"
                                                mkdir -p "${dest}"
                                        fi
index fd29d91..6ce9851 100755 (executable)
@@ -7,7 +7,8 @@ do_iscsi()
        do_netsetup
        #modprobe ib_iser
        modprobe iscsi_tcp
-       local debugopt=""
+       local debugopt
+       debugopt=""
        [ "${DEBUG}" = "true" ] && debugopt="-d 8"
        #FIXME this name is supposed to be unique - some date + ifconfig hash?
        ISCSI_INITIATORNAME="iqn.1993-08.org.debian.live:01:$(echo "${HWADDR}" | sed -e s/://g)"
@@ -21,12 +22,14 @@ do_iscsi()
        then
                panic "Failed to log into iscsi target"
        fi
-       local host="$(ls -d /sys/class/scsi_host/host*/device/iscsi_host:host* \
-                           /sys/class/scsi_host/host*/device/iscsi_host/host* | sed -e 's:/device.*::' -e 's:.*host::')"
+       local host
+       host="$(ls -d /sys/class/scsi_host/host*/device/iscsi_host:host* \
+                     /sys/class/scsi_host/host*/device/iscsi_host/host* | sed -e 's:/device.*::' -e 's:.*host::')"
        if [ -n "${host}" ]
        then
-               local devices=""
-               local i=0
+               local devices i
+               devices=""
+               i=0
                while [ -z "${devices}" -a $i -lt 60 ]
                do
                        sleep 1
index e8e00b6..4739042 100755 (executable)
@@ -189,37 +189,46 @@ setup_unionfs ()
                        done
                fi
 
-               case "${PERSISTENCE_MEDIA}" in
-                       removable)
-                               whitelistdev="$(removable_dev)"
-                               ;;
-
-                       removable-usb)
-                               whitelistdev="$(removable_usb_dev)"
-                               ;;
+               local whitelistdev
+               whitelistdev=""
+               if [ -n "${PERSISTENCE_MEDIA}" ]
+               then
+                       case "${PERSISTENCE_MEDIA}" in
+                               removable)
+                                       whitelistdev="$(removable_dev)"
+                                       ;;
 
-                       *)
-                               whitelistdev=""
-                               ;;
-               esac
+                               removable-usb)
+                                       whitelistdev="$(removable_usb_dev)"
+                                       ;;
+                       esac
+                       if [ -z "${whitelistdev}" ]
+                       then
+                               whitelistdev="ignore_all_devices"
+                       fi
+               fi
 
                if is_in_comma_sep_list overlay ${PERSISTENCE_METHOD}
                then
                        overlays="${custom_overlay_label}"
                fi
 
-               local overlay_devices=""
-               for media in $(find_persistence_media "${overlays}" "${whitelistdev}")
-               do
-                       media="$(echo ${media} | tr ":" " ")"
+               local overlay_devices
+               overlay_devices=""
+               if [ "${whitelistdev}" != "ignore_all_devices" ]
+               then
+                       for media in $(find_persistence_media "${overlays}" "${whitelistdev}")
+                       do
+                               media="$(echo ${media} | tr ":" " ")"
 
-                       case ${media} in
-                               ${custom_overlay_label}=*)
-                                       device="${media#*=}"
-                                       overlay_devices="${overlay_devices} ${device}"
-                                       ;;
-                        esac
-               done
+                               case ${media} in
+                                       ${custom_overlay_label}=*)
+                                               device="${media#*=}"
+                                               overlay_devices="${overlay_devices} ${device}"
+                                               ;;
+                                esac
+                       done
+               fi
        elif [ -n "${NFS_COW}" ] && [ -z "${NOPERSISTENCE}" ]
        then
                # check if there are any nfs options
@@ -361,19 +370,44 @@ setup_unionfs ()
                esac
        done
 
+       # move all /live mountpoints that the custom persistence
+       # system depends on into /lib/live on the root filesystem
+       for _DIRECTORY in rootfs
+       do
+               if [ -d "/live/${_DIRECTORY}" ]
+               then
+                       mkdir -p "${rootmnt}/lib/live/mount/${_DIRECTORY}"
+
+                       for _MOUNT in $(ls /live/${_DIRECTORY})
+                       do
+                               mkdir -p "${rootmnt}/lib/live/mount/${_DIRECTORY}/${_MOUNT}"
+                               mount -o move "/live/${_DIRECTORY}/${_MOUNT}" "${rootmnt}/lib/live/mount/${_DIRECTORY}/${_MOUNT}" > /dev/null 2>&1 || \
+                                       mount -o bind "/live/${_DIRECTORY}/${_MOUNT}" "${rootmnt}/lib/live/mount/${_DIRECTORY}/${_MOUNT}" || \
+                                       log_warning_msg "W: failed to mount /live/${_DIRECTORY}/${_MOUNT} to ${rootmnt}/lib/live/mount/${_DIRECTORY}/${_MOUNT}"
+                       done
+               fi
+       done
+
+       mkdir -p "${rootmnt}/lib/live/mount/overlay"
+       mount -o move /live/overlay "${rootmnt}/lib/live/mount/overlay" > /dev/null 2>&1 || \
+               mount -o bind /live/overlay "${rootmnt}/lib/live/mount/overlay" || \
+               log_warning_msg "W: failed to mount /live/overlay to ${rootmnt}/lib/live/mount/overlay"
+
        # Adding custom persistence
        if [ -n "${PERSISTENCE}" ] && [ -z "${NOPERSISTENCE}" ]
        then
-               local custom_mounts="/tmp/custom_mounts.list"
+               local custom_mounts
+               custom_mounts="/tmp/custom_mounts.list"
                rm -rf ${custom_mounts} 2> /dev/null
 
                # Gather information about custom mounts from devies detected as overlays
                get_custom_mounts ${custom_mounts} ${overlay_devices}
 
-               [ -n "${DEBUG}" ] && cp ${custom_mounts} "/live/persistence"
+               [ -n "${DEBUG}" ] && cp ${custom_mounts} "/lib/live/mount/persistence"
 
                # Now we do the actual mounting (and symlinking)
-               local used_overlays=""
+               local used_overlays
+               used_overlays=""
                used_overlays=$(activate_custom_mounts ${custom_mounts})
                rm ${custom_mounts}
 
@@ -387,28 +421,6 @@ setup_unionfs ()
                done
        fi
 
-       # move all mountpoints to root filesystem
-       for _DIRECTORY in rootfs persistence
-       do
-               if [ -d "/live/${_DIRECTORY}" ]
-               then
-                       mkdir -p "${rootmnt}/lib/live/mount/${_DIRECTORY}"
-
-                       for _MOUNT in $(ls /live/${_DIRECTORY})
-                       do
-                               mkdir -p "${rootmnt}/lib/live/mount/${_DIRECTORY}/${_MOUNT}"
-                               mount -o move "/live/${_DIRECTORY}/${_MOUNT}" "${rootmnt}/lib/live/mount/${_DIRECTORY}/${_MOUNT}" > /dev/null 2>&1 || \
-                                       mount -o bind "/live/${_DIRECTORY}/${_MOUNT}" "${rootmnt}/lib/live/mount/${_DIRECTORY}/${_MOUNT}" || \
-                                       log_warning_msg "W: failed to mount /live/${_DIRECTORY}/${_MOUNT} to ${rootmnt}/lib/live/mount/${_DIRECTORY}/${_MOUNT}"
-                       done
-               fi
-       done
-
-       mkdir -p "${rootmnt}/lib/live/mount/overlay"
-       mount -o move /live/overlay "${rootmnt}/lib/live/mount/overlay" > /dev/null 2>&1 || \
-               mount -o bind /live/overlay "${rootmnt}/lib/live/mount/overlay" || \
-               log_warning_msg "W: failed to mount /live/overlay to ${rootmnt}/lib/live/mount/overlay"
-
         # ensure that a potentially stray tmpfs gets removed
         # otherways, initramfs-tools is unable to remove /live
         # and fails to boot