summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2010-12-14 19:57:32 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 19:17:32 +0100
commit27e88b6501f6a732b87c687026e5c028af662a42 (patch)
treeab76442dc0a453ad5cb917bf0538950e1d49eee6
parentb05af6055efe7ef2b3a577416928f8393e3917a4 (diff)
downloadlive-build-27e88b6501f6a732b87c687026e5c028af662a42.zip
live-build-27e88b6501f6a732b87c687026e5c028af662a42.tar.gz
Updating losetup-lukshome example hook to use blkid where available, thanks to Clint Adams <clint@gnu.org> (Closes: #607108).
-rwxr-xr-xexamples/hooks/all_chroot_losetup-lukshome.sh37
1 files changed, 21 insertions, 16 deletions
diff --git a/examples/hooks/all_chroot_losetup-lukshome.sh b/examples/hooks/all_chroot_losetup-lukshome.sh
index 95d3c05..b6f33bf 100755
--- a/examples/hooks/all_chroot_losetup-lukshome.sh
+++ b/examples/hooks/all_chroot_losetup-lukshome.sh
@@ -333,27 +333,32 @@ do
esac
done
-# search for a partition labeled "lukshome" or $LUKSPART
-for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v fd)
-do
- for dev in $(subdevices "${sysblock}")
+if [ -x /sbin/blkid ]
+then
+ CRYPTHOME=$(/sbin/blkid -L ${LUKSPART})
+else
+ # search for a partition labeled "lukshome" or $LUKSPART
+ for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v fd)
do
- devname=$(sys2dev "${dev}")
- # find partition name and filesystem type
- if [ "$(/lib/udev/vol_id -l ${devname} 2>/dev/null)" = "${LUKSPART}" ]
+ for dev in $(subdevices "${sysblock}")
+ do
+ devname=$(sys2dev "${dev}")
+ # find partition name and filesystem type
+ if [ "$(/lib/udev/vol_id -l ${devname} 2>/dev/null)" = "${LUKSPART}" ]
+ then
+ # found one partition with correct label
+ CRYPTHOME="${devname}"
+ # don't search further
+ break
+ fi
+ done
+ # if already found, don't search further
+ if [ -n "${CRYPTHOME}" ]
then
- # found one partition with correct label
- CRYPTHOME="${devname}"
- # don't search further
break
fi
done
- # if already found, don't search further
- if [ -n "${CRYPTHOME}" ]
- then
- break
- fi
-done
+fi
# if no partition found, exit
if [ -z "${CRYPTHOME}" ]