summaryrefslogtreecommitdiffstats
path: root/init_functions
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-04-28 18:07:28 +0200
committerDave Reisner <dreisner@archlinux.org>2012-04-28 19:18:28 +0200
commit3fee30c50cb02ef69d8122ece5445ed546800b77 (patch)
tree6ade99407e2dc1aa6eef468931ebb39553ed9009 /init_functions
parent33cb63365749e76f6996f2c1a45a5f38dee00450 (diff)
downloadmkinitcpio-3fee30c50cb02ef69d8122ece5445ed546800b77.tar.gz
mkinitcpio-3fee30c50cb02ef69d8122ece5445ed546800b77.tar.xz
init_functions: add support for PARTUUID tags
libblkid (and thus blkid) gain support for this in util-linux 2.22. This block gets refactored slightly to cut out the monotony. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'init_functions')
-rw-r--r--init_functions19
1 files changed, 6 insertions, 13 deletions
diff --git a/init_functions b/init_functions
index a76f137..0654020 100644
--- a/init_functions
+++ b/init_functions
@@ -159,7 +159,7 @@ fsck_root() {
}
resolve_device() {
- local major minor dev tagval device=$1
+ local major minor dev tag tagval device=$1
# attempt to resolve devices immediately. if this fails
# and udev is running, fall back on lazy resolution using
@@ -167,20 +167,13 @@ resolve_device() {
# usage of tags without udev and "slow" devices like root on
# USB, which might not immediately show up.
case $device in
- UUID=*)
- tagval=${device#*=}
- dev=$(blkid -U "$tagval")
+ UUID=*|LABEL=*|PARTUUID=*)
+ dev=$(blkid -lt "$device" -o device)
if [ -z "$dev" -a "$udevd_running" -eq 1 ]; then
- dev=/dev/disk/by-uuid/$tagval
+ tag=$(awk -v t="${device%%=*}" 'BEGIN { print tolower(t) }')
+ tagval=${device#*=}
+ dev=/dev/disk/by-$tag/$tagval
fi
- ;;
- LABEL=*)
- tagval=${device#*=}
- dev=$(blkid -L "$tagval")
- if [ -z "$dev" -a "$udevd_running" -eq 1 ]; then
- dev=/dev/disk/by-label/$tagval
- fi
- ;;
esac
[ -n "$dev" ] && device=$dev