From e0275d109775ead9ac48e3b51f5dc88a29324fdb Mon Sep 17 00:00:00 2001
From: Anton Khirnov <wyskas@gmail.com>
Date: Sat, 8 Aug 2009 09:13:23 +0200
Subject: [PATCH] debian/: delegate handling of mplayer.conf to dpkg.

This change removes also all debconf templates and reduces
package complexity.

Patch by Reinhard Tartler <siretart AT tauware.de>, copied
from the official Debian package.
---
 debian/config    | 52 ------------------------------------------------
 debian/postrm    | 18 -----------------
 debian/rules     |  2 +-
 debian/templates | 26 ------------------------
 4 files changed, 1 insertion(+), 97 deletions(-)
 delete mode 100755 debian/config
 delete mode 100644 debian/postrm
 delete mode 100644 debian/templates

diff --git a/debian/config b/debian/config
deleted file mode 100755
index ab3c8c1b5b..0000000000
--- a/debian/config
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-
-CONFIGFILE=/etc/mplayer/mplayer.conf
-
-set -e
-
-# Source debconf library.
-. /usr/share/debconf/confmodule
-
-if test -r $CONFIGFILE && ! grep -q '### mplayer DEBCONF AREA' $CONFIGFILE
-then
-    db_input medium 'mplayer/replace-existing-files'  || true
-    db_go || true
-    if [ "$RET" != "true" ]; then
-        exit 0
-    fi
-    db_get  'mplayer/replace-existing-files' || true
-fi
-
-########################################## find fonts
-#default font (if available)
-BESTFONT=/usr/share/fonts/truetype/Arial.ttf
-[ -r $BESTFONT ] || BESTFONT=/usr/share/fonts/truetype/freefont/FreeSans.ttf
-
-t=$(tempfile -p fonts )
-find /usr/share/fonts/ /?/?in*/?ont* -type f -iname '*.ttf' -maxdepth 3 2> /dev/null  > $t  || true
-
-if test -s $t
-then
-    fonts=$( awk '{print a $0;a=", "}' $t || true )
-    db_subst "mplayer/ttfont" ttfontchoices $fonts  || true
- ## suppose the question is skipped: give a default
-    a=$BESTFONT
-    [ -r $BESTFONT ] || a=$(head -1 $t)
-    db_subst "mplayer/ttfont" ttfontdefault $a  || true
-
-    db_input medium  mplayer/ttfont  || true
-    if [ "$?" = 30 ] ; then
-        db_set  mplayer/ttfont $a  || true
-    fi
-else
-    db_input medium "mplayer/no-ttfont" || true
-fi
-
-rm $t
-
-db_go || true
-
-############################################################
-
-
-exit 0
diff --git a/debian/postrm b/debian/postrm
deleted file mode 100644
index 5cfa18c857..0000000000
--- a/debian/postrm
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-set -e
-
-if [ "$1" = "purge" ]; then
-	if [ -e /usr/share/debconf/confmodule ]; then
-		# Source debconf library.
-		. /usr/share/debconf/confmodule
-		# Remove my changes to the db.
-		db_purge
-	fi
-
-	if [ -d /etc/mplayer/ ]; then
-		rm -rf /etc/mplayer/
-	fi
-fi
-
-#DEBHELPER#
diff --git a/debian/rules b/debian/rules
index 70474d3e9d..316e6d138d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -61,7 +61,7 @@ binary-arch: build
 	# commands to install the package into debian/<packagename>
 	$(MAKE) prefix=$(prefix)/usr BINDIR=$(prefix)/usr/bin CONFDIR=$(prefix)/etc/mplayer LIBDIR=$(prefix)/usr/lib DATADIR=$(prefix)/usr/share/mplayer  MANDIR=$(prefix)/usr/share/man  install
 
-	dh_installdebconf
+	install -D -m 644 etc/example.conf $(prefix)/etc/mplayer/mplayer.conf
 	dh_installdocs -X.svn -Xmplayer.1 DOCS/*
 	dh_installexamples etc/example.conf etc/dvb-menu.conf etc/input.conf etc/menu.conf
 	dh_installmime
diff --git a/debian/templates b/debian/templates
deleted file mode 100644
index 8fc8ca072b..0000000000
--- a/debian/templates
+++ /dev/null
@@ -1,26 +0,0 @@
-Template: mplayer/replace-existing-files
-Type: boolean
-Default: true
-Description: Upgrade existing system?
- It looks like you've configured MPlayer already. If you'd like to
- configure it with this program, the old configuration
- /etc/mplayer/mplayer.conf will be deleted.  Do you want to continue
- configuration with this program?  If you say "Yes", your old
- configuration will be deleted and you can create it anew with this
- program.  If you say "No" your existing files will be kept.  If you
- change your mind later, you can run 'dpkg-reconfigure mplayer'.
-
-Template: mplayer/ttfont
-Type: select
-Choices: ${ttfontchoices}
-Default: ${ttfontdefault}
-Description: MPlayer fonts
- MPlayer can use TrueType fonts to render the OSD and subtitles.
- Choose your favorite.
-
-Template: mplayer/no-ttfont
-Type: note
-Description: MPlayer cannot find TrueType fonts
- You should install a package providing TrueType fonts (such as
- 'ttf-freefont' or 'ttf-bitstream-vera' or  'msttcorefonts' )
- and reconfigure mplayer.