Josip Rodin dixit:

>You can prepare a patch, sure, but while you're at it, do first test the
>situation where 'editorrc' is a slave to 'editor' so that you can be sure

Yup, tested that. Took me quite a few turns, too.
The joe patch is attached, if you want me to upload this,
just tell me so. The jupp cvsweb is here:
https://www.mirbsd.org/cvs.cgi/contrib/hosted/tg/deb/jupp/debian/

In the end, I had to add a preinst for cleaning up before upgrading
(but only then; taking care of the version numbers as well – the
current /bin/sh-in-debian activities prepared me for that), and
manually create the /etc/{joe,jupp}/editorrc symlinks in postinst.
Putting them into the .deb didn’t work for various reasons (since
it used to be managed by update-alternatives before).

The slave stuff works well.

bye,
//mirabilos
-- 
Yay for having to rewrite other people's Bash scripts because bash
suddenly stopped supporting the bash extensions they make use of
        -- Tonnerre Lombard in #nosec
diff -u joe-3.7/debian/control joe-3.7/debian/control
--- joe-3.7/debian/control
+++ joe-3.7/debian/control
@@ -7,6 +7,7 @@
 Homepage: http://joe-editor.sourceforge.net/
 
 Package: joe
+Breaks: jupp (<< 3.1.17-5~~)
 Architecture: any
 Depends: ${shlibs:Depends}
 Description: user friendly full screen text editor
diff -u joe-3.7/debian/postinst joe-3.7/debian/postinst
--- joe-3.7/debian/postinst
+++ joe-3.7/debian/postinst
@@ -3,20 +3,23 @@
 if [ "$1" = "configure" ]; then
 
   update-alternatives --install /usr/bin/editor editor /usr/bin/joe 70 \
+    --slave /var/lib/misc/editorrc editorrc /etc/joe/joerc \
     --slave /usr/share/man/man1/editor.1.gz editor.1.gz 
/usr/share/man/man1/joe.1.gz
-  update-alternatives --install /etc/joe/editorrc editorrc /etc/joe/joerc 70
   update-alternatives --install /usr/bin/editor editor /usr/bin/jmacs 50 \
+    --slave /var/lib/misc/editorrc editorrc /etc/joe/jmacsrc \
     --slave /usr/share/man/man1/editor.1.gz editor.1.gz 
/usr/share/man/man1/jmacs.1.gz
-  update-alternatives --install /etc/joe/editorrc editorrc /etc/joe/jmacsrc 50
   update-alternatives --install /usr/bin/editor editor /usr/bin/jstar 50 \
+    --slave /var/lib/misc/editorrc editorrc /etc/joe/jstarrc \
     --slave /usr/share/man/man1/editor.1.gz editor.1.gz 
/usr/share/man/man1/jstar.1.gz
-  update-alternatives --install /etc/joe/editorrc editorrc /etc/joe/jstarrc 50
   update-alternatives --install /usr/bin/editor editor /usr/bin/jpico 50 \
+    --slave /var/lib/misc/editorrc editorrc /etc/joe/jpicorc \
     --slave /usr/share/man/man1/editor.1.gz editor.1.gz 
/usr/share/man/man1/jpico.1.gz
-  update-alternatives --install /etc/joe/editorrc editorrc /etc/joe/jpicorc 50
   update-alternatives --install /usr/bin/editor editor /usr/bin/rjoe 25 \
+    --slave /var/lib/misc/editorrc editorrc /etc/joe/rjoerc \
     --slave /usr/share/man/man1/editor.1.gz editor.1.gz 
/usr/share/man/man1/rjoe.1.gz
-  update-alternatives --install /etc/joe/editorrc editorrc /etc/joe/rjoerc 25
+
+  rm -f /etc/joe/editorrc
+  ln -sf ../../var/lib/misc/editorrc /etc/joe/editorrc
 
   if [ -x "`which update-menus 2>/dev/null`" ]; then update-menus ; fi
 
diff -u joe-3.7/debian/changelog joe-3.7/debian/changelog
--- joe-3.7/debian/changelog
+++ joe-3.7/debian/changelog
@@ -1,3 +1,12 @@
+joe (3.7-2.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Improve coexistence of joe and jupp: move the editorrc symlink
+    to /var/lib/misc/editorrc and make it an update-alternatives
+    slave to editor (agreed by Raphaël Hertzog, Josip Rodin)
+
+ -- Thorsten Glaser <t...@mirbsd.de>  Wed, 03 Aug 2011 15:52:28 +0000
+
 joe (3.7-2) unstable; urgency=high
 
   * Fix the crash when typing too many dashes on a line, d'oh,
diff -u joe-3.7/debian/prerm joe-3.7/debian/prerm
--- joe-3.7/debian/prerm
+++ joe-3.7/debian/prerm
@@ -4,11 +4,6 @@
   update-alternatives --remove editor /usr/bin/joe
-  update-alternatives --remove editorrc /etc/joe/joerc
   update-alternatives --remove editor /usr/bin/jmacs
-  update-alternatives --remove editorrc /etc/joe/jmacsrc
   update-alternatives --remove editor /usr/bin/jstar
-  update-alternatives --remove editorrc /etc/joe/jstarrc
   update-alternatives --remove editor /usr/bin/jpico
-  update-alternatives --remove editorrc /etc/joe/jpicorc
   update-alternatives --remove editor /usr/bin/rjoe
-  update-alternatives --remove editorrc /etc/joe/rjoerc
 fi
only in patch2:
unchanged:
--- joe-3.7.orig/debian/preinst
+++ joe-3.7/debian/preinst
@@ -0,0 +1,9 @@
+#!/bin/sh -e
+
+# drop old editorrc (master alternative and symlink file both)
+if test x"$1" = x"upgrade" && test -n "$2" && \
+    dpkg --compare-versions "$2" lt '3.7-2.1~~'; then
+       # this will noisily pass if editorrc was already removed,
+       # but not remove a slave alternative
+       (update-alternatives --remove-all editorrc 2>/dev/null || :)
+fi

Reply via email to