Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Commit

Permalink
Vendor enable the gnupg systemd sockets instead of manually symlinkin…
Browse files Browse the repository at this point in the history
…g them to /etc/systemd/system/ in the .install file.

git-svn-id: file:///srv/repos/svn-packages/svn@452400 eb2447ed-0c53-47e4-bac8-5bc4a241df78
  • Loading branch information
dvzrv authored and svntogit committed Aug 7, 2022
1 parent ad8a947 commit e74444a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 deletions.
10 changes: 10 additions & 0 deletions trunk/PKGBUILD
@@ -1,3 +1,4 @@
# Maintainer: David Runge <dvzrv@archlinux.org>
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
Expand Down Expand Up @@ -80,13 +81,22 @@ check() {
}

package() {
local units=({dirmngr,gpg-agent{,-{browser,extra,ssh}}}.socket)
local socket_target_dir="$pkgdir/usr/lib/systemd/user/sockets.target.wants/"
local unit

cd "${srcdir}/${pkgname}-${pkgver}"
make DESTDIR="${pkgdir}" install
ln -s gpg "${pkgdir}"/usr/bin/gpg2
ln -s gpgv "${pkgdir}"/usr/bin/gpgv2

install -Dm 644 doc/examples/systemd-user/*.* -t "${pkgdir}/usr/lib/systemd/user"
install -Dm 644 COPYING.{CC0,other} -t "${pkgdir}/usr/share/licenses/$pkgname/"

install -vdm 755 "$socket_target_dir"
for unit in "${units[@]}"; do
ln -sv "../$unit" "$socket_target_dir$unit"
done
}

# vim: ts=2 sw=2 et:
38 changes: 12 additions & 26 deletions trunk/gnupg.install
@@ -1,31 +1,17 @@
_global_units() {
_units=(dirmngr.socket gpg-agent.socket gpg-agent-{browser,extra,ssh}.socket)
_dir=/etc/systemd/user/sockets.target.wants

case $1 in
enable)
mkdir -p $_dir
for _u in "${_units[@]}"; do
ln -sf /usr/lib/systemd/user/$_u $_dir/$_u
done
;;
disable)
for _u in "${_units[@]}"; do
rm -f $_dir/$_u
done
rmdir -p --ignore-fail-on-non-empty $_dir
;;
esac
}

post_install() {
# See FS#42798 and FS#47371
# run dirmngr once to create /root/.gnupg
# https://bugs.archlinux.org/task/47371
# https://bugs.archlinux.org/task/42798
dirmngr </dev/null &>/dev/null

# Let systemd supervise daemons by default
_global_units enable
}

pre_remove() {
_global_units disable
post_upgrade() {
local unit

if (( $(vercmp "$2" '2.2.36-2') < 0)); then
for unit in {dirmngr,gpg-agent{,-{browser,extra,ssh}}}.socket; do
rm -f "/etc/systemd/user/sockets.target.wants/$unit"
done
printf "NOTE: GnuPG's systemd sockets are now enabled in the vendor location /usr/lib/systemd/user/!\n"
fi
}

0 comments on commit e74444a

Please sign in to comment.