[Petter Reinholdtsen]
> Yes, the old script should be removed and update-rc.d should be
> called to drop the init.d scripts from the boot script.  Sorry for
> forgetting this in my initial patch.  Can the package maintainers
> take care of this themselves, or do you need a new patch?

Here is a new patch, with code in the preinst to remove the obsolete
init.d scripts.  I am unable to NMU because I lack a operational arm
machine to build it on.

diff -Nru nslu2-utils-20080403/debian/nslu2-rtc.init 
nslu2-utils-20080403/debian/nslu2-rtc.init
--- nslu2-utils-20080403/debian/nslu2-rtc.init  2008-06-22 12:37:55.000000000 
+0200
+++ nslu2-utils-20080403/debian/nslu2-rtc.init  2009-08-01 00:55:02.000000000 
+0200
@@ -1,2 +1,20 @@
 #!/bin/sh
-modprobe rtc-dev
+### BEGIN INIT INFO
+# Provides:          nslu2-rtc
+# Required-Start:
+# Required-Stop:
+# Should-Start:      udev
+# X-Start-Before:    hwclock
+# Default-Start:     S
+# Default-Stop:
+# Short-Description: Load kernel module for the RTC device interface.
+# Description:       Load kernel module for the RTC device interface.
+### END INIT INFO
+
+case "$1" in
+    start)
+       modprobe rtc-dev
+       ;;
+    stop|restart|force-reload|*)
+       ;;
+esac
diff -Nru nslu2-utils-20080403/debian/preinst 
nslu2-utils-20080403/debian/preinst
--- nslu2-utils-20080403/debian/preinst 1970-01-01 01:00:00.000000000 +0100
+++ nslu2-utils-20080403/debian/preinst 2009-08-01 00:59:45.000000000 +0200
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Remove a no-longer used conffile.  From
+# http://wiki.debian.org/DpkgConffileHandling
+rm_conffile() {
+    local PKGNAME="$1"
+    local CONFFILE="$2"
+
+    [ -e "$CONFFILE" ] || return 0
+
+    local md5sum="$(md5sum $CONFFILE | sed -e 's/ .*//')"
+    local old_md5sum="$(dpkg-query -W -f='${Conffiles}' $PKGNAME | \
+            sed -n -e "\' $CONFFILE ' { s/ obsolete$//; s/.* //; p }")"
+    if [ "$md5sum" != "$old_md5sum" ]; then
+        echo "Obsolete conffile $CONFFILE has been modified by you."
+        echo "Saving as $CONFFILE.dpkg-bak ..."
+        mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
+    else
+        echo "Removing obsolete conffile $CONFFILE ..."
+        rm -f "$CONFFILE"
+    fi
+}
+
+case "$1" in
+install|upgrade)
+    if dpkg --compare-versions "$2" le "20080403-3" ; then
+        rm_conffile nslu2-utils "/etc/init.d/zleds"
+        rm_conffile nslu2-utils "/etc/init.d/leds_startup"
+    fi
+esac
+
+#DEBHELPER#
diff -Nru nslu2-utils-20080403/debian/rules nslu2-utils-20080403/debian/rules
--- nslu2-utils-20080403/debian/rules   2008-06-22 12:37:55.000000000 +0200
+++ nslu2-utils-20080403/debian/rules   2009-08-01 00:55:02.000000000 +0200
@@ -17,16 +17,25 @@
        dh_install initramfs-tools usr/share
        dh_install files/leds usr/bin
        dh_install nslu2-flashkernel usr/sbin
-       dh_install files/initscripts/zleds files/initscripts/rmrecovery \
-               files/initscripts/leds_startup etc/init.d
+       dh_install files/initscripts/rmrecovery etc/init.d
+       set -e ; tmpdir=debian/nslu2-utils; for runlvl in S 1 2 3 4 5 ; do \
+               startscript="etc/init.d/leds-lvl$$runlvl" ; \
+               stopscript="etc/init.d/zleds-stop-lvl$$runlvl" ; \
+               cp files/initscripts/leds $$tmpdir/$$startscript ; \
+               cp files/initscripts/zleds-stop $$tmpdir/$$stopscript ; \
+               for file in $$startscript $$stopscript ; do \
+                       sed s/@LVL@/$$runlvl/ < $$tmpdir/$$file > foo \
+                               && mv foo $$tmpdir/$$file ; \
+               done ; \
+               dh_installinit --no-start --onlyscripts \
+                       --name=leds-lvl$$runlvl -- start 1 $$runlvl . ; \
+               dh_installinit --no-start --onlyscripts \
+                       --name=zleds-stop-lvl$$runlvl -- start 99 $$runlvl . ; \
+       done
        dh_installdirs etc/default
        cp files/initscripts/rmrecovery.default 
debian/nslu2-utils/etc/default/rmrecovery
-       dh_installinit --no-start --onlyscripts --name=zleds \
-               -- start 99 S 1 2 3 4 5 . stop 5 0 1 2 3 4 5 6 .
        dh_installinit --no-start --onlyscripts --name=rmrecovery \
                -- start 99 1 2 3 4 5 .
-       dh_installinit --no-start --onlyscripts --name=leds_startup \
-               -- start 1 1 2 3 4 5 .
        dh_installinit --no-start --name=nslu2-rtc \
                -- start 10 S .
        dh_installudev --name=nslu2-rtc
diff -Nru nslu2-utils-20080403/files/initscripts/leds 
nslu2-utils-20080403/files/initscripts/leds
--- nslu2-utils-20080403/files/initscripts/leds 1970-01-01 01:00:00.000000000 
+0100
+++ nslu2-utils-20080403/files/initscripts/leds 2009-08-01 00:55:02.000000000 
+0200
@@ -0,0 +1,53 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          le...@lvl@
+# Required-Start:    $local_fs
+# Required-Stop:
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:
+# Short-Description: Start led blinking
+# Description:       This script is executed at the start of
+#                    each run-level transition.  It should be
+#                    the first 'start' script.
+### END INIT INFO
+#
+# 'start'  indicates the start of a runlevel change
+# 'stop' at the end of the runlevel change - we are in the new
+#         runlevel.
+#
+# state outputs 'system', 'user' etc according the the nature of
+# the runlevel it is passed (the *new* runlevel is used).
+state(){
+       case "$1" in
+       S|N)     echo system;;
+       0|6)     echo shutdown;;
+       1)       echo singleuser;;
+       2|3|4|5) echo user;;
+       *)       echo "led change: $runlevel: runlevel unknown" >&2
+                echo system;;
+       esac
+}
+
+# trumpet "beeps" an announcement on systems with such support.
+l=120   # Long beep time
+s=40    # Try to keep a 3:1 ratio
+trumpet(){
+       case "$1" in
+       k)    leds beep -l $l; leds beep -l $s; leds beep -l $l;;
+       n)    leds beep -l $l; leds beep -l $s;;
+       *)    leds beep;;
+       esac
+}
+
+case "$1" in
+stop)  leds "$(state "$runlevel")"
+       if [ "$(state "$runlevel")" = "user" ]; then
+               trumpet "k"
+       fi
+       ;;
+start) leds boot "$(state "$runlevel")"
+       ;;
+restart|force-reload|*)
+       echo "led change: $1: command ignored" >&2
+       ;;
+esac
diff -Nru nslu2-utils-20080403/files/initscripts/leds_startup 
nslu2-utils-20080403/files/initscripts/leds_startup
--- nslu2-utils-20080403/files/initscripts/leds_startup 2008-06-22 
12:37:56.000000000 +0200
+++ nslu2-utils-20080403/files/initscripts/leds_startup 1970-01-01 
01:00:00.000000000 +0100
@@ -1,11 +0,0 @@
-#!/bin/sh
-# Bug fix: during the initial boot sysvinit sets PREVLEVEL to
-# nothing in rcS and to 'N' in the transition from rcS to the
-# user state.  This script runs on that transition and, if
-# the PREVLEVEL is 'N', sets 'previous' (as in /etc/init.d/rc)
-# to 'S'
-if test "$PREVLEVEL" = N
-then
-       previous=S exec /etc/init.d/zleds stop
-fi
-exit 0
diff -Nru nslu2-utils-20080403/files/initscripts/rmrecovery 
nslu2-utils-20080403/files/initscripts/rmrecovery
--- nslu2-utils-20080403/files/initscripts/rmrecovery   2008-06-22 
12:37:56.000000000 +0200
+++ nslu2-utils-20080403/files/initscripts/rmrecovery   2009-08-01 
00:55:02.000000000 +0200
@@ -1,7 +1,29 @@
 #!/bin/sh
-# Run to remove /.recovery if the boot seems to have succeeded
-RMRECOVERY=yes
-. /etc/default/rmrecovery || true
-if [ "$RMRECOVERY" != no ]; then
-       rm -f /.recovery
-fi
+### BEGIN INIT INFO
+# Provides:          rmrecovery
+# Required-Start:    $remote_fs $all
+# Required-Stop:
+# Default-Start:     1 2 3 4 5
+# Default-Stop:
+# Short-Description: Remove OpenSlug recovery file on successfull boot
+# Description:       If instead of booting using the Debian initrd, you are
+#                    using the OpenSlug firmware to boot Debian from a
+#                    USB drive on your slug, then it creates a
+#                    /.recovery file during boot, and unless this file
+#                    is removed, the next boot will be back into the
+#                    openslug system. This script removes this file on
+#                    each boot, so that Debian will boot each time.
+### END INIT INFO
+
+case "$1" in
+    start)
+       # Run to remove /.recovery if the boot seems to have succeeded
+       RMRECOVERY=yes
+       . /etc/default/rmrecovery || true
+       if [ "$RMRECOVERY" != no ]; then
+           rm -f /.recovery
+       fi
+       ;;
+    stop|restart|force-reload|*)
+       ;;
+esac
diff -Nru nslu2-utils-20080403/files/initscripts/zleds 
nslu2-utils-20080403/files/initscripts/zleds
--- nslu2-utils-20080403/files/initscripts/zleds        2008-06-22 
12:37:56.000000000 +0200
+++ nslu2-utils-20080403/files/initscripts/zleds        1970-01-01 
01:00:00.000000000 +0100
@@ -1,45 +0,0 @@
-#!/bin/sh
-#
-# This script is executed at the start and end of each run-level
-# transition.  It is the first 'stop' script and the last 'start'
-# script.
-#
-# 'stop'  indicates the start of a runlevel change
-# 'start' at the end of the runlevel change - we are in the new
-#         runlevel.
-#
-# state outputs 'system', 'user' etc according the the nature of
-# the runlevel it is passed (the *new* runlevel is used).
-state(){
-       case "$1" in
-       S|N)     echo system;;
-       0|6)     echo shutdown;;
-       1)       echo singleuser;;
-       2|3|4|5) echo user;;
-       *)       echo "led change: $runlevel: runlevel unknown" >&2
-                echo system;;
-       esac
-}
-
-# trumpet "beeps" an announcement on systems with such support.
-l=120   # Long beep time
-s=40    # Try to keep a 3:1 ratio
-trumpet(){
-       case "$1" in
-       k)    leds beep -l $l; leds beep -l $s; leds beep -l $l;;
-       n)    leds beep -l $l; leds beep -l $s;;
-       *)    leds beep;;
-       esac
-}
-
-case "$1" in
-start) leds "$(state "$runlevel")"
-       if [ "$(state "$runlevel")" = "user" ]; then
-               trumpet "k"
-       fi
-       ;;
-stop)  leds boot "$(state "$runlevel")"
-       ;;
-*)     echo "led change: $1: command ignored" >&2
-       ;;
-esac
diff -Nru nslu2-utils-20080403/files/initscripts/zleds-stop 
nslu2-utils-20080403/files/initscripts/zleds-stop
--- nslu2-utils-20080403/files/initscripts/zleds-stop   1970-01-01 
01:00:00.000000000 +0100
+++ nslu2-utils-20080403/files/initscripts/zleds-stop   2009-08-01 
00:55:02.000000000 +0200
@@ -0,0 +1,20 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          leds-st...@lvl@
+# Required-Start:    $local_fs $all
+# Required-Stop:
+# Default-Start:     S 1 2 3 4 5
+# Default-Stop:
+# Short-Description: Stop led blinking
+# Description:       This script is executed at the end of
+#                    each run-level transition.  It should be
+#                    the last 'start' script.
+### END INIT INFO
+
+case "$1" in
+start) /etc/init.d/leds stop
+       ;;
+restart|force-reload|*)
+       echo "led change: $1: command ignored" >&2
+       ;;
+esac


Happy hacking,
-- 
Petter Reinholdtsen



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to