diff --git a/src/etc/kernel-install-for-dracut.conf b/src/etc/kernel-install-for-dracut.conf new file mode 100644 index 0000000..29e9ddb --- /dev/null +++ b/src/etc/kernel-install-for-dracut.conf @@ -0,0 +1,7 @@ +# This config file controls the automation provided by kernel-install-for-dracut + +# When DRACUT_QUIET is set to true, dracut will operate with quiet flag set suppressing most output +#DRACUT_QUIET="false" + +# When NO_FALLBACK is set to true, no fallback initrd will be generated +#NO_DRACUT_FALLBACK="false" diff --git a/src/etc/kernel/install.d/50-dracut.install b/src/etc/kernel/install.d/50-dracut.install index 7af3114..5858b05 100755 --- a/src/etc/kernel/install.d/50-dracut.install +++ b/src/etc/kernel/install.d/50-dracut.install @@ -5,6 +5,9 @@ KERNEL_VERSION="$2" BOOT_DIR_ABS="$3" KERNEL_IMAGE="$4" +# Read the optional config file for automation +[[ -f /etc/kernel-install-for-dracut.conf ]] && source /etc/kernel-install-for-dracut.conf + # If KERNEL_INSTALL_MACHINE_ID is defined but empty, BOOT_DIR_ABS is a fake directory. # So, let's skip to create initrd. if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then @@ -54,7 +57,8 @@ case "$COMMAND" in break fi done - dracut --hostonly --no-hostonly-cmdline -f ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION" + [[ ${DRACUT_QUIET} == "true" ]] && DRACUT_EXTRA_PARAMS=" --quiet" + dracut --hostonly --no-hostonly-cmdline -f${DRACUT_EXTRA_PARAMS} ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION" ret=$? ;; remove) diff --git a/src/usr/lib/kernel/install.d/50-dracut-fallback.install b/src/usr/lib/kernel/install.d/50-dracut-fallback.install index 5ccffe7..f3362bb 100755 --- a/src/usr/lib/kernel/install.d/50-dracut-fallback.install +++ b/src/usr/lib/kernel/install.d/50-dracut-fallback.install @@ -5,6 +5,12 @@ KERNEL_VERSION="$2" BOOT_DIR_ABS="$3" KERNEL_IMAGE="$4" +# Read the optional config file for automation +[[ -f /etc/kernel-install-for-dracut.conf ]] && source /etc/kernel-install-for-dracut.conf + +# Do nothing if the user has elected to omit the fallback initrd +[[ ${NO_DRACUT_FALLBACK} == "true" ]] && exit 0 + # If KERNEL_INSTALL_MACHINE_ID is defined but empty, BOOT_DIR_ABS is a fake directory. # So, let's skip to create initrd. if ! [[ ${KERNEL_INSTALL_MACHINE_ID-x} ]]; then @@ -54,7 +60,8 @@ case "$COMMAND" in break fi done - dracut -f ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION" + [[ ${DRACUT_QUIET} == "true" ]] && DRACUT_EXTRA_PARAMS=" --quiet" + dracut --no-hostonly --force${DRACUT_EXTRA_PARAMS} ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION" ret=$? ;; remove) diff --git a/src/usr/lib/kernel/install.d/90-loaderentry-fallback.install b/src/usr/lib/kernel/install.d/90-loaderentry-fallback.install index 22cfd49..685fbc4 100755 --- a/src/usr/lib/kernel/install.d/90-loaderentry-fallback.install +++ b/src/usr/lib/kernel/install.d/90-loaderentry-fallback.install @@ -26,6 +26,9 @@ INITRD_OPTIONS_SHIFT=4 [ "$KERNEL_INSTALL_LAYOUT" = "bls" ] || exit 0 +# Read the optional config file for automation +[[ -f /etc/kernel-install-for-dracut.conf ]] && source /etc/kernel-install-for-dracut.conf + MACHINE_ID="$KERNEL_INSTALL_MACHINE_ID" ENTRY_TOKEN="$KERNEL_INSTALL_ENTRY_TOKEN" BOOT_ROOT="$KERNEL_INSTALL_BOOT_ROOT" @@ -43,7 +46,7 @@ case "$COMMAND" in echo "Removing $BOOT_ROOT/loader/entries/$ENTRY_TOKEN-$KERNEL_VERSION-fallback*.conf" exec rm -f \ "$BOOT_ROOT/loader/entries/$ENTRY_TOKEN-$KERNEL_VERSION-fallback.conf" \ - "$BOOT_ROOT/loader/entries/$ENTRY_TOKEN-$KERNEL_VERSION-fallback+"*".conf" + "$BOOT_ROOT/loader/entries/$ENTRY_TOKEN-$KERNEL_VERSION-fallback+"*".conf" 2> /dev/null || true ;; add) ;; @@ -52,6 +55,9 @@ case "$COMMAND" in ;; esac +# Do nothing if the user has elected to omit the fallback initrd +[[ ${NO_DRACUT_FALLBACK} == "true" ]] && exit 0 + if [ -r /etc/os-release ]; then # shellcheck source=/dev/null . /etc/os-release