diff options
author | ehsan gn | 2021-06-13 19:10:57 +0430 |
---|---|---|
committer | ehsan gn | 2021-06-13 19:10:57 +0430 |
commit | eca6d328b2db61c19c3c4595e699df8b0ec7e22c (patch) | |
tree | 99aacb34643fae20b0519bbcaff01eefa49dd3ed | |
download | aur-eca6d328b2db61c19c3c4595e699df8b0ec7e22c.tar.gz |
initial commit
-rw-r--r-- | .SRCINFO | 16 | ||||
-rw-r--r-- | PKGBUILD | 23 | ||||
-rw-r--r-- | paclist.conf | 12 | ||||
-rw-r--r-- | paclist.hook | 9 | ||||
-rwxr-xr-x | paclist.sh | 23 |
5 files changed, 83 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..99deb33d683a --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,16 @@ +pkgbase = paclist + pkgdesc = pacman hook to make lists of installed packages. + pkgver = r1 + pkgrel = 1 + arch = any + license = GPL + provides = paclist + conflicts = paclist + source = paclist.sh + source = paclist.conf + source = paclist.hook + sha256sums = 797cf54f8bf1f2bd471b00dcfbe568c60d1c637783655ffc75b93034b64502a9 + sha256sums = 5460135c15426c7845a8cb84a424c1501b12a9f6c4451600d03e1bce266acf45 + sha256sums = 59d60913b1c473eb4b9d13b833e76d8d4867f200c6a5cb42de8721e06aa44cbb + +pkgname = paclist diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..5d0c03e761b6 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,23 @@ +# Maintainer: Ehsan Ghorbannezad <ehsangn@protonmail.ch> +pkgname=paclist +pkgver=r1 +pkgrel=1 +pkgdesc='pacman hook to make lists of installed packages.' +arch=(any) +license=(GPL) +source=($pkgname.sh $pkgname.conf $pkgname.hook) +provides=($pkgname) +conflicts=($pkgname) + +sha256sums=( + 797cf54f8bf1f2bd471b00dcfbe568c60d1c637783655ffc75b93034b64502a9 + 5460135c15426c7845a8cb84a424c1501b12a9f6c4451600d03e1bce266acf45 + 59d60913b1c473eb4b9d13b833e76d8d4867f200c6a5cb42de8721e06aa44cbb +) + +package() { + cd "$srcdir" + install -Dm755 $pkgname.sh "$pkgdir/usr/bin/$pkgname" + install -Dm644 $pkgname.conf -t "$pkgdir/etc/$pkgname/" + install -Dm644 $pkgname.hook -t "$pkgdir/usr/share/libalpm/hooks/" +} diff --git a/paclist.conf b/paclist.conf new file mode 100644 index 000000000000..29fd1f6bd139 --- /dev/null +++ b/paclist.conf @@ -0,0 +1,12 @@ +paclist's config + +# package lists to generate +lists=( +# user group path command + root root /etc/paclist/lists/official 'pacman -Qqne' + root root /etc/paclist/lists/aur 'pacman -Qqme' + root root /etc/paclist/lists/all 'pacman -Qq' +) + +# suffix to add to list names +suffix=-$(cat /etc/hostname) diff --git a/paclist.hook b/paclist.hook new file mode 100644 index 000000000000..f2c7acfb6156 --- /dev/null +++ b/paclist.hook @@ -0,0 +1,9 @@ +[Trigger] +Operation = Install +Operation = Remove +Type = Package +Target = * + +[Action] +When = PostTransaction +Exec = /bin/sh -c 'paclist <&- >&- 2>&- &' diff --git a/paclist.sh b/paclist.sh new file mode 100755 index 000000000000..ef1ba7905185 --- /dev/null +++ b/paclist.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# a script for generating lists of pacman packages. + +# add typical bin dirs to PATH +export PATH="${PATH}:/usr/bin:/usr/local/bin" + +# load and check configuration +. /etc/paclist/paclist.conf || exit 1 +[ ${#lists[@]} -lt 4 ] && exit 1 +[ $(( ${#lists[@]} % 4 )) -ne 0 ] && exit 1 + +for i in $(seq 0 4 $(( ${#lists[@]} - 4 )) ); do + + user="${lists[$i]}" + group="${lists[$i+1]}" + path="${lists[$i+2]}$suffix" + cmd="${lists[$i+3]}" + + runuser -u "$user" -g "$group" -- mkdir -p "$(dirname "$path")" + sh -c -- "$cmd" > "$path" + chown "$user":"$group" -- "$path" + +done |