X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Flive-helpers;h=89708341f969811815c0481607878a0551a3befa;hb=849a3d4cbee9743b70c515cf34619b3730637517;hp=a935001509056e9775428d098953e06216e59a8a;hpb=a4b49df943941b4c9feb1acb97d0a2a5d3c723b7;p=live-boot-grml.git diff --git a/scripts/live-helpers b/scripts/live-helpers index a935001..8970834 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}") @@ -328,9 +339,9 @@ find_cow_device () 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}