summaryrefslogtreecommitdiffstats
path: root/init_functions
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-03-21 15:21:26 +0100
committerDave Reisner <dreisner@archlinux.org>2012-03-24 20:43:38 +0100
commit2c7c8f295a0871f57bb9324d1bd9cd385a45d540 (patch)
tree0decfb183c4ff3176c7dded6dfe187c38c985bd2 /init_functions
parent51382625f9d2928cbcc688b0d93926492b03ad2a (diff)
downloadmkinitcpio-2c7c8f295a0871f57bb9324d1bd9cd385a45d540.tar.gz
mkinitcpio-2c7c8f295a0871f57bb9324d1bd9cd385a45d540.tar.xz
init_functions: fix tag resolution w/o udev rules
The combination of the udev+mdadm hooks plus a tag based root= would cause resolve_device to fail because it immediately looked for a udev symlink which would never be created. The proper fix is to get rid of the mdadm hook and to always use mdadm_udev (which should be merged into mdadm), but this might come back and bite us again. The new solution doesn't assume that udev rules exist and tries blkid first. If the device doesn't (yet) exist fall back on a udev symlink if udevd is running. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'init_functions')
-rw-r--r--init_functions19
1 files changed, 9 insertions, 10 deletions
diff --git a/init_functions b/init_functions
index 58d5306..0233aa2 100644
--- a/init_functions
+++ b/init_functions
@@ -161,25 +161,24 @@ fsck_root() {
resolve_device() {
local major minor dev tagval device=$1
- # do lazy resolution of devices by tag when udev is
- # available. this allows us to wait on disks that
- # might not show up immediately (e.g. USB). If udev
- # isn't running, fall back on using blkid.
+ # attempt to resolve devices immediately. if this fails
+ # and udev is running, fall back on lazy resolution using
+ # /dev/disk/by-* symlinks. this is flexible enough to support
+ # usage of tags without udev and "slow" devices like root on
+ # USB, which might not immediately show up.
case $device in
UUID=*)
tagval=${device#*=}
- if [ "$udevd_running" -eq 1 ]; then
+ dev=$(blkid -U "$tagval")
+ if [ -z "$dev" -a "$udevd_running" -eq 1 ]; then
dev=/dev/disk/by-uuid/$tagval
- else
- dev=$(blkid -U "$tagval")
fi
;;
LABEL=*)
tagval=${device#*=}
- if [ "$udevd_running" -eq 1 ]; then
+ dev=$(blkid -L "$tagval")
+ if [ -z "$dev" -a "$udevd_running" -eq 1 ]; then
dev=/dev/disk/by-label/$tagval
- else
- dev=$(blkid -L "$tagval")
fi
;;
esac