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