Compare commits
No commits in common. "master" and "1.6" have entirely different histories.
6 changed files with 30 additions and 39 deletions
|
@ -1,4 +0,0 @@
|
||||||
# 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"
|
|
26
src/etc/kernel/install.d/40-microcode.install
Executable file
26
src/etc/kernel/install.d/40-microcode.install
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/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,12 +11,6 @@ KERNEL_IMAGE="$4"
|
||||||
|
|
||||||
[[ "$COMMAND" == "add" ]] || exit 0
|
[[ "$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")
|
GENERATOR_CMD=(mkinitcpio -k "$KERNEL_VERSION")
|
||||||
BLS_ARGS=(-g "$KERNEL_INSTALL_STAGING_AREA/initrd-fallback")
|
BLS_ARGS=(-g "$KERNEL_INSTALL_STAGING_AREA/initrd-fallback")
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,6 @@ INITRD_OPTIONS_SHIFT=4
|
||||||
|
|
||||||
[ "$KERNEL_INSTALL_LAYOUT" = "bls" ] || exit 0
|
[ "$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:?}"
|
MACHINE_ID="${KERNEL_INSTALL_MACHINE_ID:?}"
|
||||||
ENTRY_TOKEN="${KERNEL_INSTALL_ENTRY_TOKEN:?}"
|
ENTRY_TOKEN="${KERNEL_INSTALL_ENTRY_TOKEN:?}"
|
||||||
BOOT_ROOT="${KERNEL_INSTALL_BOOT_ROOT:?}"
|
BOOT_ROOT="${KERNEL_INSTALL_BOOT_ROOT:?}"
|
||||||
|
@ -62,9 +58,6 @@ case "$COMMAND" in
|
||||||
;;
|
;;
|
||||||
esac
|
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
|
if [ -f /etc/os-release ]; then
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Type = Path
|
Type = Path
|
||||||
Operation = Install
|
Operation = Install
|
||||||
Operation = Upgrade
|
Operation = Upgrade
|
||||||
Operation = Remove
|
Target = usr/lib/modules/*/vmlinuz
|
||||||
Target = usr/lib/initcpio/*
|
Target = usr/lib/initcpio/*
|
||||||
Target = usr/lib/firmware/*
|
Target = usr/lib/firmware/*
|
||||||
Target = usr/src/*/dkms.conf
|
Target = usr/src/*/dkms.conf
|
||||||
|
@ -15,12 +15,6 @@ Operation = Remove
|
||||||
Target = amd-ucode
|
Target = amd-ucode
|
||||||
Target = intel-ucode
|
Target = intel-ucode
|
||||||
|
|
||||||
[Trigger]
|
|
||||||
Type = Path
|
|
||||||
Operation = Install
|
|
||||||
Operation = Upgrade
|
|
||||||
Target = usr/lib/modules/*/vmlinuz
|
|
||||||
|
|
||||||
[Action]
|
[Action]
|
||||||
Description = Installing kernel...
|
Description = Installing kernel...
|
||||||
When = PostTransaction
|
When = PostTransaction
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/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
|
while read -r line; do
|
||||||
version=$(basename "${line%/vmlinuz}")
|
version=$(basename "${line%/vmlinuz}")
|
||||||
|
@ -10,22 +6,14 @@ while read -r line; do
|
||||||
echo ":: kernel-install removing kernel $version"
|
echo ":: kernel-install removing kernel $version"
|
||||||
kernel-install remove "${version}"
|
kernel-install remove "${version}"
|
||||||
elif [[ $1 == "add" ]]; then
|
elif [[ $1 == "add" ]]; then
|
||||||
if [[ line =~ ".*vmlinuz$" ]]; then
|
echo ":: kernel-install installing kernel $version"
|
||||||
echo ":: kernel-install installing kernel $version"
|
kernel-install add "${version}" "${line}"
|
||||||
kernel-install add "${version}" "${line}"
|
|
||||||
else
|
|
||||||
install_all=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo ":: Invalid option passed to kernel-install script"
|
echo ":: Invalid option passed to kernel-install script"
|
||||||
fi
|
fi
|
||||||
|
version=$(basename "${line%/vmlinuz}")
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $install_all == 1 ]]; then
|
|
||||||
reinstall-kernels
|
|
||||||
fi
|
|
||||||
|
|
||||||
# first check if we are running in a chroot
|
# first check if we are running in a chroot
|
||||||
if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
|
if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
|
||||||
echo 'Running in a chroot, skipping cmdline generation'
|
echo 'Running in a chroot, skipping cmdline generation'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue