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