summaryrefslogtreecommitdiff
path: root/debian/openssh-server.init
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2004-07-31 03:22:20 +0000
committerColin Watson <cjwatson@debian.org>2004-07-31 03:22:20 +0000
commit9749ef7f9b382d743b186bf06c7c2aeb0b9bebee (patch)
treeaadbcc936c4e05d344f3ae856925b62bafc8debb /debian/openssh-server.init
parentc57fe5be57af965042484e8669767f95e558b0ef (diff)
* Split the ssh binary package into openssh-client and openssh-server
(closes: #39741). openssh-server depends on openssh-client for some common functionality; it didn't seem worth creating yet another package for this. * New transitional ssh package, depending on openssh-client and openssh-server. May be removed once nothing depends on it. * When upgrading from ssh to openssh-{client,server}, it's very difficult for the maintainer scripts to find out what version we're upgrading from without dodgy dpkg hackery. I've therefore taken the opportunity to move a couple of debconf notes into NEWS files, namely ssh/ssh2_keys_merged and ssh/user_environment_tell. * In general, upgrading to this version directly from woody without first upgrading to the version in sarge is not currently guaranteed to work very smoothly due to the aforementioned version discovery problems.
Diffstat (limited to 'debian/openssh-server.init')
-rw-r--r--debian/openssh-server.init74
1 files changed, 74 insertions, 0 deletions
diff --git a/debian/openssh-server.init b/debian/openssh-server.init
new file mode 100644
index 000000000..552330422
--- /dev/null
+++ b/debian/openssh-server.init
@@ -0,0 +1,74 @@
1#! /bin/sh
2set -e
3
4# /etc/init.d/ssh: start and stop the OpenBSD "secure shell(tm)" daemon
5
6test -x /usr/sbin/sshd || exit 0
7( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0
8
9if test -f /etc/default/ssh; then
10 . /etc/default/ssh
11fi
12
13check_for_no_start() {
14 # forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
15 if [ -e /etc/ssh/sshd_not_to_be_run ]; then
16 echo "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)"
17 exit 0
18 fi
19}
20
21check_privsep_dir() {
22 # Create the PrivSep empty dir if necessary
23 if [ ! -d /var/run/sshd ]; then
24 mkdir /var/run/sshd
25 chmod 0755 /var/run/sshd
26 fi
27}
28
29check_config() {
30 if [ ! -e /etc/ssh/sshd_not_to_be_run ]; then
31 /usr/sbin/sshd -t || exit 1
32 fi
33}
34
35export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
36
37case "$1" in
38 start)
39 check_for_no_start
40 check_privsep_dir
41 echo -n "Starting OpenBSD Secure Shell server: sshd"
42 start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS
43 echo "."
44 ;;
45 stop)
46 echo -n "Stopping OpenBSD Secure Shell server: sshd"
47 start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid
48 echo "."
49 ;;
50
51 reload|force-reload)
52 check_for_no_start
53 check_config
54 echo -n "Reloading OpenBSD Secure Shell server's configuration"
55 start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd
56 echo "."
57 ;;
58
59 restart)
60 check_config
61 echo -n "Restarting OpenBSD Secure Shell server: sshd"
62 start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/sshd.pid
63 check_for_no_start
64 check_privsep_dir
65 start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS
66 echo "."
67 ;;
68
69 *)
70 echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}"
71 exit 1
72esac
73
74exit 0