Skip to content

Commit

Permalink
Add some useful pacman hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
arenekosreal committed Feb 19, 2024
1 parent 75f6b30 commit 2a48c46
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pacman-hooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Some useful pacman hooks not included in package

See `README.md` in each directory for more info.
24 changes: 24 additions & 0 deletions pacman-hooks/sync-boot-to-efi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Sync required contents from /boot to /efi

Sync required contents to boot RaspberryPi 4B in UEFI mode from `/boot` to `/efi`

This should help people who mount ESP on `/efi`, but you can always adjust them to meet your needs.

## Usage

1. Disable hooks provided by `uefi-raspberrypi4` package

You can run those commands to achive that:
```bash
ln -s /dev/null /etc/pacman.d/hooks/70-post-install-uefi.hook
ln -s /dev/null /etc/pacman.d/hooks/80-pre-remove-uefi.hook
```

2. Put [hooks](./hooks) and [scripts](./scripts) into `/etc/pacman.d`.

## FAQ

- Why not ship those in `uefi-raspberrypi4` package?

Most people mount ESP on `/boot`, thus files required during boot have already been taken well care of.

18 changes: 18 additions & 0 deletions pacman-hooks/sync-boot-to-efi/hooks/74-sync-boot-to-efi.hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Trigger]
Operation = Install
Operation = Upgrade
Type = Path
Target = boot/overlays/
Target = boot/*.elf
Target = boot/bootcode.bin
Target = boot/config.txt
Target = boot/*.dat
Target = boot/dtbs/broadcom/bcm2711-rpi-4-b.dtb
Target = boot/RPI_EFI.fd

[Action]
Description = Syncing required files in /boot to /efi...
Depends = coreutils
When = PostTransaction
Exec = /etc/pacman.d/scripts/sync-boot-to-efi
NeedsTargets
20 changes: 20 additions & 0 deletions pacman-hooks/sync-boot-to-efi/scripts/sync-boot-to-efi
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

declare -r target=efi
while read -r path
do
if [ -n "$path" ]
then
target_path=$target/$(basename "$path")
echo "Syncing $path to $target_path..."
case "$path" in
*config.txt|*RPI_EFI.fd)
echo "We are syncing $path to $target_path.pacnew to prevent conflicts, you need to merge them manually."
cp "$path" "$target_path.pacnew"
;;
*)
cp "$path" "$target_path"
;;
esac
fi
done

0 comments on commit 2a48c46

Please sign in to comment.