X-Git-Url: http://git.grml.org/?p=live-boot-grml.git;a=blobdiff_plain;f=components%2F9990-misc-helpers.sh;h=42518986f3bad4ea6d060ecde22b2306831a3321;hp=21ddfb64f4d151cb6a371f9b87bf4275bff3addf;hb=773bef668749c32f1b01d6fa3e61a251602016f5;hpb=469fb61ab8870f74f10aa8d4d235c3a57c47144b diff --git a/components/9990-misc-helpers.sh b/components/9990-misc-helpers.sh index 21ddfb6..4251898 100755 --- a/components/9990-misc-helpers.sh +++ b/components/9990-misc-helpers.sh @@ -15,6 +15,42 @@ is_live_path() return 1 } +grml_match_bootid() +{ + path="$1" + + if [ -n "$IGNORE_BOOTID" ] ; then + echo " * Ignoring verification of bootid.txt as requested via ignore_bootid.">>/boot.log + return 0 + fi + + if [ -n "$BOOTID" ] && ! [ -r "${path}/conf/bootid.txt" ] ; then + echo " * Warning: bootid=... specified but no bootid.txt found on currently requested device.">>/boot.log + return 1 + fi + + [ -r "${path}/conf/bootid.txt" ] || return 0 + + bootid_conf=$(cat "${path}/conf/bootid.txt") + + if [ -z "$BOOTID" -a -z "$IGNORE_BOOTID" ] + then + echo " * Warning: bootid.txt found but ignore_bootid / bootid=.. bootoption missing...">>/boot.log + return 1 + fi + + if [ "$BOOTID" = "$bootid_conf" ] + then + echo " * Successfully verified /conf/bootid.txt from ISO, continuing... ">>/boot.log + else + echo " * Warning: BOOTID of ISO does not match. Retrying and continuing search...">>/boot.log + return 1 + fi + + return 0 +} + + matches_uuid () { if [ "${IGNORE_UUID}" ] || [ ! -e /conf/uuid.conf ] @@ -214,7 +250,7 @@ check_dev () fi if is_live_path ${mountpoint} && \ - ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint}) + ([ "${skip_uuid_check}" ] || grml_match_bootid ${mountpoint}) then echo ${mountpoint} return 0 @@ -310,19 +346,6 @@ find_livefs () return 0 fi done - elif [ "${fstype}" = "squashfs" -o \ - "${fstype}" = "btrfs" -o \ - "${fstype}" = "ext2" -o \ - "${fstype}" = "ext3" -o \ - "${fstype}" = "ext4" -o \ - "${fstype}" = "jffs2" ] - then - # This is an ugly hack situation, the block device has - # an image directly on it. It's hopefully - # live-boot, so take it and run with it. - ln -s "${devname}" "${devname}.${fstype}" - echo "${devname}.${fstype}" - return 0 fi done @@ -1301,13 +1324,9 @@ do_union () unionmountopts="${unionmountopts}:${rofs}=${ro_opt}" done fi - mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}" ;; overlay) - rw_opt="rw" - ro_opt="ro" - # XXX: can multiple unionro be used? (overlay only handles two dirs, but perhaps they can be chained?) # XXX: and can unionro be optional? i.e. can overlay skip lowerdir? if echo ${unionro} | grep -q " " @@ -1317,7 +1336,6 @@ do_union () then panic "overlay needs at least one lower filesystem (read-only branch)." fi - unionmountopts="-o noatime,lowerdir=${unionro},upperdir=${unionrw}" # overlayfs requires: # + a workdir to become mounted # + workdir and upperdir to reside under the same mount @@ -1325,9 +1343,10 @@ do_union () mkdir "${unionrw}/rw" mkdir "${unionrw}/work" unionmountopts="-o noatime,lowerdir=${unionro},upperdir=${unionrw}/rw,workdir=${unionrw}/work" - mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}" ;; esac + + mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}" } get_custom_mounts ()