Package: pybliographer
Version: 1.2.12-1
Severity: wishlist
Tags: patch

Hello,

I'm going to package pybtex[1], which would normally provide /usr/bin/pybtex file. Unfortunately, pybliographer provides such a file too. Therefore, I'd like to propose to start using the alternatives system to handle this issue.

[1] http://bugs.debian.org/535116

--
Jakub Wilk
diff --git a/debian/postinst b/debian/postinst
new file mode 100644
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+    configure)
+        update-alternatives \
+            --install /usr/bin/pybtex pybliographer /usr/bin/bibtex.pybliographer 100
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/prerm b/debian/prerm
new file mode 100644
--- /dev/null
+++ b/debian/prerm
@@ -0,0 +1,27 @@
+#!/bin/sh
+# prerm script for pybliographer
+#
+# see: dh_installdeb(1)
+
+set -e
+
+case "$1" in
+    remove|upgrade|deconfigure)
+        update-alternatives --remove pybliographer /usr/bin/pybtex
+    ;;
+
+    failed-upgrade)
+    ;;
+
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/rules b/debian/rules
--- a/debian/rules
+++ b/debian/rules
@@ -62,6 +62,7 @@
 	dh_prep
 	dh_installdirs
 	$(MAKE) install DESTDIR=`pwd`/$(d)
+	mv $(d)/usr/bin/pybtex $(d)/usr/bin/bibtex.pybliographer
 
 	find $(d) -name '*.py[co]' | xargs rm -f
 	#find $(d) \( -name '*.gif' -o -name '*.css' \) | xargs chmod 644

Reply via email to