summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChris Lamb <chris@chris-lamb.co.uk>2008-03-26 08:08:10 +0000
committerDaniel Baumann <daniel@debian.org>2011-03-09 17:47:58 +0100
commit31e39a4551eb81d8542047ba382408bff4391fe5 (patch)
tree364badfb158ab8e0654e0c359539c0aaf909dfc5 /scripts
parent27ff6737efe5ed3d4b17b4d4409ad4734e84d519 (diff)
downloadlive-boot-31e39a4551eb81d8542047ba382408bff4391fe5.tar.gz
live-boot-31e39a4551eb81d8542047ba382408bff4391fe5.zip
scripts/live-helpers: Search / use case
This patch extends the find_files and find_cow_device utilities to search known-working partition types (removing two "FIXME"s) and reworks the syntax to use somewhat more readable case-statements.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/live-helpers65
1 files changed, 35 insertions, 30 deletions
diff --git a/scripts/live-helpers b/scripts/live-helpers
index 771ab85..6c03751 100644
--- a/scripts/live-helpers
+++ b/scripts/live-helpers
@@ -244,20 +244,24 @@ find_cow_device ()
then
echo "${devname}"
return
- elif [ "$(get_fstype ${devname})" = "vfat" ]
- then
- # FIXME: all supported block devices should be scanned
- mkdir -p "${cow_backing}"
- try_mount "${devname}" "${cow_backing}" "rw"
-
- if [ -e "${cow_backing}/${pers_label}" ]
- then
- echo $(setup_loop "${cow_backing}/${pers_label}" "loop" "/sys/block/loop*")
- return 0
- else
- umount ${cow_backing}
- fi
fi
+
+ case "$(get_fstype ${devname})" in
+ vfat|ext2|ext3|jffs2)
+ mkdir -p "${cow_backing}"
+ try_mount "${devname}" "${cow_backing}" "rw"
+
+ if [ -f "${cow_backing}/${pers_label}" ]
+ then
+ echo $(setup_loop "${cow_backing}/${pers_label}" "loop" "/sys/block/loop*")
+ return 0
+ else
+ umount ${cow_backing}
+ fi
+ ;;
+ *)
+ ;;
+ esac
done
done
}
@@ -277,23 +281,24 @@ find_files ()
devname=$(sys2dev "${dev}")
devfstype="$(get_fstype ${devname})"
- if [ "${devfstype}" = "vfat" ] || [ "${devfstype}" = "ext2" ] || [ "${devfstype}" = "ext3" ] || [ "${devfstype}" = "jffs2" ]
- then
- # FIXME: all supported block devices should be scanned
- mkdir -p "${snap_backing}"
- try_mount "${devname}" "${snap_backing}" "ro"
-
- for filename in ${filenames}
- do
- if [ -e "${snap_backing}/${filename}" ]
- then
- echo "${devname} ${snap_backing} ${filename}"
- return 0
- fi
- done
-
- umount ${snap_backing}
- fi
+ case "${devfstype}" in
+ vfat|ext2|ext3|jffs2)
+ # FIXME: all supported block devices should be scanned
+ mkdir -p "${snap_backing}"
+ try_mount "${devname}" "${snap_backing}" "ro"
+
+ for filename in ${filenames}
+ do
+ if [ -f "${snap_backing}/${filename}" ]
+ then
+ echo "${devname} ${snap_backing} ${filename}"
+ return 0
+ fi
+ done
+
+ umount ${snap_backing}
+ ;;
+ esac
done
done
}