Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
c67ca7f88d | |||
|
e3374d38af | ||
|
fadcb7ab76 | ||
|
85eb991993 |
6 changed files with 39 additions and 30 deletions
4
src/etc/kernel-install-mkinitcpio.conf
Normal file
4
src/etc/kernel-install-mkinitcpio.conf
Normal 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"
|
|
@ -1,26 +0,0 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
COMMAND="${1:?}"
|
||||
# shellcheck disable=SC2034
|
||||
KERNEL_VERSION="${2:?}"
|
||||
# shellcheck disable=SC2034
|
||||
ENTRY_DIR_ABS="$3"
|
||||
# shellcheck disable=SC2034
|
||||
KERNEL_IMAGE="$4"
|
||||
|
||||
set -e
|
||||
|
||||
[[ "$COMMAND" = "add" ]] || exit 0
|
||||
|
||||
for dir in "${KERNEL_INSTALL_BOOT_ROOT}" "/boot"; do
|
||||
for microcode in "intel-ucode.img" "amd-ucode.img"; do
|
||||
if [[ -f "${dir}/${microcode}" ]]; then
|
||||
install -m 0644 "${dir}/${microcode}" "${KERNEL_INSTALL_STAGING_AREA}/microcode-${microcode}" || {
|
||||
echo "Error: could not copy '$microcode' to the staging area." >&2
|
||||
exit 1
|
||||
}
|
||||
(( KERNEL_INSTALL_VERBOSE )) && printf "+ Found microcode image %s\n" "$microcode" || exit 0
|
||||
fi
|
||||
done
|
||||
done
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Type = Path
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Target = usr/lib/modules/*/vmlinuz
|
||||
Operation = Remove
|
||||
Target = usr/lib/initcpio/*
|
||||
Target = usr/lib/firmware/*
|
||||
Target = usr/src/*/dkms.conf
|
||||
|
@ -15,6 +15,12 @@ Operation = Remove
|
|||
Target = amd-ucode
|
||||
Target = intel-ucode
|
||||
|
||||
[Trigger]
|
||||
Type = Path
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Target = usr/lib/modules/*/vmlinuz
|
||||
|
||||
[Action]
|
||||
Description = Installing kernel...
|
||||
When = PostTransaction
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
|
||||
echo "Skipping hook execution in chroot."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while read -r line; do
|
||||
version=$(basename "${line%/vmlinuz}")
|
||||
|
@ -6,14 +10,22 @@ while read -r line; do
|
|||
echo ":: kernel-install removing kernel $version"
|
||||
kernel-install remove "${version}"
|
||||
elif [[ $1 == "add" ]]; then
|
||||
echo ":: kernel-install installing kernel $version"
|
||||
kernel-install add "${version}" "${line}"
|
||||
if [[ line =~ ".*vmlinuz$" ]]; then
|
||||
echo ":: kernel-install installing kernel $version"
|
||||
kernel-install add "${version}" "${line}"
|
||||
else
|
||||
install_all=1
|
||||
break
|
||||
fi
|
||||
else
|
||||
echo ":: Invalid option passed to kernel-install script"
|
||||
fi
|
||||
version=$(basename "${line%/vmlinuz}")
|
||||
done
|
||||
|
||||
if [[ $install_all == 1 ]]; then
|
||||
reinstall-kernels
|
||||
fi
|
||||
|
||||
# first check if we are running in a chroot
|
||||
if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
|
||||
echo 'Running in a chroot, skipping cmdline generation'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue