Add flag to toggle hostonly cmdline storing in the initramfs

--hostonly-cmdline:
    Store kernel command line arguments needed in the initramfs

--no-hostonly-cmdline:
    Do not store kernel command line arguments needed in the initramfs
master
Harald Hoyer 2014-02-25 12:35:32 +01:00
parent 103c5e1ecb
commit ab9457efd7
8 changed files with 63 additions and 25 deletions

View File

@ -300,6 +300,12 @@ provide a valid _/etc/fstab_.
**-N, --no-hostonly**::
Disable Host-Only mode

**--hostonly-cmdline**:
Store kernel command line arguments needed in the initramfs

**--no-hostonly-cmdline**:
Do not store kernel command line arguments needed in the initramfs

**--persistent-policy** _<policy>_::
Use _<policy>_ to address disks and partitions.
_<policy>_ can be any directory name found in /dev/disk.

View File

@ -76,6 +76,9 @@ Configuration files must have the extension .conf; other extensions are ignored.
Host-Only mode: Install only what is needed for booting the local host
instead of a generic host and generate host-specific configuration.

*hostonly_cmdline*"__{yes|no}__"::
If set, store the kernel command line arguments needed in the initramfs

*persistent_policy=*"__<policy>__"::
Use _<policy>_ to address disks and partitions.
_<policy>_ can be any directory name found in /dev/disk.

View File

@ -137,6 +137,10 @@ Creates initial ramdisk images for preloading modules
-H, --hostonly Host-Only mode: Install only what is needed for
booting the local host instead of a generic host.
-N, --no-hostonly Disables Host-Only mode
--hostonly-cmdline Store kernel command line arguments needed
in the initramfs
--no-hostonly-cmdline Do not store kernel command line arguments needed
in the initramfs
--persistent-policy [POLICY]
Use [POLICY] to address disks and partitions.
POLICY can be any directory name found in /dev/disk.
@ -488,9 +492,12 @@ while :; do
-f|--force) force=yes;;
--kernel-only) kernel_only="yes"; no_kernel="no";;
--no-kernel) kernel_only="no"; no_kernel="yes";;
--print-cmdline) print_cmdline="yes"; hostonly_l="yes"; kernel_only="yes"; no_kernel="yes";;
--early-microcode) early_microcode_l="yes";;
--no-early-microcode) early_microcode_l="no";;
--print-cmdline)
print_cmdline="yes"; hostonly_l="yes"; kernel_only="yes"; no_kernel="yes";;
--early-microcode)
early_microcode_l="yes";;
--no-early-microcode)
early_microcode_l="no";;
--strip) do_strip_l="yes";;
--nostrip) do_strip_l="no";;
--prelink) do_prelink_l="yes";;
@ -517,6 +524,10 @@ while :; do
hostonly_l="yes" ;;
-N|--no-hostonly|--no-host-only)
hostonly_l="no" ;;
--hostonly-cmdline)
hostonly_cmdline_l="yes" ;;
--no-hostonly-cmdline)
hostonly_cmdline_l="no" ;;
--persistent-policy)
persistent_policy_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--fstab) use_fstab_l="yes" ;;
@ -755,6 +766,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $prefix_l ]] && prefix=$prefix_l
[[ $prefix = "/" ]] && unset prefix
[[ $hostonly_l ]] && hostonly=$hostonly_l
[[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_l
[[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l

View File

@ -51,8 +51,10 @@ cmdline() {
# called by dracut
install() {

cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
if [[ $hostonly_cmdline == "yes" ]]; then
cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
fi

inst_multiple cryptsetup rmdir readlink umount
inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask

View File

@ -65,8 +65,10 @@ cmdline() {
install() {
local _i

cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
echo >> "${initdir}/etc/cmdline.d/90dmraid.conf"
if [[ $hostonly_cmdline == "yes" ]]; then
cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
echo >> "${initdir}/etc/cmdline.d/90dmraid.conf"
fi

inst_multiple dmraid
inst_multiple -o kpartx

View File

@ -50,8 +50,10 @@ install() {

inst lvm

cmdline >> "${initdir}/etc/cmdline.d/90lvm.conf"
echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
if [[ $hostonly_cmdline == "yes" ]]; then
cmdline >> "${initdir}/etc/cmdline.d/90lvm.conf"
echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
fi

inst_rules "$moddir/64-lvm.rules"


View File

@ -70,8 +70,10 @@ install() {
inst $(command -v partx) /sbin/partx
inst $(command -v mdadm) /sbin/mdadm

cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf"
echo >> "${initdir}/etc/cmdline.d/90mdraid.conf"
if [[ $hostonly_cmdline == "yes" ]]; then
cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf"
echo >> "${initdir}/etc/cmdline.d/90mdraid.conf"
fi

# <mdadm-3.3 udev rule
inst_rules 64-md-raid.rules

View File

@ -12,19 +12,7 @@ depends() {
echo fs-lib
}

# called by dracut
cmdline() {
local dev=/dev/block/$(find_root_block_device)
if [ -e $dev ]; then
printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
printf " rootflags=%s" "$(find_mp_fsopts /)"
printf " rootfstype=%s" "$(find_mp_fstype /)"
fi
}

# called by dracut
install() {

cmdline_journal() {
if [[ $hostonly ]]; then
for dev in "${!host_fs_types[@]}"; do
[[ ${host_fs_types[$dev]} = "reiserfs" ]] || [[ ${host_fs_types[$dev]} = "xfs" ]] || continue
@ -36,10 +24,31 @@ install() {
fi

if [ -n "$journaldev" ]; then
printf "%s\n" "root.journaldev=$journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
printf " root.journaldev=%s" "$journaldev"
fi
done
fi
return 0
}

# called by dracut
cmdline() {
local dev=/dev/block/$(find_root_block_device)
if [ -e $dev ]; then
printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
printf " rootflags=%s" "$(find_mp_fsopts /)"
printf " rootfstype=%s" "$(find_mp_fstype /)"
fi
cmdline_journal
}

# called by dracut
install() {
if [[ $hostonly_cmdline == "yes" ]]; then
cmdline_journal | while read journaldev; do
[[ $journaldev ]] && printf "%s\n" "$journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
done
fi

inst_multiple umount
inst_multiple tr