]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
ensure pre-mount (and resume) run before root fsck
authorAndrei Borzenkov <arvidjaar@gmail.com>
Fri, 26 Jun 2015 14:55:56 +0000 (16:55 +0200)
committerHarald Hoyer <harald@redhat.com>
Tue, 7 Jul 2015 11:44:24 +0000 (13:44 +0200)
References:
https://bugzilla.suse.com/show_bug.cgi?id=906592
Signed-off-by: Thomas Renninger <trenn@suse.de>
modules.d/98dracut-systemd/rootfs-generator.sh

index 670613e5c6265d1243094940fa1894f33a1cb8e0..5e79d0bbaf6bf81ef856d104e311b9f1f0fc0119 100755 (executable)
@@ -65,6 +65,23 @@ generator_mount_rootfs()
     fi
 }
 
+generator_fsck_after_pre_mount()
+{
+    local _name
+
+    [ -z "$1" ] && return 0
+
+    _name=$(dev_unit_name "$1")
+    [ -d /run/systemd/generator/systemd-fsck@${_name}.service.d ] || mkdir -p /run/systemd/generator/systemd-fsck@${_name}.service.d
+    if ! [ -f /run/systemd/generator/systemd-fsck@${_name}.service.d/after-pre-mount.conf ]; then
+        {
+            echo "[Unit]"
+            echo "After=dracut-pre-mount.service"
+        } > /run/systemd/generator/systemd-fsck@${_name}.service.d/after-pre-mount.conf
+    fi
+
+}
+
 root=$(getarg root=)
 case "$root" in
     block:LABEL=*|LABEL=*)
@@ -95,6 +112,7 @@ GENERATOR_DIR="$1"
 
 if [ "$rootok" = "1"  ]; then
    generator_wait_for_dev "${root#block:}" "$RDRETRY"
+   generator_fsck_after_pre_mount "${root#block:}"
    strstr "$(cat /proc/cmdline)" 'root=' || generator_mount_rootfs "${root#block:}" "$(getarg rootfstype=)" "$(getarg rootflags=)"
 fi