diff mbox

[netctl] PKGBUILD: add post_upgrade messages

Message ID 20180804162652.GA8222@Mindship-03
State New
Headers show

Commit Message

Emil Velikov via arch-projects Aug. 4, 2018, 4:26 p.m. UTC
---
I am still a little hesitant to carry this in the netctl repository.
Currently, the repository is more or less distribution agnostic.

 Makefile               |  7 +++++--
 contrib/PKGBUILD.in    |  1 +
 contrib/netctl.install | 10 ++++++++++
 3 files changed, 16 insertions(+), 2 deletions(-)
 create mode 100644 contrib/netctl.install
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 7e6a7c9..003abfc 100644
--- a/Makefile
+++ b/Makefile
@@ -49,16 +49,19 @@  netctl-$(VERSION).tar.xz:
 	gpg --detach-sign $@
 
 pkgbuild: PKGBUILD
-PKGBUILD: netctl-$(VERSION).tar.xz contrib/PKGBUILD.in
+PKGBUILD: netctl-$(VERSION).tar.xz contrib/PKGBUILD.in netctl.install
 	sed -e "s|@pkgver@|$(VERSION)|g" \
 	    -e "s|@md5sum@|$(shell md5sum $< | cut -d ' ' -f 1)|" \
 	    -e "s|@md5sum.sig@|$(shell md5sum $<.sig | cut -d ' ' -f 1)|" \
 	    $(lastword $^) > $@
 
+netctl.install: contrib/netctl.install
+	cp $< $@
+
 upload: netctl-$(VERSION).tar.xz
 	scp $< $<.sig sources.archlinux.org:/srv/ftp/other/packages/netctl
 
 clean:
 	$(MAKE) -C docs clean
-	-@rm -vf PKGBUILD *.tar.xz *.tar.xz.sig 2>/dev/null
+	-@rm -vf netctl-*.tar.xz{,.sig} PKGBUILD netctl.install
 
diff --git a/contrib/PKGBUILD.in b/contrib/PKGBUILD.in
index 71b1f5c..b5ce44c 100644
--- a/contrib/PKGBUILD.in
+++ b/contrib/PKGBUILD.in
@@ -19,6 +19,7 @@  optdepends=('dialog: for the menu based wifi assistant'
             'ppp: for PPP connections'
             'openvswitch: for Open vSwitch connections'
            )
+install=netctl.install
 source=(https://sources.archlinux.org/other/packages/netctl/netctl-${pkgver}.tar.xz{,.sig})
 arch=('any')
 md5sums=('@md5sum@'
diff --git a/contrib/netctl.install b/contrib/netctl.install
new file mode 100644
index 0000000..920ce5e
--- /dev/null
+++ b/contrib/netctl.install
@@ -0,0 +1,10 @@ 
+post_upgrade() {
+    if [[ $(vercmp 1.18 "$2") -gt 0 ]]; then
+        grep -ls '^.include ' /etc/systemd/system/netctl@*.service | \
+          while read -r unit; do
+            profile=$(systemd-escape --unescape "${unit:27:-8}")
+            echo ":: The unit for profile '$profile' uses deprecated features."
+            echo "   Consider running: netctl reenable $(printf '%q' "$profile")"
+        done
+    fi
+}