Skip to content

Instantly share code, notes, and snippets.

@nickdiego
Created December 17, 2018 06:33
Show Gist options
  • Save nickdiego/6db548d6282123434df95f12aed02c68 to your computer and use it in GitHub Desktop.
Save nickdiego/6db548d6282123434df95f12aed02c68 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