Browse Source

Add rd.hostonly kernel command line parameters

rd.hostonly=0 will remove all configuration compiled in the initramfs
from the host on which it was build
master
Harald Hoyer 11 years ago
parent
commit
5a57582050
  1. 5
      dracut.cmdline.7.asc
  2. 1
      modules.d/90crypt/module-setup.sh
  3. 2
      modules.d/90kernel-modules/module-setup.sh
  4. 2
      modules.d/90lvm/module-setup.sh
  5. 6
      modules.d/90mdraid/module-setup.sh
  6. 2
      modules.d/95dasd/module-setup.sh
  7. 8
      modules.d/95udev-rules/module-setup.sh
  8. 2
      modules.d/95zfcp/module-setup.sh
  9. 4
      modules.d/98systemd/dracut-cmdline.sh
  10. 2
      modules.d/98systemd/module-setup.sh
  11. 14
      modules.d/99base/dracut-lib.sh
  12. 4
      modules.d/99base/init.sh

5
dracut.cmdline.7.asc

@ -81,6 +81,11 @@ rootfstype=ext3 @@ -81,6 +81,11 @@ rootfstype=ext3
enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or
lvm. Default is off as of dracut version >= 024.

**rd.hostonly=0**::
removes all compiled in configuration of the host system the initramfs image
was built on. This helps booting, if any disk layout changed, especially in
combination with rd.auto or other parameters specifying the layout.

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

1
modules.d/90crypt/module-setup.sh

