Add support for optionally omitting the fallback initrd

This commit is contained in:
dalto 2023-12-30 14:44:10 -06:00
parent 85eb991993
commit fadcb7ab76
3 changed files with 17 additions and 0 deletions

View file

@ -0,0 +1,4 @@
# This config file controls the automation provided by kernel-install-mkinitcpio
# When NO_FALLBACK is set to true, no fallback initrd will be generated
#KIM_NO_FALLBACK="false"

View file

@ -11,6 +11,12 @@ KERNEL_IMAGE="$4"
[[ "$COMMAND" == "add" ]] || exit 0
# Read the optional config file
[[ -f /etc/kernel-install-mkinitcpio.conf ]] && source /etc/kernel-install-mkinitcpio.conf
# Do nothing if the user has elected to omit the fallback initrd
[[ ${KIM_NO_FALLBACK} == "true" ]] && exit 0
GENERATOR_CMD=(mkinitcpio -k "$KERNEL_VERSION")
BLS_ARGS=(-g "$KERNEL_INSTALL_STAGING_AREA/initrd-fallback")

View file

@ -28,6 +28,10 @@ INITRD_OPTIONS_SHIFT=4
[ "$KERNEL_INSTALL_LAYOUT" = "bls" ] || exit 0
# Read the optional config file
[[ -f /etc/kernel-install-mkinitcpio.conf ]] && source /etc/kernel-install-mkinitcpio.conf
MACHINE_ID="${KERNEL_INSTALL_MACHINE_ID:?}"
ENTRY_TOKEN="${KERNEL_INSTALL_ENTRY_TOKEN:?}"
BOOT_ROOT="${KERNEL_INSTALL_BOOT_ROOT:?}"
@ -58,6 +62,9 @@ case "$COMMAND" in
;;
esac
# Do nothing if the user has elected to omit the fallback initrd
[[ ${KIM_NO_FALLBACK} == "true" ]] && exit 0
if [ -f /etc/os-release ]; then
# shellcheck source=/dev/null
. /etc/os-release