Hi again Mohammed,
Sorry for the noise, but my previous patch did _not_ correct the upgrade path
from existing versions of the package.
In addition to the previous patch, I think the only way we can ensure a smooth
upgrade path is to include a custom prerm maintainer script. The script
removes the saved keycodes state file which holds the dumpkeycodes output.
The script will be executed by dpkg when, and only when, the prerm of a
hotkeys-setup version less than this version fails.
A log of the upgrade path follows, the new patch is attached.
$ sudo dpkg -i hotkey-setup_0.1-17.2_i386.deb
(Reading database ... 92393 files and directories currently installed.)
Preparing to replace hotkey-setup 0.1-17.1 (using
hotkey-setup_0.1-17.2_i386.deb) ...
KDSETKEYCODE: Invalid argument
failed to set scancode 1 to keycode 256
invoke-rc.d: initscript hotkey-setup, action "stop" failed.
dpkg: warning - old pre-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
dpkg: ... it looks like that went OK.
Unpacking replacement hotkey-setup ...
Setting up hotkey-setup (0.1-17.2) ...
Installing new version of config file /etc/init.d/hotkey-setup ...
$
Thanks, Kel.
diff -Nrup hotkey-setup-0.1/debian/changelog hotkey-setup-0.1.nmu/debian/changelog
--- hotkey-setup-0.1/debian/changelog 2007-08-05 03:10:57.000000000 +1000
+++ hotkey-setup-0.1.nmu/debian/changelog 2007-10-31 21:01:42.000000000 +1000
@@ -1,3 +1,14 @@
+hotkey-setup (0.1-17.2) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * Don't fail when keystate cannot restored or thinkpad-keys cannot be
+ terminated when stopping initscript.
+ * Add a custom prerm script to remove keycodes state file when prerm of
+ installed package fails. (Closes: #437360)
+ * Urgency medium due to closing of severe policy breakage.
+
+ -- Kel Modderman <[EMAIL PROTECTED]> Wed, 31 Oct 2007 21:00:24 +1000
+
hotkey-setup (0.1-17.1) unstable; urgency=medium
* Non-maintainer upload.
diff -Nrup hotkey-setup-0.1/debian/init.d hotkey-setup-0.1.nmu/debian/init.d
--- hotkey-setup-0.1/debian/init.d 2006-04-30 05:09:27.000000000 +1000
+++ hotkey-setup-0.1.nmu/debian/init.d 2007-10-31 21:00:18.000000000 +1000
@@ -108,10 +108,10 @@ case "$1" in
;;
stop)
if [ -f $THINKPAD_LOCKFILE ]; then
- kill `pidof thinkpad-keys` && rm -f $THINKPAD_LOCKFILE
+ kill `pidof thinkpad-keys` || true ; rm -f $THINKPAD_LOCKFILE
fi
if [ -f $SAVED_STATE ]; then
- setkeycodes $(cat $SAVED_STATE)
+ setkeycodes $(cat $SAVED_STATE) || true
fi
;;
restart|force-reload)
diff -Nrup hotkey-setup-0.1/debian/prerm hotkey-setup-0.1.nmu/debian/prerm
--- hotkey-setup-0.1/debian/prerm 1970-01-01 10:00:00.000000000 +1000
+++ hotkey-setup-0.1.nmu/debian/prerm 2007-10-31 21:13:59.000000000 +1000
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+if dpkg --compare-versions "$2" lt "0.1-17.2"; then
+ # setkeycodes exits with error sometimes (#437360) and has
+ # completely broken the upgrade path for some users.
+ # remove the saved state file if installed package prerm
+ # maintainer script fails.
+ rm -f /var/run/hotkey-setup
+fi
+
+#DEBHELPER#