Bug#389038: openssh-server: Please consider using LSB-enabled init script
Package: openssh-server
Version: N/A
Severity: wishlist
Tags: patch
This bug report is part of the "bubulle mini campaign to help the switch to
LSB-enabled init scripts". Please consider that I am definitely not a wizard
with regard of the LSB init scripts and you might need to get more advice
from the sysvinit package maintainers.
I just went on your package....because it is installed on my system and
using the attached patch makes the init of your package nicer on my
system..:-)
Using LSB-enabled scripts allows for more control of parallel execution of
these scripts and, as a nice side effect, helps improving the visual aspect
of the system boot.
More information is available on http://wiki.debian.org/LSBInitScripts
and http://initscripts-ng.alioth.debian.org/soc2006-bootsystem/. You
can also contact sysvinit wizards on #pkg-sysvinit on irc.debian.org.
The attached patch is an attempt that should help you switching your package
to LSB scripts. Please don't take it as Holy Word.....I bet it can be
enhanced..
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/dash
Kernel: Linux 2.6.17-2-686
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to fr_FR.UTF-8)
--- openssh-server.init.ori 2006-09-23 12:57:07.162333050 +0200
+++ openssh-server.init 2006-09-23 15:46:04.784150229 +0200
@@ -1,4 +1,13 @@
#! /bin/sh
+#
+### BEGIN INIT INFO
+# Provides: sshd
+# Required-Start: $network $local_fs $remote_fs
+# Required-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+### END INIT INFO
+#
set -e
# /etc/init.d/ssh: start and stop the OpenBSD "secure shell(tm)" daemon
@@ -10,10 +19,12 @@
. /etc/default/ssh
fi
+. /lib/lsb/init-functions
+
check_for_no_start() {
# forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
if [ -e /etc/ssh/sshd_not_to_be_run ]; then
- echo "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)"
+ log_warning_msg "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)"
exit 0
fi
}
@@ -38,37 +49,49 @@
start)
check_for_no_start
check_privsep_dir
- echo -n "Starting OpenBSD Secure Shell server: sshd"
- start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS
- echo "."
+ log_begin_msg "Starting OpenBSD Secure Shell server" "sshd"
+ if start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
+ log_end_msg 0
+ else
+ log_end_msg 1
+ fi
;;
stop)
- echo -n "Stopping OpenBSD Secure Shell server: sshd"
- start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid
- echo "."
+ log_begin_msg "Stopping OpenBSD Secure Shell server" "sshd"
+ if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid; then
+ log_end_msg 0
+ else
+ log_end_msg 1
+ fi
;;
reload|force-reload)
check_for_no_start
check_config
- echo -n "Reloading OpenBSD Secure Shell server's configuration"
- start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd
- echo "."
+ log_begin_msg "Reloading OpenBSD Secure Shell server's configuration" "sshd"
+ if start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd; then
+ log_end_msg 0
+ else
+ log_end_msg 1
+ fi
;;
restart)
check_privsep_dir
check_config
- echo -n "Restarting OpenBSD Secure Shell server: sshd"
- start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/sshd.pid
- check_for_no_start
- start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS
- echo "."
+ log_begin_msg "Restarting OpenBSD Secure Shell server" "sshd"
+ if start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/sshd.pid; then
+ check_for_no_start
+ if start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
+ log_end_msg 0
+ else
+ log_end_msg 1
+ fi
+ fi
;;
*)
- echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}"
- exit 1
+ log_failure_msg "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}"
esac
exit 0
--- control.ori 2006-09-23 12:57:11.998367061 +0200
+++ control 2006-09-23 15:47:11.548825611 +0200
@@ -38,7 +38,7 @@
Package: openssh-server
Priority: optional
Architecture: any
-Depends: ${shlibs:Depends}, ${debconf-depends}, ${pam-depends}, libpam-modules (>= 0.72-9), adduser (>= 3.9), dpkg (>= 1.9.0), openssh-client (= ${Source-Version})
+Depends: ${shlibs:Depends}, ${debconf-depends}, ${pam-depends}, libpam-modules (>= 0.72-9), adduser (>= 3.9), dpkg (>= 1.9.0), openssh-client (= ${Source-Version}), lsb-base (>= 3.0-6)
Conflicts: ssh (<< 1:3.8.1p1-9), ssh-nonfree (<<2), ssh-socks, ssh2, sftp, rsh-client (<<0.16.1-1), ssh-krb5
Replaces: ssh (<< 1:3.8.1p1-9), openssh-client (<< 1:3.8.1p1-11), ssh-krb5
Suggests: ssh-askpass, xbase-clients, rssh
Reply to: