On 2017-07-24 Doug Torrance <dtorra...@piedmont.edu> wrote:
> On 07/23/2017 08:58 PM, Doug Torrance wrote:
> > I'll work on a draft and push it to git for review.

> Done.

Hello,

Thank you, I have not yet completely tested the menu content, but I have
some thoughts:

#1 Providing a new full menu in /etc/GNUstep/Defaults/WMRootMenu does
not make the new content available to users. Anybody who has started
wmaker before will continue using ~/GNUstep/Defaults/WMRootMenu which
references "menu.hook". So I think we need to provide a file named
menu.hook in wmaker's search path with the new content.

#2 Installing wmaker/sid and menu, followed by upgrade to wmaker/git,
purging wmaker and then purging menu leaves
/etc/GNUstep/Defaults/appearance.menu
/etc/GNUstep/Defaults/menu.hook
behind.

#3 The orphaned conffiles /etc/menu-methods/wmaker
/etc/menu-methods/wmappearance are not removed on upgrades and
menu.hook/appearance.menu will continue to be generated by update-menus.
(this is related to #2)

Find attached a proposed patch for fixing #2 and #3.

Afaict #1 only has an imperfect solution, shipping the menu in
/usr/share/WindowMaker/menu.hook. It is imperfect because I would
definitely categorize this as "configuration file" and should therefore
live in /etc (policy "must"). However we have configured wmaker to not
not look in /etc. Resurrecting 50_def_config_paths.diff would not help
for menu.hook because replacing the autogenerated
/etc/GNUstep/Defaults/menu.hook with a dpkg-conffile and keeping
update-menus from overwriting it could be very tricky.

cu Andreas
-- 
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'
>From 5c84b57382339d10c7b73612f74d32199534aa89 Mon Sep 17 00:00:00 2001
From: Andreas Metzler <ametz...@bebt.de>
Date: Sat, 29 Jul 2017 13:44:18 +0200
Subject: [PATCH] Handle removal of menu-methods and generated menus.

On upgrades remove menu-methods (orphaned conffiles) with
debian/wmaker{,-common}.maintscript. Remove generated menufiles
(etc/GNUstep/Defaults/appearance.menu and /etc/GNUstep/Defaults/menu.hook
on upgrades (only if they are autogenerated) and purge.
---
 debian/changelog                 |  7 +++++++
 debian/wmaker-common.maintscript |  1 +
 debian/wmaker-common.postinst    | 14 ++++++++++++++
 debian/wmaker-common.postrm      |  6 ++++++
 debian/wmaker.maintscript        |  1 +
 debian/wmaker.postinst           | 14 ++++++++++++++
 debian/wmaker.postrm             |  6 ++++++
 7 files changed, 49 insertions(+)
 create mode 100644 debian/wmaker-common.postinst
 create mode 100644 debian/wmaker-common.postrm
 create mode 100644 debian/wmaker.maintscript
 create mode 100644 debian/wmaker.postinst
 create mode 100644 debian/wmaker.postrm

diff --git a/debian/changelog b/debian/changelog
index c85f4689..0df59bef 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
 wmaker (0.95.8-2) UNRELEASED; urgency=medium
 
+  [ Doug Torrance ]
   * Remove and replace the deprecated Debian menu.  The list of
     applications is now generated by the wmmenugen utility (with some
     patches from upstream's development branch) from .desktop files in
@@ -18,6 +19,12 @@ wmaker (0.95.8-2) UNRELEASED; urgency=medium
   * Remove explicit call to dh_autoreconf; enabled by default in
     debhelper 10.
 
+  [ Andreas Metzler ]
+  * Handle removal of menu-methods on upgrades (orphaned conffiles) with
+    debian/wmaker{,-common}.maintscript. Remove generated menufiles
+    (etc/GNUstep/Defaults/appearance.menu and /etc/GNUstep/Defaults/menu.hook
+    on upgrades and purge.
+
  -- Doug Torrance <dtorra...@piedmont.edu>  Mon, 24 Jul 2017 22:34:23 -0400
 
 wmaker (0.95.8-1) unstable; urgency=low
diff --git a/debian/wmaker-common.maintscript b/debian/wmaker-common.maintscript
index 5fece828..0aad6554 100644
--- a/debian/wmaker-common.maintscript
+++ b/debian/wmaker-common.maintscript
@@ -3,3 +3,4 @@ mv_conffile /etc/X11/WindowMaker/wmmacros /usr/share/WindowMaker/wmmacros 0.95.7
 rm_conffile /etc/X11/WindowMaker/appearance.menu 0.95.7-5~
 rm_conffile /etc/X11/WindowMaker/menu.posthook 0.95.7-5~
 rm_conffile /etc/X11/WindowMaker/menu.prehook 0.95.7-5~
+rm_conffile /etc/menu-methods/wmappearance 0.95.8-2~
diff --git a/debian/wmaker-common.postinst b/debian/wmaker-common.postinst
new file mode 100644
index 00000000..b0b22b69
--- /dev/null
+++ b/debian/wmaker-common.postinst
@@ -0,0 +1,14 @@
+#!/bin/sh
+set -e
+#DEBHELPER#
+
+# run after debhelper code, which removes menu-methods.
+if [ "$1" = "configure" ] &&
+	[ x"$2" != "x" ] && 
+	test -e /etc/GNUstep/Defaults/appearance.menu &&
+	dpkg --compare-versions "$2" '<<' '0.95.8-2~' ; then
+	if head -n1 /etc/GNUstep/Defaults/appearance.menu |
+	grep -q 'Automatically generated file. Do not edit.' ; then
+		rm /etc/GNUstep/Defaults/appearance.menu
+	fi
+fi
diff --git a/debian/wmaker-common.postrm b/debian/wmaker-common.postrm
new file mode 100644
index 00000000..49ecaec7
--- /dev/null
+++ b/debian/wmaker-common.postrm
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+if [ "$1" = "purge" ] && test -e /etc/GNUstep/Defaults/appearance.menu ; then
+	rm /etc/GNUstep/Defaults/appearance.menu
+fi
+#DEBHELPER#
diff --git a/debian/wmaker.maintscript b/debian/wmaker.maintscript
new file mode 100644
index 00000000..28ce643d
--- /dev/null
+++ b/debian/wmaker.maintscript
@@ -0,0 +1 @@
+rm_conffile /etc/menu-methods/wmaker 0.95.8-2~
diff --git a/debian/wmaker.postinst b/debian/wmaker.postinst
new file mode 100644
index 00000000..1ef49c20
--- /dev/null
+++ b/debian/wmaker.postinst
@@ -0,0 +1,14 @@
+#!/bin/sh
+set -e
+#DEBHELPER#
+
+# run after debhelper code, which removes menu-methods.
+if [ "$1" = "configure" ] &&
+	[ x"$2" != "x" ] && 
+	test -e /etc/GNUstep/Defaults/menu.hook &&
+	dpkg --compare-versions "$2" '<<' '0.95.8-2~' ; then
+	if head -n1 /etc/GNUstep/Defaults/menu.hook |
+	grep -q 'Automatically generated file. Do not edit' ; then
+		rm /etc/GNUstep/Defaults/menu.hook
+	fi
+fi
diff --git a/debian/wmaker.postrm b/debian/wmaker.postrm
new file mode 100644
index 00000000..2671a526
--- /dev/null
+++ b/debian/wmaker.postrm
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+if [ "$1" = "purge" ] && test -e /etc/GNUstep/Defaults/menu.hook ; then
+	rm /etc/GNUstep/Defaults/menu.hook
+fi
+#DEBHELPER#
-- 
2.13.2

Reply via email to