Add "rd.cmdline=ask" kernel command line parameter

prompts the user for additional kernel command line parameters
master
Harald Hoyer 2014-06-27 12:02:14 +02:00
parent 30f6c80d7a
commit f232f6623d
6 changed files with 68 additions and 0 deletions

View File

@ -86,6 +86,9 @@ rootfstype=ext3
was built on. This helps booting, if any disk layout changed, especially in was built on. This helps booting, if any disk layout changed, especially in
combination with rd.auto or other parameters specifying the layout. combination with rd.auto or other parameters specifying the layout.


**rd.cmdline=ask**::
prompts the user for additional kernel command line parameters

**rd.fstab=0**:: **rd.fstab=0**::
do not honor special mount options for the root filesystem found in do not honor special mount options for the root filesystem found in
_/etc/fstab_ of the real root. _/etc/fstab_ of the real root.

View File

@ -0,0 +1,33 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.

# See systemd.special(7) for details

[Unit]
Description=dracut ask for additional cmdline parameters
DefaultDependencies=no
Before=dracut-cmdline.service
After=systemd-journald.socket
Wants=systemd-journald.socket
ConditionPathExists=/etc/initrd-release
ConditionKernelCommandLine=rd.cmdline=ask

[Service]
Environment=DRACUT_SYSTEMD=1
Environment=NEWROOT=/sysroot
Type=oneshot
ExecStart=-/bin/dracut-cmdline-ask
StandardInput=tty
StandardOutput=inherit
StandardError=inherit
RemainAfterExit=yes
KillMode=process
IgnoreSIGPIPE=no

# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
# terminates cleanly.
KillSignal=SIGHUP

View File

@ -0,0 +1,20 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

sleep 0.5
echo
sleep 0.5
echo
sleep 0.5
echo
echo
echo
echo
echo "Enter additional kernel command line parameter (end with ctrl-d or .)"
while read -e -p "> " line; do
[[ "$line" == "." ]] && break
[[ "$line" ]] && printf -- "%s\n" "$line" >> /etc/cmdline.d/99-cmdline-ask.conf
done

exit 0

View File

@ -11,7 +11,9 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
[ -n "$VERSION" ] && info "dracut-$VERSION" [ -n "$VERSION" ] && info "dracut-$VERSION"


if ! getargbool 1 'rd.hostonly'; then if ! getargbool 1 'rd.hostonly'; then
[ -f /etc/cmdline.d/99-cmdline-ask.conf ] && mv /etc/cmdline.d/99-cmdline-ask.conf /tmp/99-cmdline-ask.conf
remove_hostonly_files remove_hostonly_files
[ -f /tmp/99-cmdline-ask.conf ] && mv /tmp/99-cmdline-ask.conf /etc/cmdline.d/99-cmdline-ask.conf
fi fi


info "Using kernel command line parameters:" info "Using kernel command line parameters:"

View File

@ -187,6 +187,7 @@ install() {
ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target" ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"


inst_script "$moddir/dracut-cmdline.sh" /bin/dracut-cmdline inst_script "$moddir/dracut-cmdline.sh" /bin/dracut-cmdline
inst_script "$moddir/dracut-cmdline-ask.sh" /bin/dracut-cmdline-ask
inst_script "$moddir/dracut-pre-udev.sh" /bin/dracut-pre-udev inst_script "$moddir/dracut-pre-udev.sh" /bin/dracut-pre-udev
inst_script "$moddir/dracut-pre-trigger.sh" /bin/dracut-pre-trigger inst_script "$moddir/dracut-pre-trigger.sh" /bin/dracut-pre-trigger
inst_script "$moddir/dracut-initqueue.sh" /bin/dracut-initqueue inst_script "$moddir/dracut-initqueue.sh" /bin/dracut-initqueue
@ -216,6 +217,7 @@ install() {
mkdir -p "${initdir}/$systemdsystemunitdir/initrd.target.wants" mkdir -p "${initdir}/$systemdsystemunitdir/initrd.target.wants"
for i in \ for i in \
dracut-cmdline.service \ dracut-cmdline.service \
dracut-cmdline-ask.service \
dracut-initqueue.service \ dracut-initqueue.service \
dracut-mount.service \ dracut-mount.service \
dracut-pre-mount.service \ dracut-pre-mount.service \

View File

@ -112,6 +112,14 @@ fi


source_conf /etc/conf.d source_conf /etc/conf.d


if getarg "rd.cmdline=ask"; then
echo "Enter additional kernel command line parameter (end with ctrl-d or .)"
while read -p "> " line; do
[ "$line" = "." ] && break
echo "$line" >> /etc/cmdline.d/99-cmdline-ask.conf
done
fi

if ! getargbool 1 'rd.hostonly'; then if ! getargbool 1 'rd.hostonly'; then
remove_hostonly_files remove_hostonly_files
fi fi