X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Flive-helpers;h=70897d6a047b0897ac26ee764ad87a2c8ff8a4bb;hb=9683c4f087985d070ef8b77bdc1e284b55134490;hp=44bb12a164c26114aeedc6407d33bead68b7c4a8;hpb=3d5ce935a643cd8266b8f9e147723088bdff2800;p=live-boot-grml.git diff --git a/scripts/live-helpers b/scripts/live-helpers index 44bb12a..70897d6 100644 --- a/scripts/live-helpers +++ b/scripts/live-helpers @@ -77,7 +77,7 @@ get_fstype () return fi - eval $(fstype < ${1} 2>/dev/null) + eval $(fstype ${1} 2>/dev/null) if [ "${FSTYPE}" != "unknown" ] then @@ -206,7 +206,7 @@ setup_loop () dev=$(sys2dev "${loopdev}") options='' - if [ -n ${readonly} ] + if [ -n "${readonly}" ] then if losetup --help 2>&1 | grep -q -- "-r\b" then @@ -275,7 +275,11 @@ try_mount () if [ -n "${old_mountp}" ] then - mount -o remount,"${opts}" "${dev}" "${old_mountp}" || panic "Remounting ${dev} ${opts} on ${old_mountp} failed" + if [ "${opts}" != "ro" ] + then + mount -o remount,"${opts}" "${dev}" "${old_mountp}" || panic "Remounting ${dev} ${opts} on ${old_mountp} failed" + fi + mount -o bind "${old_mountp}" "${mountp}" || panic "Cannot bind-mount ${old_mountp} on ${mountp}" else if [ -z "${fstype}" ] @@ -295,6 +299,13 @@ find_cow_device () cow_backing="/${pers_label}-backing" black_listed_devices="${2}" + if [ -z "${PERSISTENT_PATH}" ] + then + pers_fpath=${cow_backing}/${pers_label} + else + pers_fpath=${cow_backing}/${PERSISTENT_PATH}/${pers_label} + fi + for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v fd) do for dev in $(subdevices "${sysblock}") @@ -313,17 +324,24 @@ find_cow_device () return fi + if [ "${PERSISTENT}" = "nofiles" ] + then + # do not mount the device to find for image files + # just skip this + break + fi + case "$(get_fstype ${devname})" in - vfat|ext2|ext3|jffs2) + vfat|ext2|ext3|ext4|jffs2) mkdir -p "${cow_backing}" if ! try_mount "${devname}" "${cow_backing}" "rw" then break fi - if [ -f "${cow_backing}/${pers_label}" ] + if [ -f "${pers_fpath}" ] then - echo $(setup_loop "${cow_backing}/${pers_label}" "loop" "/sys/block/loop*") + echo $(setup_loop "${pers_fpath}" "loop" "/sys/block/loop*") return 0 else umount ${cow_backing}