summaryrefslogtreecommitdiff
path: root/dracut-functions.sh
diff options
context:
space:
mode:
authorDave Young <dyoung@redhat.com>2012-09-10 16:10:46 +0800
committerHarald Hoyer <harald@redhat.com>2012-09-10 15:50:36 +0200
commitff0636635a0d20562d86ab5f4450bb8066dbd7dc (patch)
treee3ee2dcbe8361c0d27d66b30a0f339f2b5f00197 /dracut-functions.sh
parentba111df2b99f9f1dc5c51442ad92bcefbf16bd91 (diff)
downloaddracut-ff0636635a0d20562d86ab5f4450bb8066dbd7dc.tar.gz
dracut-ff0636635a0d20562d86ab5f4450bb8066dbd7dc.tar.bz2
dracut-ff0636635a0d20562d86ab5f4450bb8066dbd7dc.zip
move get_persistent_dev to dracut-functions.sh
kdump module also need to convert dev name to udev symlinks. So better to move function get_persistent_dev() to dracut-functions.sh Also in this patch improvement and fix the original function: a) use udevadm info --query=name to get the kernel name. This will fix the issue caused by passing symbolic link of a device. b) fix a bug to compare $_tmp instead of $i with $_dev. Really sorry, should have tested more carefully. Signed-off-by: Dave Young <dyoung@redhat.com>
Diffstat (limited to 'dracut-functions.sh')
-rwxr-xr-xdracut-functions.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 2399a1da..e6200c26 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -239,6 +239,21 @@ else
}
fi
+get_persistent_dev() {
+ local i _tmp _dev
+
+ _dev=$(udevadm info --query=name --name="$1" 2>/dev/null)
+ [ -z "$_dev" ] && return
+
+ for i in /dev/disk/by-id/*; do
+ _tmp=$(udevadm info --query=name --name="$i" 2>/dev/null)
+ if [ "$_tmp" = "$_dev" ]; then
+ echo $i
+ return
+ fi
+ done
+}
+
# get_fs_env <device>
# Get and set the ID_FS_TYPE and ID_FS_UUID variable from udev for a device.
# Example: