From 3fee30c50cb02ef69d8122ece5445ed546800b77 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 28 Apr 2012 12:07:28 -0400 Subject: 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 --- init_functions | 19 ++++++------------- 1 file 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 -- cgit v1.2.3-24-g4f1b