@ -82,6 +82,7 @@ install() { @@ -82,6 +82,7 @@ install() {
fi
done
done < /etc/crypttab > $initdir/etc/crypttab
mark_hostonly /etc/crypttab
fi

inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"

2
modules.d/90kernel-modules/module-setup.sh

@ -79,7 +79,7 @@ installkernel() { @@ -79,7 +79,7 @@ installkernel() {
# called by dracut
install() {
inst_multiple -o /lib/modprobe.d/*.conf
[[ $hostonly ]] && inst_multiple -o /etc/modprobe.d/*.conf /etc/modprobe.conf
[[ $hostonly ]] && inst_multiple -H -o /etc/modprobe.d/*.conf /etc/modprobe.conf
if ! dracut_module_included "systemd"; then
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
fi

2
modules.d/90lvm/module-setup.sh

@ -59,7 +59,7 @@ install() { @@ -59,7 +59,7 @@ install() {

if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
if [ -f /etc/lvm/lvm.conf ]; then
inst_simple /etc/lvm/lvm.conf
inst_simple -H /etc/lvm/lvm.conf
# FIXME: near-term hack to establish read-only locking;
# use command-line lvm.conf editor once it is available
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' ${initdir}/etc/lvm/lvm.conf

6
modules.d/90mdraid/module-setup.sh

@ -107,16 +107,16 @@ install() { @@ -107,16 +107,16 @@ install() {

if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
if [ -f /etc/mdadm.conf ]; then
inst /etc/mdadm.conf
inst -H /etc/mdadm.conf
else
[ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf /etc/mdadm.conf
[ -f /etc/mdadm/mdadm.conf ] && inst -H /etc/mdadm/mdadm.conf /etc/mdadm.conf
fi
if [ -d /etc/mdadm.conf.d ]; then
local f
inst_dir /etc/mdadm.conf.d
for f in /etc/mdadm.conf.d/*.conf; do
[ -f "$f" ] || continue
inst "$f"
inst -H "$f"
done
fi
fi

2
modules.d/95dasd/module-setup.sh

@ -21,7 +21,7 @@ install() { @@ -21,7 +21,7 @@ install() {
inst_hook cmdline 30 "$moddir/parse-dasd.sh"
inst_multiple dasdinfo dasdconf.sh normalize_dasd_arg
if [[ $hostonly ]]; then
inst /etc/dasd.conf
inst -H /etc/dasd.conf
fi
inst_rules 56-dasd.rules
inst_rules 59-dasd.rules

8
modules.d/95udev-rules/module-setup.sh

@ -45,12 +45,8 @@ install() { @@ -45,12 +45,8 @@ install() {
# eudev rules
inst_rules 80-drivers-modprobe.rules

for _i in \
${systemdutildir}/network/*.link \
${hostonly:+/etc/systemd/network/*.link} \
; do
[[ -e "$_i" ]] && inst "$_i"
done
inst_multiple -o ${systemdutildir}/network/*.link
[[ $hostonly ]] && inst_multiple -H -o /etc/systemd/network/*.link

{
for i in cdrom tape dialout floppy; do

2
modules.d/95zfcp/module-setup.sh

@ -31,6 +31,6 @@ install() { @@ -31,6 +31,6 @@ install() {
inst_rules 56-zfcp.rules

if [[ $hostonly ]]; then
inst_simple /etc/zfcp.conf
inst_simple -H /etc/zfcp.conf
fi
}

4
modules.d/98systemd/dracut-cmdline.sh

@ -10,6 +10,10 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh @@ -10,6 +10,10 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
[ -f /etc/initrd-release ] && . /etc/initrd-release
[ -n "$VERSION" ] && info "dracut-$VERSION"

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

getargbool 0 rd.udev.log-priority=info -d rd.udev.info -d -n -y rdudevinfo && echo 'udev_log="info"' >> /etc/udev/udev.conf
getargbool 0 rd.udev.log-priority=debug -d rd.udev.debug -d -n -y rdudevdebug && echo 'udev_log="debug"' >> /etc/udev/udev.conf


2
modules.d/98systemd/module-setup.sh

@ -152,7 +152,7 @@ install() { @@ -152,7 +152,7 @@ install() {
[[ $_mods ]] && instmods $_mods

if [[ $hostonly ]]; then
inst_multiple -o \
inst_multiple -H -o \
/etc/systemd/journald.conf \
/etc/systemd/system.conf \
/etc/hostname \

14
modules.d/99base/dracut-lib.sh

@ -884,6 +884,8 @@ wait_for_dev() @@ -884,6 +884,8 @@ wait_for_dev()

_name="$(str_replace "$1" '/' '\x2f')"

type mark_hostonly >/dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh"

[ -e "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0

printf '[ -e "%s" ]\n' $1 \
@ -898,6 +900,7 @@ wait_for_dev() @@ -898,6 +900,7 @@ wait_for_dev()
if ! [ -L ${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device ]; then
[ -d ${PREFIX}/etc/systemd/system/initrd.target.wants ] || mkdir -p ${PREFIX}/etc/systemd/system/initrd.target.wants
ln -s ../${_name}.device ${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device
type mark_hostonly >/dev/null 2>&1 && mark_hostonly /etc/systemd/system/initrd.target.wants/${_name}.device
_needreload=1
fi

@ -907,6 +910,7 @@ wait_for_dev() @@ -907,6 +910,7 @@ wait_for_dev()
echo "[Unit]"
echo "JobTimeoutSec=0"
} > ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf
type mark_hostonly >/dev/null 2>&1 && mark_hostonly /etc/systemd/system/${_name}.device.d/timeout.conf
_needreload=1
fi

@ -1243,3 +1247,13 @@ show_memstats() @@ -1243,3 +1247,13 @@ show_memstats()
;;
esac
}

remove_hostonly_files() {
rm -fr /etc/cmdline /etc/cmdline.d/*.conf
if [ -f /lib/dracut/hostonly-files ]; then
while read line; do
[ -e "$line" ] || continue
rm -f "$line"
done < /lib/dracut/hostonly-files
fi
}

4
modules.d/99base/init.sh

@ -112,6 +112,10 @@ fi @@ -112,6 +112,10 @@ fi

source_conf /etc/conf.d

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

# run scriptlets to parse the command line
make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab'
getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"

Loading…
Cancel
Save