diff options
author | FirstAirBender | 2020-03-21 03:39:29 -0600 |
---|---|---|
committer | FirstAirBender | 2020-03-21 03:39:29 -0600 |
commit | 70277786e7c0876138dd7d6e64b7ccb7f44cf960 (patch) | |
tree | f9cab736f0f91fc38062922deae9d5232aa45544 /PKGBUILD | |
download | aur-70277786e7c0876138dd7d6e64b7ccb7f44cf960.tar.gz |
Initial commit
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..a5c313540922 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,44 @@ +# Maintainer: FirstAirBender <noblechuk5 [at] web [dot] de> + +pkgname=systemd-removed-services-hook +pkgver=1.0 +pkgrel=1 +pkgdesc='Notifies you of uninstalled your systemd services' +arch=('any') +url='https://gitlab.com/firstairbender/systemd-removed-services-hook' +license=('Unlicense') +depends=('pacutils' 'systemd') +source=() + +build() { + { + cat <<-'EOF' + # https://jlk.fjfi.cvut.cz/arch/manpages/man/alpm-hooks.5 + + [Trigger] + Operation = Remove + Type = Path + EOF + + for p in $(systemd-analyze --global unit-paths; systemd-analyze unit-paths); do + p=${p#"$(pacconf RootDir)"} + echo "Target = $p" + done | sort + + cat <<-'EOF' + + [Action] + Description = List of uninstalled services. Clean up if needed: + When = PostTransaction + Depends = systemd + Depends = pacutils + Exec = /bin/bash -c 'echo; for serv in $(cat); do if systemctl --quiet is-enabled "${serv##*/}" 2> /dev/null || systemctl --quiet --user is-enabled "${serv##*/}" 2> /dev/null; then echo -e "\tâ–º $(pacconf RootDir)$serv"; fi; done' + NeedsTargets + EOF + + } > '20-systemd-removed-services.hook' +} + +package() { + install -Dm 644 ./* --target-directory="$pkgdir/$(pacconf HookDir)" +} |