summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSkycoder422019-03-23 11:57:06 +0100
committerSkycoder422019-03-23 11:57:06 +0100
commit533f1511d7a28308c36addedeedc557bbbdfb310 (patch)
tree1379c6dacfb8facc4bed1303cf1f37109af36ace
downloadaur-533f1511d7a28308c36addedeedc557bbbdfb310.tar.gz
create package
-rw-r--r--.SRCINFO18
-rw-r--r--PKGBUILD22
-rw-r--r--paccache-hook.conf9
-rw-r--r--paccache-hook.hook11
-rw-r--r--paccache-hook.sh13
5 files changed, 73 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..03050f318b81
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,18 @@
+pkgbase = paccache-hook
+ pkgdesc = A configurable hook to cleanup the pacman package cache using paccache
+ pkgver = 1.0.0
+ pkgrel = 1
+ arch = any
+ license = BSD
+ depends = pacman-contrib
+ conflicts = pacman-cleanup-hook
+ backup = etc/paccache-hook.conf
+ source = paccache-hook.conf
+ source = paccache-hook.sh
+ source = paccache-hook.hook
+ sha256sums = 7697d91b064bdb1c19fb78a2c3ec997e76b53c3b0df2cba219738c36e11266f8
+ sha256sums = 21070f4e2069a5f4535482725b27fef84664610126c04260da255ca5d39f1fd3
+ sha256sums = fdd80cc2ec88445ac9c5fadf2b4053eb0d4864485952a8d9858d6cc3d34c97ce
+
+pkgname = paccache-hook
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..80617583d8dd
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,22 @@
+# Maintainer: Felix Barz <skycoder42.de@gmx.de>
+pkgname=paccache-hook
+pkgver=1.0.0
+pkgrel=1
+pkgdesc="A configurable hook to cleanup the pacman package cache using paccache"
+arch=('any')
+license=('BSD')
+depends=('pacman-contrib')
+conflicts=('pacman-cleanup-hook')
+source=("$pkgname.conf"
+ "$pkgname.sh"
+ "$pkgname.hook")
+sha256sums=('7697d91b064bdb1c19fb78a2c3ec997e76b53c3b0df2cba219738c36e11266f8'
+ '21070f4e2069a5f4535482725b27fef84664610126c04260da255ca5d39f1fd3'
+ 'fdd80cc2ec88445ac9c5fadf2b4053eb0d4864485952a8d9858d6cc3d34c97ce')
+backup=("etc/$pkgname.conf")
+
+package() {
+ install -D -m644 "${srcdir}/$pkgname.hook" "${pkgdir}/usr/share/libalpm/hooks/$pkgname.hook"
+ install -D -m755 "${srcdir}/$pkgname.sh" "${pkgdir}/usr/share/libalpm/scripts/$pkgname.sh"
+ install -D -m644 "${srcdir}/$pkgname.conf" "${pkgdir}/etc/$pkgname.conf"
+}
diff --git a/paccache-hook.conf b/paccache-hook.conf
new file mode 100644
index 000000000000..2ffe12b655ce
--- /dev/null
+++ b/paccache-hook.conf
@@ -0,0 +1,9 @@
+extra_args=
+
+installed=true
+installed_keep=2
+installed_extra_args=
+
+uninstalled=true
+uninstalled_keep=0
+uninstalled_extra_args=
diff --git a/paccache-hook.hook b/paccache-hook.hook
new file mode 100644
index 000000000000..3cf8cfdc2c23
--- /dev/null
+++ b/paccache-hook.hook
@@ -0,0 +1,11 @@
+[Trigger]
+Operation = Remove
+Operation = Install
+Operation = Upgrade
+Type = Package
+Target = *
+
+[Action]
+Description = Removing old packages from pacman cache...
+When = PostTransaction
+Exec = /usr/bin/sh /usr/share/libalpm/scripts/paccache-hook.sh
diff --git a/paccache-hook.sh b/paccache-hook.sh
new file mode 100644
index 000000000000..034f05276c04
--- /dev/null
+++ b/paccache-hook.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+. /etc/paccache-hook.conf
+
+if [ "$installed" = true ]; then
+ echo "Removing old installed packages..."
+ paccache "-rk${installed_keep:-2}" $extra_args $installed_extra_args
+fi
+
+if [ "$uninstalled" = true ]; then
+ echo "Removing old uninstalled packages..."
+ paccache "-ruk${uninstalled_keep:-0}" $extra_args $uninstalled_extra_args
+fi