commit 3a34be9ec8840656749efad2a321054d52b72ab7 Author: David Thurstenson Date: Sat Nov 14 14:06:21 2020 -0600 Initial commit diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..0f633b8 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,27 @@ +# Maintainer: David Thurstenson +pkgname=tl-reflector-hook +pkgver=0.1 +pkgrel=1 +pkgdesc="A hook to run reflector after an upgrade to pacman-mirrorlist, plus reflector config" +arch=('any') +url="https://git.thurstylark.com/tl-reflector-hook.git/" +license=('GPL') +groups=('tlconfig') +depends=('reflector') +source=("tl-reflector.hook" + "reflector.service.override.conf" + "tl-reflector.conf") +md5sums=('83a559890411b435fe6c510a580a830d' + '224f2e18880355adb313bd958189230f' + '451edc9a736b23e09a3bc62ac42ec2d9') + +package() { + install -Dm644 tl-reflector.hook \ + ${pkgdir}/usr/share/libalpm/hooks/tl-reflector.hook + + install -Dm644 reflector.service.override.conf \ + ${pkgdir}/etc/systemd/system/reflector.service.d/override.conf + + install -Dm644 tl-reflector.conf \ + ${pkgdir}/etc/xdg/reflector/tl-reflector.conf +} diff --git a/reflector.service.override.conf b/reflector.service.override.conf new file mode 100644 index 0000000..fb1d27d --- /dev/null +++ b/reflector.service.override.conf @@ -0,0 +1,3 @@ +[Service] +ExecStart= +ExecStart=/usr/bin/reflector @/etc/xdg/reflector/tl-reflector.conf diff --git a/tl-reflector.conf b/tl-reflector.conf new file mode 100644 index 0000000..a88a0ff --- /dev/null +++ b/tl-reflector.conf @@ -0,0 +1,16 @@ +# Thurstylark's reflector config + +# Set the output path where the mirrorlist will be saved (--save). +--save /etc/pacman.d/mirrorlist + +# Select the transfer protocol (--protocol). +--protocol https + +# Select the country (--country). +--country "United States" + +# Use only the most recently synchronized mirrors (--latest). +--latest 5 + +# Sort the mirrors by synchronization time (--sort). +--sort age diff --git a/tl-reflector.hook b/tl-reflector.hook new file mode 100644 index 0000000..a349e15 --- /dev/null +++ b/tl-reflector.hook @@ -0,0 +1,11 @@ +# Shamelessly copied from https://wiki.archlinux.org/index.php/Reflector#pacman_hook +[Trigger] +Operation = Upgrade +Type = Package +Target = pacman-mirrorlist + +[Action] +Description = Updating pacman-mirrorlist with reflector and removing pacnew... +When = PostTransaction +Depends = reflector +Exec = /bin/sh -c 'systemctl start reflector.service; if [ -f /etc/pacman.d/mirrorlist.pacnew ]; then rm /etc/pacman.d/mirrorlist.pacnew; fi'