The following commit has been merged in the master branch:
commit 147905e7ad8a041aa81a98000d2c1eaae7fc329d
Author: Gerfried Fuchs <[email protected]>
Date:   Thu Jul 15 17:39:42 2010 +0200

    Use alternative handling and dpkg-divert

diff --git a/debian/changelog b/debian/changelog
index 888525f..3df62c5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ wesnoth-1.8 (1:1.8.3-2) unstable; urgency=low
   * Bump to Standards-Version 3.9.0.
   * Use BRANODOT as placeholder in branchcheck script (for alternative
     priority)
+  * Use alternative handling and dpkg-divert for wesnoth binaries and
+    manpages.
 
  -- 
 
diff --git a/debian/wesnoth-1.8-core.postinst b/debian/wesnoth-1.8-core.postinst
new file mode 100644
index 0000000..d5df760
--- /dev/null
+++ b/debian/wesnoth-1.8-core.postinst
@@ -0,0 +1,32 @@
+#!/bin/sh
+# postinst script for wesnoth-1.8-core
+# Copyright 2010 by Gerfried Fuchs <[email protected]>
+# Licensed under WTFPLv2
+
+set -e
+
+setup_alternatives()
+{
+       # man 6 wesnoth
+       slaves=$(for man in /usr/share/man/*/man6/wesnoth-1.8.6.gz; do \
+               let lang=$(echo $man | sed -e 's#.*/man/##;s#/man6.*##;'); \
+               echo -n " --slave /usr/share/man/$lang/man6/wesnoth.6.gz 
wesnoth.$lang.6.gz $man"; \
+       done)
+       slaves="$slaves --slave /usr/share/man/man6/wesnoth.6.gz wesnoth.6.gz 
/usr/share/man/man6/wesnoth-1.8.6.gz"
+
+       slaves="$slaves --slave /usr/games/wesnoth-nolog wesnoth-nolog 
/usr/games/wesnoth-nolog-1.8"
+
+       update-alternatives --install /usr/games/wesnoth wesnoth \
+               /usr/games/wesnoth-1.8 18 \
+               $slaves
+}
+
+case "$1" in
+       configure|reconfigure)
+               setup_alternatives
+       ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/wesnoth-1.8-core.preinst b/debian/wesnoth-1.8-core.preinst
new file mode 100644
index 0000000..37eb1f4
--- /dev/null
+++ b/debian/wesnoth-1.8-core.preinst
@@ -0,0 +1,25 @@
+#!/bin/sh
+# preinst script for wesnoth-1.8-core
+# Copyright 2010 by Gerfried Fuchs <[email protected]>
+# Licensed under WTFPLv2
+
+set -e
+
+divert_oldfiles()
+{
+       for i in wesnoth wesnoth-nolog wesnoth-smallgui wesnoth-editor; do
+               dpkg-divert --package wesnoth-1.8-core \
+                       --divert /usr/games/$i-old \
+                       --rename /usr/games/$i
+       done
+}
+
+case "$1" in
+       install|upgrade)
+               divert_oldfiles
+       ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/wesnoth-1.8-core.prerm b/debian/wesnoth-1.8-core.prerm
new file mode 100644
index 0000000..d54b0b9
--- /dev/null
+++ b/debian/wesnoth-1.8-core.prerm
@@ -0,0 +1,31 @@
+#!/bin/sh
+# prerm script for wesnoth-1.8-core
+# Copyright 2010 by Gerfried Fuchs <[email protected]>
+# Licensed under WTFPLv2
+
+set -e
+
+divert_oldfiles()
+{
+       for i in wesnoth wesnoth-nolog wesnoth-smallgui wesnoth-editor; do 
+               dpkg-divert --remove --package wesnoth-1.8-core \
+                       --rename /usr/games/$i
+       done
+}
+
+setup_alternatives()
+{
+       update-alternatives --remove wesnoth /usr/games/wesnoth-1.8
+}
+
+
+case "$1" in
+       purge|remove)
+               divert_oldfiles
+               setup_alternatives
+       ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/wesnoth-BRANCH-core.postinst.in 
b/debian/wesnoth-BRANCH-core.postinst.in
new file mode 100644
index 0000000..f09e151
--- /dev/null
+++ b/debian/wesnoth-BRANCH-core.postinst.in
@@ -0,0 +1,32 @@
+#!/bin/sh
+# postinst script for wesnoth-BRANCH-core
+# Copyright 2010 by Gerfried Fuchs <[email protected]>
+# Licensed under WTFPLv2
+
+set -e
+
+setup_alternatives()
+{
+       # man 6 wesnoth
+       slaves=$(for man in /usr/share/man/*/man6/wesnoth-BRANCH.6.gz; do \
+               let lang=$(echo $man | sed -e 's#.*/man/##;s#/man6.*##;'); \
+               echo -n " --slave /usr/share/man/$lang/man6/wesnoth.6.gz 
wesnoth.$lang.6.gz $man"; \
+       done)
+       slaves="$slaves --slave /usr/share/man/man6/wesnoth.6.gz wesnoth.6.gz 
/usr/share/man/man6/wesnoth-BRANCH.6.gz"
+
+       slaves="$slaves --slave /usr/games/wesnoth-nolog wesnoth-nolog 
/usr/games/wesnoth-nolog-BRANCH"
+
+       update-alternatives --install /usr/games/wesnoth wesnoth \
+               /usr/games/wesnoth-BRANCH BRANODOT \
+               $slaves
+}
+
+case "$1" in
+       configure|reconfigure)
+               setup_alternatives
+       ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/wesnoth-BRANCH-core.preinst.in 
b/debian/wesnoth-BRANCH-core.preinst.in
new file mode 100644
index 0000000..32ee0e7
--- /dev/null
+++ b/debian/wesnoth-BRANCH-core.preinst.in
@@ -0,0 +1,25 @@
+#!/bin/sh
+# preinst script for wesnoth-BRANCH-core
+# Copyright 2010 by Gerfried Fuchs <[email protected]>
+# Licensed under WTFPLv2
+
+set -e
+
+divert_oldfiles()
+{
+       for i in wesnoth wesnoth-nolog wesnoth-smallgui wesnoth-editor; do
+               dpkg-divert --package wesnoth-BRANCH-core \
+                       --divert /usr/games/$i-old \
+                       --rename /usr/games/$i
+       done
+}
+
+case "$1" in
+       install|upgrade)
+               divert_oldfiles
+       ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/wesnoth-BRANCH-core.prerm.in 
b/debian/wesnoth-BRANCH-core.prerm.in
new file mode 100644
index 0000000..6f75472
--- /dev/null
+++ b/debian/wesnoth-BRANCH-core.prerm.in
@@ -0,0 +1,31 @@
+#!/bin/sh
+# prerm script for wesnoth-BRANCH-core
+# Copyright 2010 by Gerfried Fuchs <[email protected]>
+# Licensed under WTFPLv2
+
+set -e
+
+divert_oldfiles()
+{
+       for i in wesnoth wesnoth-nolog wesnoth-smallgui wesnoth-editor; do 
+               dpkg-divert --remove --package wesnoth-BRANCH-core \
+                       --rename /usr/games/$i
+       done
+}
+
+setup_alternatives()
+{
+       update-alternatives --remove wesnoth /usr/games/wesnoth-BRANCH
+}
+
+
+case "$1" in
+       purge|remove)
+               divert_oldfiles
+               setup_alternatives
+       ;;
+esac
+
+#DEBHELPER#
+
+exit 0

-- 
Debian packaging of wesnoth

_______________________________________________
Pkg-games-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-games-commits

Reply via email to