[arch-commits] Commit in gnupg/trunk (PKGBUILD gnupg.install)

David Runge dvzrv at gemini.archlinux.org
Sun Aug 7 21:34:25 UTC 2022


    Date: Sunday, August 7, 2022 @ 21:34:25
  Author: dvzrv
Revision: 452400

Vendor enable the gnupg systemd sockets instead of manually symlinking them to /etc/systemd/system/ in the .install file.

Modified:
  gnupg/trunk/PKGBUILD
  gnupg/trunk/gnupg.install

---------------+
 PKGBUILD      |   10 ++++++++++
 gnupg.install |   38 ++++++++++++--------------------------
 2 files changed, 22 insertions(+), 26 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-08-07 21:30:10 UTC (rev 452399)
+++ PKGBUILD	2022-08-07 21:34:25 UTC (rev 452400)
@@ -1,3 +1,4 @@
+# Maintainer: David Runge <dvzrv at archlinux.org>
 # Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
 # Maintainer: Lukas Fleischer <lfleischer at archlinux.org>
 # Contributor: Gaetan Bisson <bisson at archlinux.org>
@@ -80,6 +81,10 @@
 }
 
 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
@@ -87,6 +92,11 @@
 
   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:

Modified: gnupg.install
===================================================================
--- gnupg.install	2022-08-07 21:30:10 UTC (rev 452399)
+++ gnupg.install	2022-08-07 21:34:25 UTC (rev 452400)
@@ -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
 }



More information about the arch-commits mailing list