Skip to content

Instantly share code, notes, and snippets.

@cirrusUK
Last active April 27, 2024 06:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cirrusUK/aa50bcae03154a246fdc9f108dbc3fc1 to your computer and use it in GitHub Desktop.
Save cirrusUK/aa50bcae03154a246fdc9f108dbc3fc1 to your computer and use it in GitHub Desktop.
/etc/pacman.d/hooks
[Trigger]
Operation = Upgrade
Type = Package
Target = pacman-mirrorlist
[Action]
Description = Updating pacman-mirrorlist with reflector and removing pacnew...
When = PostTransaction
Depends = reflector
Exec = /usr/bin/env sh -c "reflector --protocol https --country 'Ireland' --latest 30 --number 10 --sort rate --save /etc/pacman.d/mirrorlist; if [[ -f /etc/pacman.d/mirrorlist.pacnew ]]; then rm /etc/pacman.d/mirrorlist.pacnew; fi"
[Trigger]
Operation = Remove
Operation = Install
Operation = Upgrade
Type = Package
Target = *
##Since pacman 5.1.0-1 this hook requires pacman-contrib pkg
[Action]
Description = Keep the last cache and the currently installed.
When = PostTransaction
Exec = /usr/bin/paccache -rvk2
[Trigger]
Operation = Install
Operation = Upgrade
Operation = Remove
Type = File
Target = usr/lib/modules/*
[Action]
Description = Check for upgrade of running kernel
When = PostTransaction
Exec = /bin/bash -c "[[ -f \"/proc/modules\" && ! -d \"/usr/lib/modules/$(uname -r)\" ]] && printf '==> WARNING: %s\n -> %s\n' 'Running kernel has been updated or removed.' 'Reboot to the new kernel is required.'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment