rootfs-block: search all host_devs for a journal device
authorHarald Hoyer <harald@redhat.com>
Thu, 15 Aug 2013 08:56:31 +0000 (10:56 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 15 Aug 2013 09:14:47 +0000 (11:14 +0200)
dracut.sh
modules.d/95rootfs-block/module-setup.sh

index 90605e1..e690b4e 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -938,6 +938,22 @@ for dev in ${host_devs[@]}; do
     check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
 done
 
+for dev in "${!host_fs_types[@]}"; do
+    [[ ${host_fs_types[$dev]} = "reiserfs" ]] || [[ ${host_fs_types[$dev]} = "xfs" ]] || continue
+    rootopts=$(find_dev_fsopts "$dev")
+    if [[ ${host_fs_types[$dev]} = "reiserfs" ]]; then
+        journaldev=$(fs_get_option $rootopts "jdev")
+    elif [[ ${host_fs_types[$dev]} = "xfs" ]]; then
+        journaldev=$(fs_get_option $rootopts "logdev")
+    fi
+    if [[ $journaldev ]]; then
+        dev="$(readlink -f "$dev")"
+        push host_devs "$dev"
+        _get_fs_type "$dev"
+        check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
+    fi
+done
+
 [[ -d $udevdir ]] \
     || udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
 if ! [[ -d "$udevdir" ]]; then
index d2e1019..32eec4a 100755 (executable)
@@ -3,25 +3,6 @@
 # ex: ts=8 sw=4 sts=4 et filetype=sh
 
 check() {
-        rootopts="defaults"
-        while read dev mp fs opts dump fsck; do
-            # skip comments
-            [ "${dev%%#*}" != "$dev" ] && continue
-
-            if [ "$mp" = "/" ]; then
-                # sanity - determine/fix fstype
-                rootfs=$(find_mp_fstype /)
-                rootfs=${rootfs:-$fs}
-                rootopts=$opts
-                break
-            fi
-        done < /etc/fstab
-
-        [ "$rootfs" = "reiserfs" ] && journaldev=$(fs_get_option $rootopts "jdev")
-        [ "$rootfs" = "xfs" ] && journaldev=$(fs_get_option $rootopts "logdev")
-        if [ -n "$journaldev" ]; then
-            echo "root.journaldev=$journaldev" >> "${initdir}/etc/cmdline.d/95root-jurnaldev.conf"
-        fi
     return 0
 }
 
@@ -30,6 +11,23 @@ depends() {
 }
 
 install() {
+
+    if [[ $hostonly ]]; then
+        for dev in "${!host_fs_types[@]}"; do
+            [[ ${host_fs_types[$dev]} = "reiserfs" ]] || [[ ${host_fs_types[$dev]} = "xfs" ]] || continue
+            rootopts=$(find_dev_fsopts "$dev")
+            if [[ ${host_fs_types[$dev]} = "reiserfs" ]]; then
+                journaldev=$(fs_get_option $rootopts "jdev")
+            elif [[ ${host_fs_types[$dev]} = "xfs" ]]; then
+                journaldev=$(fs_get_option $rootopts "logdev")
+            fi
+
+            if [ -n "$journaldev" ]; then
+                echo "root.journaldev=$journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
+            fi
+        done
+    fi
+
     inst_multiple umount
     inst_multiple tr
     if ! dracut_module_included "systemd"; then