68 lines
2.5 KiB
Bash
68 lines
2.5 KiB
Bash
#!/hint/bash -euE
|
|
# Copyright (C) 2023 Umorpha Systems
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
post_install+=(20:base-uki:post_install)
|
|
base-uki:post_install() {
|
|
local arg_mountpoint=$1
|
|
|
|
# Patch a bug in the libalpm mkinitcpio hook that our `hook.preset`
|
|
# below would trigger.
|
|
# https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio/-/merge_requests/277
|
|
TMPDIR="$arg_mountpoint/usr/share/libalpm/scripts" patch "$arg_mountpoint/usr/share/libalpm/scripts/mkinitcpio" <<-'EOF'
|
|
--- /usr/share/libalpm/scripts/mkinitcpio.orig
|
|
+++ /usr/share/libalpm/scripts/mkinitcpio
|
|
@@ -39,10 +39,14 @@
|
|
unsorted_filelist+=("${ALL_uki}")
|
|
fi
|
|
if [[ -v preset_kver ]]; then
|
|
- unsorted_filelist+=("${preset_kver}")
|
|
+ if [[ "${preset_kver}" == /* && "${preset_kver}" != /usr/lib/modules/*/vmlinuz ]]; then
|
|
+ unsorted_filelist+=("${preset_kver}")
|
|
+ fi
|
|
unsorted_kernellist+=("${preset_kver}")
|
|
elif [[ -v ALL_kver ]]; then
|
|
- unsorted_filelist+=("${ALL_kver}")
|
|
+ if [[ "${ALL_kver}" == /* && "${ALL_kver}" != /usr/lib/modules/*/vmlinuz ]]; then
|
|
+ unsorted_filelist+=("${ALL_kver}")
|
|
+ fi
|
|
unsorted_kernellist+=("${ALL_kver}")
|
|
fi
|
|
done
|
|
@@ -88,8 +92,10 @@
|
|
read_preset "$pkgbase"
|
|
|
|
# always install the kernel
|
|
- for kernelfile in "${kernellist[@]}"; do
|
|
- install -Dm644 -- "$line" "${kernelfile}"
|
|
+ for kernel in "${kernellist[@]}"; do
|
|
+ if [[ "${kernel}" == /* && "${kernel}" != "/${line}" ]]; then
|
|
+ install -Dm644 -- "${line}" "${kernel}"
|
|
+ fi
|
|
done
|
|
)
|
|
|
|
EOF
|
|
|
|
cat >"$arg_mountpoint/usr/share/mkinitcpio/hook.preset" <<-'EOF'
|
|
#!/hint/bash
|
|
# mkinitcpio preset file for the '%PKGBASE%' package
|
|
|
|
#ALL_config="/etc/mkinitcpio.conf"
|
|
ALL_kver=$(grep -Fxl '%PKGBASE%' /usr/lib/modules/*/pkgbase|sed 's,pkgbase$,vmlinuz,')
|
|
ALL_microcode=(/boot/*-ucode.img)
|
|
|
|
PRESETS=('default' 'fallback')
|
|
|
|
#default_config="/etc/mkinitcpio.conf"
|
|
#default_image="/boot/initramfs-%PKGBASE%.img"
|
|
default_uki="/boot/EFI/Linux/parabola-%PKGBASE%.efi"
|
|
#default_options="--splash /usr/share/systemd/bootctl/splash-parabola.bmp"
|
|
|
|
#fallback_config="/etc/mkinitcpio.conf"
|
|
#fallback_image="/boot/initramfs-%PKGBASE%-fallback.img"
|
|
fallback_uki="/boot/EFI/Linux/parabola-%PKGBASE%-fallback.efi"
|
|
fallback_options="-S autodetect"
|
|
EOF
|
|
}
|