On Sun, Oct 16, 2005 at 03:48:15PM +0200, I wrote:
>
> Here it is.
But I had forgotten to deal with the configuration file in postrm. Here
is an updated patch.
Cheers,
Nicolas
--- lirc-0.7.1pre2/debian/rules
+++ lirc-0.7.1pre2/debian/rules
@@ -145,7 +145,7 @@
install --mode=644 debian/conf.placeholder \
debian/tmp/etc/lirc/lircmd.conf
install --mode=644 debian/hardware.conf debian/tmp/etc/lirc/
- install --mode=644 debian/lirc-modules-source.conf debian/tmp/etc/lirc/
+ install --mode=644 debian/lirc-modules-source.conf
debian/tmp/usr/share/lirc-modules-source.conf.tpl
#rm debian/lirc/usr/lib/liblirc_client.la
mkdir -p debian/tmp/usr/src/modules/lirc
cp -dpR drivers debian/tmp/usr/src/modules/lirc/
--- lirc-0.7.1pre2/debian/lirc-modules-source.postinst
+++ lirc-0.7.1pre2/debian/lirc-modules-source.postinst
@@ -10,8 +10,8 @@
LIRC_SIR_PORT LIRC_SIR_IRQ LIRC_SIR_CFLAGS \
LIRC_PARALLEL_PORT LIRC_PARALLEL_IRQ LIRC_PARALLEL_TIMER
do
- if ! grep -q "^$VAR\>" /etc/lirc/$package.conf; then
- echo "$VAR=\"UNCONFIGURED\"" >> /etc/lirc/$package.conf
+ if ! grep -q "^$VAR\>" "$1"; then
+ echo "$VAR=\"UNCONFIGURED\"" >> "$1"
fi
done
@@ -35,12 +35,13 @@
db_get $package/serial_port
LIRC_SERIAL_PORT="$RET"
+ tmpfile=`tempfile`
sed \
-e "s/^\(LIRC_SERIAL_IRQ\)=.*/\1=\"$LIRC_SERIAL_IRQ\"/" \
-e "s/^\(LIRC_SERIAL_PORT\)=.*/\1=\"$LIRC_SERIAL_PORT\"/" \
-e "s/^\(LIRC_SERIAL_CFLAGS\)=.*/\1=\"$LIRC_SERIAL_CFLAGS\"/" \
- /etc/lirc/$package.conf > /etc/lirc/$package.conf.tmp
- mv /etc/lirc/$package.conf.tmp /etc/lirc/$package.conf
+ "$1" > "$tmpfile"
+ mv "$tmpfile" "$1"
}
save_sir_conf ()
{
@@ -53,12 +54,13 @@
db_get $package/sir_port
LIRC_SIR_PORT="$RET"
+ tmpfile=`tempfile`
sed \
-e "s/^\(LIRC_SIR_IRQ\)=.*/\1=\"$LIRC_SIR_IRQ\"/" \
-e "s/^\(LIRC_SIR_PORT\)=.*/\1=\"$LIRC_SIR_PORT\"/" \
-e "s/^\(LIRC_SIR_CFLAGS\)=.*/\1=\"$LIRC_SIR_CFLAGS\"/" \
- /etc/lirc/$package.conf > /etc/lirc/$package.conf.tmp
- mv /etc/lirc/$package.conf.tmp /etc/lirc/$package.conf
+ "$1" > "$tmpfile"
+ mv "$tmpfile" "$1"
}
save_parallel_conf ()
{
@@ -69,12 +71,13 @@
db_get $package/parallel_timer
LIRC_PARALLEL_TIMER="$RET"
+ tmpfile=`tempfile`
sed \
-e "s/^\(LIRC_PARALLEL_IRQ\)=.*/\1=\"$LIRC_PARALLEL_IRQ\"/" \
-e "s/^\(LIRC_PARALLEL_PORT\)=.*/\1=\"$LIRC_PARALLEL_PORT\"/" \
-e "s/^\(LIRC_PARALLEL_TIMER\)=.*/\1=\"$LIRC_PARALLEL_TIMER\"/" \
- /etc/lirc/$package.conf > /etc/lirc/$package.conf.tmp
- mv /etc/lirc/$package.conf.tmp /etc/lirc/$package.conf
+ "$1" > "$tmpfile"
+ mv "$tmpfile" "$1"
}
. /usr/share/debconf/confmodule
@@ -84,33 +87,40 @@
if [ "$1" = "configure" ] && [ -f /etc/lirc/$package.conf ]; then
- check_config_file
+ newfile=`tempfile`
+ cat /usr/share/lirc-modules-source.conf.tpl > "$newfile"
+
+ check_config_file "$newfile"
db_get $package/drivers
DRIVERS=$RET
+ tmpfile=`tempfile`
sed \
-e "s/^\(LIRC_MODULES\)=.*/\1=\"$DRIVERS\"/" \
- /etc/lirc/$package.conf > /etc/lirc/$package.conf.tmp
- mv /etc/lirc/$package.conf.tmp /etc/lirc/$package.conf
+ "$newfile" > "$tmpfile"
+ mv "$tmpfile" "$newfile"
#Serial configuration
if expr "$DRIVERS" : '.*\<serial\>' > /dev/null
then
- save_serial_conf
+ save_serial_conf "$newfile"
fi
#SIR configuration
if expr "$DRIVERS" : '.*\<sir\>' > /dev/null
then
- save_sir_conf
+ save_sir_conf "$newfile"
fi
#Parallel configuration
if expr "$DRIVERS" : '.*\<parallel\>' > /dev/null
then
- save_parallel_conf
+ save_parallel_conf "$newfile"
fi
+
+ /usr/bin/ucf --debconf-ok --three-way "$newfile"
/etc/lirc/lirc-modules-source.conf
+ rm "$newfile"
fi
################################
--- lirc-0.7.1pre2/debian/lirc-modules-source.install
+++ lirc-0.7.1pre2/debian/lirc-modules-source.install
@@ -2 +2 @@
-etc/lirc/lirc-modules-source.conf
+usr/share/lirc-modules-source.conf.tpl
--- lirc-0.7.1pre2.orig/debian/lirc-modules-source.postrm
+++ lirc-0.7.1pre2/debian/lirc-modules-source.postrm
@@ -0,0 +1,15 @@
+#!/bin/sh
+set -e
+
+#DEBHELPER#
+
+case "$1" in
+ purge)
+ rm /etc/lirc/lirc-modules-source.conf
+ if [ -x /usr/bin/ucf ]; then
+ /usr/bin/ucf --purge /etc/lirc/lirc-modules-source.conf
+ fi
+ ;;
+esac
+
+exit 0