Skip to content

Instantly share code, notes, and snippets.

@HiFiPhile
Forked from nickdiego/999-kernel-efi-copy.hook
Created October 21, 2020 12:18
Show Gist options
  • Save HiFiPhile/e0c7e79df8ca8ab85c74a6c38447a027 to your computer and use it in GitHub Desktop.
Save HiFiPhile/e0c7e79df8ca8ab85c74a6c38447a027 to your computer and use it in GitHub Desktop.
efi-hooks-arch
# /etc/pacman.d/hooks/999-kernel-efi-copy.hook
[Trigger]
Type = File
Operation = Install
Operation = Upgrade
Target = boot/vmlinuz*
Target = usr/lib/initcpio/*
Target = boot/*-ucode.img
[Action]
Description = Copying linux and initramfs to EFI directory...
When = PostTransaction
Exec = /usr/local/bin/kernel-efi-copy.sh
#!/usr/bin/env bash
#
# Copy kernel and initramfs images to EFI directory
# /usr/local/bin/kernel-efi-copy.sh
ESP_DIR="/boot/efi/EFI/arch"
for file in /boot/vmlinuz*
do
cp -af "$file" "$ESP_DIR/$(basename "$file").efi"
[[ $? -ne 0 ]] && exit 1
done
for file in /boot/initramfs*
do
cp -af "$file" "$ESP_DIR/"
[[ $? -ne 0 ]] && exit 1
done
[[ -e /boot/intel-ucode.img ]] && cp -af /boot/intel-ucode.img "$ESP_DIR/"
[[ -e /boot/amd-ucode.img ]] && cp -af /boot/amd-ucode.img "$ESP_DIR/"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment