summaryrefslogtreecommitdiff
path: root/src/librefetch/makepkg-librefetch.conf.in
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-08-26 16:23:41 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-08-26 16:27:43 -0400
commite7edcfde77b0752480db7b4ede5f1a541ee97a88 (patch)
treee8334af8fc5ee4a2c73a792c4311ff05fe2b1374 /src/librefetch/makepkg-librefetch.conf.in
parent3d380700d49dd6faeb793834079724b5c0b93e92 (diff)
librefetch: Drop a file in /etc/makepkg.d/ rather than editing makepkg.conf
The librefetch-install program will stick around for a while (1 year; 2019-08-26) so that it can be used from a post_upgrade hook to remove the old edits, in order to seamlessly migrate people. https://git.parabola.nu/abslibre.git/commit/?id=73982c5ad7057ce2fdec669d962aec6c9caf28c8
Diffstat (limited to 'src/librefetch/makepkg-librefetch.conf.in')
-rw-r--r--src/librefetch/makepkg-librefetch.conf.in16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/librefetch/makepkg-librefetch.conf.in b/src/librefetch/makepkg-librefetch.conf.in
new file mode 100644
index 0000000..723bc15
--- /dev/null
+++ b/src/librefetch/makepkg-librefetch.conf.in
@@ -0,0 +1,16 @@
+#!/hint/bash
+
+# This file should be 'source'd by makepkg.conf to enable librefetch
+edit_dlagents() {
+ local dlagent="@bindir@/librefetch -p $(printf %q "$(realpath -Lm "${BUILDFILE:-${BUILDSCRIPT:-PKGBUILD}}")") -- %u %o"
+
+ local i
+ for i in "${!DLAGENTS[@]}"; do
+ if [[ "${DLAGENTS[$i]}" = https::* ]]; then
+ DLAGENTS[$i]="https::$dlagent"
+ fi
+ done
+ DLAGENTS+=("libre::$dlagent")
+}
+edit_dlagents
+unset -f edit_dlagents