X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=components%2F9990-misc-helpers.sh;h=6f84ead820f18fb6db03b013b101b28f85c49bb7;hb=ea4f167204b444fc52633a2ed1ded9023c3b01e4;hp=1b89e59349006fa77f496a419d595b262cfee615;hpb=0bfbe98e1363a0617b35d528907fbd5cf669a97d;p=live-boot-grml.git diff --git a/components/9990-misc-helpers.sh b/components/9990-misc-helpers.sh index 1b89e59..6f84ead 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 ] @@ -259,7 +295,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 @@ -355,19 +391,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 @@ -472,6 +495,14 @@ is_supported_fs () fi # Try to look if it is already supported by the kernel + # For ntfs, since user space program ntfs-3g will be used. Check ntfs-3g instead of kernel module. + if [ "${fstype}" = "ntfs" ]; then + if type ntfs-3g >/dev/null 2>&1; then + return 0 + else + return 1 + fi + fi if grep -q ${fstype} /proc/filesystems then return 0 @@ -730,7 +761,7 @@ try_mount () fstype=$(get_fstype "${dev}") fi mount -t "${fstype}" -o "${opts}" "${dev}" "${mountp}" || \ - ( echo "SKIPPING: Cannot mount ${dev} on ${mountp}, fstype=${fstype}, options=${opts}" > boot.log && return 0 ) + ( echo "SKIPPING: Cannot mount ${dev} on ${mountp}, fstype=${fstype}, options=${opts}" >> boot.log && return 0 ) fi } @@ -772,7 +803,7 @@ mount_persistence_media () then mount_opts="ro,noatime" fi - if mount -t "${fstype}" -o "${mount_opts}" "${device}" "${backing}" >/dev/null + if mount -t "${fstype}" -o "${mount_opts}" "${device}" "${backing}" >/dev/null 2>&1 then echo ${backing} return 0 @@ -1375,8 +1406,8 @@ do_union () # + a workdir to become mounted # + workdir and upperdir to reside under the same mount # + workdir and upperdir to be in separate directories - mkdir "${unionrw}/rw" - mkdir "${unionrw}/work" + mkdir -p "${unionrw}/rw" + mkdir -p "${unionrw}/work" unionmountopts="-o noatime,lowerdir=${unionro},upperdir=${unionrw}/rw,workdir=${unionrw}/work" ;; esac