File 0404-dracut-emergency-optionally-print-fs-help.patch of Package dracut.16003

From 033e11927e1f7f3d1163ba78dfd5e7a6bad41ee7 Mon Sep 17 00:00:00 2001
From: Mark Fasheh <mfasheh@suse.de>
Date: Fri, 24 Jun 2016 15:11:17 -0700
Subject: [PATCH] dracut-emergency: optionally print fs help

Allow filesystem modules to install a fs-specific text file with
instructions on what to do when mount fails. This is printed when we go into
an emergency shell.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 dracut-init.sh                                 | 6 ++++++
 modules.d/98dracut-systemd/dracut-emergency.sh | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/dracut-init.sh b/dracut-init.sh
index 0fda778..c941390 100644
--- a/dracut-init.sh
+++ b/dracut-init.sh
@@ -240,6 +240,12 @@ inst_script() {
     (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$@" || :
 }
 
+inst_fsck_help() {
+    local _helper="/usr/share/fsck/fsck_help_$1.txt"
+    $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper
+    (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
+}
+
 mark_hostonly() {
     for i in "$@"; do
         echo "$i" >> "$initdir/lib/dracut/hostonly-files"
diff --git a/modules.d/98dracut-systemd/dracut-emergency.sh b/modules.d/98dracut-systemd/dracut-emergency.sh
index 26be291..2d9ecd7 100755
--- a/modules.d/98dracut-systemd/dracut-emergency.sh
+++ b/modules.d/98dracut-systemd/dracut-emergency.sh
@@ -16,6 +16,7 @@ source_hook "$hook"
 
 
 if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
+    FSTXT="/usr/share/fsck/fsck_help_$fstype.txt"
     echo
     rdsosreport
     echo
@@ -26,6 +27,7 @@ if getargbool 1 rd.shell -d -y rdshell || getarg rd.break -d rdbreak; then
     echo 'after mounting them and attach it to a bug report.'
     echo
     echo
+    [ -f $FSTXT ] && cat $FSTXT
     [ -f /etc/profile ] && . /etc/profile
     [ -z "$PS1" ] && export PS1="$_name:\${PWD}# "
     exec sh -i -l
-- 
2.6.6

openSUSE Build Service is sponsored by