X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Flive;h=9eaa073c5b8a093ac655410e6c98dfa790b1f588;hb=56627dfef6afd7f94f0bd8d76122eefb0b115826;hp=561c0e0444acc4d1e3580da7b00ecb71aa285a57;hpb=2fc36d846b3653e698a6ad7d6ea4a2ba1cb16db8;p=live-boot-grml.git diff --git a/scripts/live b/scripts/live index 561c0e0..9eaa073 100755 --- a/scripts/live +++ b/scripts/live @@ -11,7 +11,8 @@ mountpoint="/live/image" alt_mountpoint="/media" LIVE_MEDIA_PATH="live" -root_persistence="live-rw" +root_overlay_label="full-ov" +custom_overlay_label="custom-ov" root_snapshot_label="live-sn" home_snapshot_label="home-sn" persistence_list="live.persist" @@ -273,8 +274,8 @@ Arguments () ;; persistent-subtext=*) - root_persistence="${root_persistence}-${ARGUMENT#persistent-subtext=}" - home_persistence="${home_persistence}-${ARGUMENT#persistent-subtext=}" + root_overlay_label="${root_overlay_label}-${ARGUMENT#persistent-subtext=}" + custom_overlay_label="${custom_overlay_label}-${ARGUMENT#persistent-subtext=}" root_snapshot_label="${root_snapshot_label}-${ARGUMENT#persistent-subtext=}" home_snapshot_label="${home_snapshot_label}-${ARGUMENT#persistent-subtext=}" ;; @@ -1360,7 +1361,7 @@ setup_unionfs () mkdir -p /cow - # Looking for "${root_persistence}" device or file + # Looking for persistent devices or files if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ] then @@ -1405,7 +1406,7 @@ setup_unionfs () if echo ${PERSISTENT_METHOD} | grep -qe "\" then - overlays="${root_persistence}" + overlays="${root_overlay_label} ${custom_overlay_label}" fi if echo ${PERSISTENT_METHOD} | grep -qe "\" @@ -1427,23 +1428,24 @@ setup_unionfs () # ext2|ext3|ext4|jffs2 snapshot types. home_snapdata="${media#*=}" ;; - *) + ${root_overlay_label}=*) + device="${media#*=}" + root_overlay_device="${device}" + ;; + ${custom_overlay_label}=*) device="${media#*=}" overlay_devices="${overlay_devices} ${device}" ;; esac done - if [ -b "${cowprobe}" ] || [ -b "${homecow}" ] + if [ -b "${root_overlay_device}" ] then PERSISTENCE_IS_ON="1" export PERSISTENCE_IS_ON - fi - if [ -b "${cowprobe}" ] - then - cowdevice=${cowprobe} - cow_fstype=$(get_fstype "${cowprobe}") + cowdevice=${root_overlay_device} + cow_fstype=$(get_fstype "${root_overlay_device}") if [ -z "${PERSISTENT_READONLY}" ] then cow_mountopt="rw,noatime" @@ -1661,7 +1663,7 @@ setup_unionfs () ;; *) log_warning_msg "Skipping custom mount with unkown option: ${opt}" - continue + continue 2 ;; esac done @@ -1693,16 +1695,28 @@ setup_unionfs () # that we won't hide a previous mount. We also ignore # duplicate destinations in a more or less arbitrary way. [ -e "${bindings}" ] && sort -k2 -sbu ${bindings} >> ${custom_mounts} + rm -f ${bindings} # After all mounts are considered we add symlinks so they # won't be hidden by some mount. [ -e "${links}" ] && sort -k2 -sbu ${links} >> ${custom_mounts} + rm -f ${links} [ "${DEBUG}" = "Yes" ] && cp ${custom_mounts} ${persistent_backing} # Now we do the actual mounting (and symlinking) while read source dest options # < ${custom_mounts} do + local opt_linkfiles="" + for opt in $(echo ${options} | tr ',' ' '); + do + case "${opt}" in + "linkfiles") + opt_linkfiles="yes" + ;; + esac + done + if mountpoint -q "${dest}"; then log_warning_msg "Skipping custom mount ${source} on ${dest}: destination is already a mount point" @@ -1741,7 +1755,7 @@ setup_unionfs () # dealing with /etc or other system dir. if [ ! -d "${source}" ] then - if [ -n "${PERSISTENT_READONLY}" ] || echo ${options} | grep -qe "\" + if [ -n "${PERSISTENT_READONLY}" ] || [ -n "${opt_linkfiles}" ] then continue fi @@ -1752,7 +1766,7 @@ setup_unionfs () if [ -z "${PERSISTENT_READONLY}" ] then - if echo ${options} | grep -qe "\"; + if [ -n "${opt_linkfiles}" ] then links_source="${source}" links_dest="${dest}" @@ -1760,7 +1774,7 @@ setup_unionfs () mount --bind "${source}" "${dest}" fi else - if echo ${options} | grep -qe "\"; + if [ -n "${opt_linkfiles}" ] then links_dest="${dest}" dest="$(mktemp -d ${persistent_backing}/links_source-XXXXXX)" @@ -1772,10 +1786,13 @@ setup_unionfs () mount -t "${UNIONTYPE}" -o "${unionmountopts}" "${UNIONTYPE}" "${dest}" fi - if echo $options | grep -qe "\"; + if [ -n "${opt_linkfiles}" ] then link_files "${links_source}" "${links_dest}" "${rootmnt}" fi + + PERSISTENCE_IS_ON="1" + export PERSISTENCE_IS_ON done < ${custom_mounts} rm -f ${bindings}