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.
fi
done
done < /etc/crypttab > $initdir/etc/crypttab
+ mark_hostonly /etc/crypttab
fi
inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
# 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
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
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
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
# 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
inst_rules 56-zfcp.rules
if [[ $hostonly ]]; then
- inst_simple /etc/zfcp.conf
+ inst_simple -H /etc/zfcp.conf
fi
}
[ -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
[[ $_mods ]] && instmods $_mods
if [[ $hostonly ]]; then
- inst_multiple -o \
+ inst_multiple -H -o \
/etc/systemd/journald.conf \
/etc/systemd/system.conf \
/etc/hostname \
_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 \
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
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
;;
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
+}
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"