Blame SOURCES/0189-Add-rd.cmdline-ask-kernel-command-line-parameter.patch

18971c
From 9c2daa5d3aa1b98d5a005a78a7a2d332e7422034 Mon Sep 17 00:00:00 2001
18971c
From: Harald Hoyer <harald@redhat.com>
18971c
Date: Fri, 27 Jun 2014 12:02:14 +0200
18971c
Subject: [PATCH] Add "rd.cmdline=ask" kernel command line parameter
18971c
18971c
prompts the user for additional kernel command line parameters
18971c
18971c
(cherry picked from commit f232f6623d2b761c1538192c97e13842e5037adc)
18971c
18971c
Conflicts:
18971c
	dracut.cmdline.7.asc
18971c
	modules.d/98systemd/dracut-cmdline.sh
18971c
	modules.d/99base/init.sh
18971c
---
18971c
 dracut.cmdline.7.asc                          |  4 +++
18971c
 .../98systemd/dracut-cmdline-ask.service      | 33 +++++++++++++++++++
18971c
 modules.d/98systemd/dracut-cmdline-ask.sh     | 20 +++++++++++
18971c
 modules.d/98systemd/module-setup.sh           |  2 ++
18971c
 modules.d/99base/init.sh                      |  8 +++++
18971c
 5 files changed, 67 insertions(+)
18971c
 create mode 100644 modules.d/98systemd/dracut-cmdline-ask.service
18971c
 create mode 100755 modules.d/98systemd/dracut-cmdline-ask.sh
18971c
18971c
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
18971c
index 10550eef..24bf4491 100644
18971c
--- a/dracut.cmdline.7.asc
18971c
+++ b/dracut.cmdline.7.asc
18971c
@@ -81,6 +81,10 @@ rootfstype=ext3
18971c
     enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or
18971c
     lvm. Default is off as of dracut version >= 024.
18971c
 
18971c
+
18971c
+**rd.cmdline=ask**::
18971c
+    prompts the user for additional kernel command line parameters
18971c
+
18971c
 **rd.fstab=0**::
18971c
     do not honor special mount options for the root filesystem found in
18971c
     _/etc/fstab_ of the real root.
18971c
diff --git a/modules.d/98systemd/dracut-cmdline-ask.service b/modules.d/98systemd/dracut-cmdline-ask.service
18971c
new file mode 100644
18971c
index 00000000..9993671c
18971c
--- /dev/null
18971c
+++ b/modules.d/98systemd/dracut-cmdline-ask.service
18971c
@@ -0,0 +1,33 @@
18971c
+#  This file is part of systemd.
18971c
+#
18971c
+#  systemd is free software; you can redistribute it and/or modify it
18971c
+#  under the terms of the GNU Lesser General Public License as published by
18971c
+#  the Free Software Foundation; either version 2.1 of the License, or
18971c
+#  (at your option) any later version.
18971c
+
18971c
+# See systemd.special(7) for details
18971c
+
18971c
+[Unit]
18971c
+Description=dracut ask for additional cmdline parameters
18971c
+DefaultDependencies=no
18971c
+Before=dracut-cmdline.service
18971c
+After=systemd-journald.socket
18971c
+Wants=systemd-journald.socket
18971c
+ConditionPathExists=/etc/initrd-release
18971c
+ConditionKernelCommandLine=rd.cmdline=ask
18971c
+
18971c
+[Service]
18971c
+Environment=DRACUT_SYSTEMD=1
18971c
+Environment=NEWROOT=/sysroot
18971c
+Type=oneshot
18971c
+ExecStart=-/bin/dracut-cmdline-ask
18971c
+StandardInput=tty
18971c
+StandardOutput=inherit
18971c
+StandardError=inherit
18971c
+RemainAfterExit=yes
18971c
+KillMode=process
18971c
+IgnoreSIGPIPE=no
18971c
+
18971c
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
18971c
+# terminates cleanly.
18971c
+KillSignal=SIGHUP
18971c
diff --git a/modules.d/98systemd/dracut-cmdline-ask.sh b/modules.d/98systemd/dracut-cmdline-ask.sh
18971c
new file mode 100755
18971c
index 00000000..024d60ee
18971c
--- /dev/null
18971c
+++ b/modules.d/98systemd/dracut-cmdline-ask.sh
18971c
@@ -0,0 +1,20 @@
18971c
+#!/bin/bash
18971c
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
18971c
+# ex: ts=8 sw=4 sts=4 et filetype=sh
18971c
+
18971c
+sleep 0.5
18971c
+echo
18971c
+sleep 0.5
18971c
+echo
18971c
+sleep 0.5
18971c
+echo
18971c
+echo
18971c
+echo
18971c
+echo
18971c
+echo "Enter additional kernel command line parameter (end with ctrl-d or .)"
18971c
+while read -e -p "> " line; do
18971c
+    [[ "$line" == "." ]] && break
18971c
+    [[ "$line" ]] && printf -- "%s\n" "$line" >> /etc/cmdline.d/99-cmdline-ask.conf
18971c
+done
18971c
+
18971c
+exit 0
18971c
diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh
18971c
index 0de9d614..015597f4 100755
18971c
--- a/modules.d/98systemd/module-setup.sh
18971c
+++ b/modules.d/98systemd/module-setup.sh
18971c
@@ -183,6 +183,7 @@ install() {
18971c
     ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"
18971c
 
18971c
     inst_script "$moddir/dracut-cmdline.sh" /bin/dracut-cmdline
18971c
+    inst_script "$moddir/dracut-cmdline-ask.sh" /bin/dracut-cmdline-ask
18971c
     inst_script "$moddir/dracut-pre-udev.sh" /bin/dracut-pre-udev
18971c
     inst_script "$moddir/dracut-pre-trigger.sh" /bin/dracut-pre-trigger
18971c
     inst_script "$moddir/dracut-initqueue.sh" /bin/dracut-initqueue
18971c
@@ -212,6 +213,7 @@ install() {
18971c
     mkdir -p "${initdir}/$systemdsystemunitdir/initrd.target.wants"
18971c
     for i in \
18971c
         dracut-cmdline.service \
18971c
+        dracut-cmdline-ask.service \
18971c
         dracut-initqueue.service \
18971c
         dracut-mount.service \
18971c
         dracut-pre-mount.service \
18971c
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
18971c
index ae73fd2c..9ee3e9dc 100755
18971c
--- a/modules.d/99base/init.sh
18971c
+++ b/modules.d/99base/init.sh
18971c
@@ -115,6 +115,14 @@ fi
18971c
 
18971c
 source_conf /etc/conf.d
18971c
 
18971c
+if getarg "rd.cmdline=ask"; then
18971c
+    echo "Enter additional kernel command line parameter (end with ctrl-d or .)"
18971c
+    while read -p "> " line; do
18971c
+        [ "$line" = "." ] && break
18971c
+        echo "$line" >> /etc/cmdline.d/99-cmdline-ask.conf
18971c
+    done
18971c
+fi
18971c
+
18971c
 # run scriptlets to parse the command line
18971c
 make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab'
18971c
 getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"