Harald Hoyer d9da66
From ba2cfcab1e47045690ef6bc6d8f8089066b929a2 Mon Sep 17 00:00:00 2001
Harald Hoyer d9da66
From: Harald Hoyer <harald@hoyer.xyz>
Harald Hoyer d9da66
Date: Mon, 8 Jan 2018 15:05:28 +0100
Harald Hoyer d9da66
Subject: [PATCH] Merge pull request #338 from danimo/fshelp
Harald Hoyer d9da66
Harald Hoyer d9da66
dracut-emergency: optionally print fs help
Harald Hoyer d9da66
---
Harald Hoyer d9da66
 dracut-init.sh                                 | 6 ++++++
Harald Hoyer d9da66
 modules.d/98dracut-systemd/dracut-emergency.sh | 2 ++
Harald Hoyer d9da66
 2 files changed, 8 insertions(+)
Harald Hoyer d9da66
Harald Hoyer d9da66
diff --git a/dracut-init.sh b/dracut-init.sh
Harald Hoyer d9da66
index e8a705ec..53e6f13a 100644
Harald Hoyer d9da66
--- a/dracut-init.sh
Harald Hoyer d9da66
+++ b/dracut-init.sh
Harald Hoyer d9da66
@@ -261,6 +261,12 @@ inst_script() {
Harald Hoyer d9da66
     (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@" || :
Harald Hoyer d9da66
 }
Harald Hoyer d9da66
 
Harald Hoyer d9da66
+inst_fsck_help() {
Harald Hoyer d9da66
+    local _helper="/run/dracut/fsck/fsck_help_$1.txt"
Harald Hoyer d9da66
+    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper
Harald Hoyer d9da66
+    (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
Harald Hoyer d9da66
+}
Harald Hoyer d9da66
+
Harald Hoyer d9da66
 mark_hostonly() {
Harald Hoyer d9da66
     for i in "$@"; do
Harald Hoyer d9da66
         echo "$i" >> "$initdir/lib/dracut/hostonly-files"
Harald Hoyer d9da66
diff --git a/modules.d/98dracut-systemd/dracut-emergency.sh b/modules.d/98dracut-systemd/dracut-emergency.sh
Harald Hoyer d9da66
index 548f64b9..f17460a7 100755
Harald Hoyer d9da66
--- a/modules.d/98dracut-systemd/dracut-emergency.sh
Harald Hoyer d9da66
+++ b/modules.d/98dracut-systemd/dracut-emergency.sh
Harald Hoyer d9da66
@@ -14,6 +14,7 @@ export _rdshell_name="dracut" action="Boot" hook="emergency"
Harald Hoyer d9da66
 _emergency_action=$(getarg rd.emergency)
Harald Hoyer d9da66
 
Harald Hoyer d9da66
 if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
Harald Hoyer d9da66
+    FSTXT="/run/dracut/fsck/fsck_help_$fstype.txt"
Harald Hoyer d9da66
     source_hook "$hook"
Harald Hoyer d9da66
     echo
Harald Hoyer d9da66
     rdsosreport
Harald Hoyer d9da66
@@ -25,6 +26,7 @@ if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
Harald Hoyer d9da66
     echo 'after mounting them and attach it to a bug report.'
Harald Hoyer d9da66
     echo
Harald Hoyer d9da66
     echo
Harald Hoyer d9da66
+    [ -f "$FSTXT" ] && cat "$FSTXT"
Harald Hoyer d9da66
     [ -f /etc/profile ] && . /etc/profile
Harald Hoyer d9da66
     [ -z "$PS1" ] && export PS1="$_name:\${PWD}# "
Harald Hoyer d9da66
     exec sh -i -l
Harald Hoyer d9da66