[arch-commits] Commit in openssh/trunk (install)

Gaëtan Bisson bisson at archlinux.org
Tue Sep 17 23:34:15 UTC 2019


    Date: Tuesday, September 17, 2019 @ 23:34:15
  Author: bisson
Revision: 362994

simpler approach

Modified:
  openssh/trunk/install

---------+
 install |   31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

Modified: install
===================================================================
--- install	2019-09-17 15:56:27 UTC (rev 362993)
+++ install	2019-09-17 23:34:15 UTC (rev 362994)
@@ -1,19 +1,20 @@
-post_upgrade() {
-	# Migrate away from socket activation, Sept 2019.
-	# See: https://bugs.archlinux.org/task/62248
+pre_upgrade() {
+	# Remove socket activation. See: https://bugs.archlinux.org/task/62248
 	if (( $(vercmp $2 8.0p1-3) < 0 )); then
-		if stat -c %N /etc/systemd/system/sockets.target.wants/sshd.socket | grep -q '/usr/lib/systemd/system/sshd.socket'; then
-			if [[ ! -e /etc/systemd/system/sshd\@.service ]]; then
-				echo '==> SSHD: Migrating from socket activation to daemon.'
-				systemctl stop sshd.socket
-				systemctl disable sshd.socket
-				systemctl daemon-reload
-				systemctl start sshd.service
-				systemctl enable sshd.service
-			else
-				echo '==> The files sshd.socket and sshd at .service are no longer provided.'
-				echo '==> Please maintain them yourself or migrate to sshd.service.'
+	if systemctl is-enabled -q sshd.socket; then
+		cat <<EOF
+==> This package no longer provides sshd.socket and sshd at .service;
+==> copies of those files will be placed under /etc/systemd/system
+==> but please migrate to sshd.service whenever possible.
+EOF
+		src=/usr/lib/systemd/system
+		dst=/etc/systemd/system
+		for i in sshd.socket sshd\@.service; do
+			if [[ ! -e "$dst/$i" ]]; then
+				cp -v "$src/$i" "$dst/$i"
 			fi
-		fi
+		done
+		systemctl reenable sshd.socket
 	fi
+	fi
 }


More information about the arch-commits mailing list