summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2013-05-22 01:45:40 +0100
committerColin Watson <cjwatson@debian.org>2013-05-22 01:45:40 +0100
commit6e950945da7a2acbb48fa4138208018f09d66991 (patch)
tree1e99c1fb54755277a8c441cf503b71bb2c5be748 /debian
parentafd3292952a9f0bb107046785ddcfad446d69b89 (diff)
Switch to new unified layout for Upstart jobs as documented in
https://wiki.ubuntu.com/UpstartCompatibleInitScripts: the init script checks for a running Upstart, and we now let dh_installinit handle most of the heavy lifting in maintainer scripts. Ubuntu users should be essentially unaffected except that sshd may no longer start automatically in chroots if the running Upstart predates 0.9.0; but the main goal is simply not to break when openssh-server is installed in a chroot.
Diffstat (limited to 'debian')
-rw-r--r--debian/changelog8
-rw-r--r--debian/control2
-rw-r--r--debian/openssh-server.if-up (renamed from debian/openssh-server.if-up.in)20
-rw-r--r--debian/openssh-server.postinst (renamed from debian/openssh-server.postinst.in)25
-rw-r--r--debian/openssh-server.postrm2
-rw-r--r--debian/openssh-server.prerm.in52
-rw-r--r--debian/openssh-server.ssh.init (renamed from debian/openssh-server.ssh.init.in)21
-rwxr-xr-xdebian/rules27
-rw-r--r--debian/ssh-krb5.postinst (renamed from debian/ssh-krb5.postinst.in)22
9 files changed, 29 insertions, 150 deletions
diff --git a/debian/changelog b/debian/changelog
index 9db3f5648..f56fc00ea 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,14 @@ openssh (1:6.2p2-2) UNRELEASED; urgency=low
21 openssh-server.postinst. 21 openssh-server.postinst.
22 * Replace old manual conffile handling code with dpkg-maintscript-helper, 22 * Replace old manual conffile handling code with dpkg-maintscript-helper,
23 via dh_installdeb. 23 via dh_installdeb.
24 * Switch to new unified layout for Upstart jobs as documented in
25 https://wiki.ubuntu.com/UpstartCompatibleInitScripts: the init script
26 checks for a running Upstart, and we now let dh_installinit handle most
27 of the heavy lifting in maintainer scripts. Ubuntu users should be
28 essentially unaffected except that sshd may no longer start
29 automatically in chroots if the running Upstart predates 0.9.0; but the
30 main goal is simply not to break when openssh-server is installed in a
31 chroot.
24 32
25 -- Colin Watson <cjwatson@debian.org> Tue, 21 May 2013 17:49:35 +0100 33 -- Colin Watson <cjwatson@debian.org> Tue, 21 May 2013 17:49:35 +0100
26 34
diff --git a/debian/control b/debian/control
index a9ef496f6..7c91f74e4 100644
--- a/debian/control
+++ b/debian/control
@@ -45,7 +45,7 @@ Package: openssh-server
45Priority: optional 45Priority: optional
46Architecture: any 46Architecture: any
47Pre-Depends: ${misc:Pre-Depends} 47Pre-Depends: ${misc:Pre-Depends}
48Depends: ${shlibs:Depends}, ${misc:Depends}, debconf (>= 1.2.0) | debconf-2.0, libpam-runtime (>= 0.76-14), libpam-modules (>= 0.72-9), adduser (>= 3.9), dpkg (>= 1.9.0), openssh-client (= ${binary:Version}), lsb-base (>= 3.2-13), procps, debianutils (>= 4) 48Depends: ${shlibs:Depends}, ${misc:Depends}, debconf (>= 1.2.0) | debconf-2.0, libpam-runtime (>= 0.76-14), libpam-modules (>= 0.72-9), adduser (>= 3.9), dpkg (>= 1.9.0), openssh-client (= ${binary:Version}), lsb-base (>= 4.1+Debian3), procps
49Recommends: xauth, ncurses-term, ${openssh-server:Recommends} 49Recommends: xauth, ncurses-term, ${openssh-server:Recommends}
50Conflicts: ssh (<< 1:3.8.1p1-9), ssh-nonfree (<<2), ssh-socks, ssh2, sftp, rsh-client (<<0.16.1-1), ssh-krb5 (<< 1:4.3p2-7) 50Conflicts: ssh (<< 1:3.8.1p1-9), ssh-nonfree (<<2), ssh-socks, ssh2, sftp, rsh-client (<<0.16.1-1), ssh-krb5 (<< 1:4.3p2-7)
51Replaces: ssh, openssh-client (<< 1:3.8.1p1-11), ssh-krb5 51Replaces: ssh, openssh-client (<< 1:3.8.1p1-11), ssh-krb5
diff --git a/debian/openssh-server.if-up.in b/debian/openssh-server.if-up
index 871493068..de92866e6 100644
--- a/debian/openssh-server.if-up.in
+++ b/debian/openssh-server.if-up
@@ -30,22 +30,8 @@ if [ ! -f /var/run/sshd.pid ] || \
30 exit 0 30 exit 0
31fi 31fi
32 32
33case '@DISTRIBUTOR@' in 33# We'd like to use 'reload' here, but it has some problems; see
34 Ubuntu) 34# #502444.
35 # Both init script and Upstart job are present; we want to operate 35invoke-rc.d ssh restart >/dev/null 2>&1 || true
36 # on the Upstart job.
37 stop ssh || true
38 start ssh || true
39 ;;
40 *)
41 # We'd like to use 'reload' here, but it has some problems; see
42 # #502444.
43 if [ -x /usr/sbin/invoke-rc.d ]; then
44 invoke-rc.d ssh restart >/dev/null 2>&1 || true
45 else
46 /etc/init.d/ssh restart >/dev/null 2>&1 || true
47 fi
48 ;;
49esac
50 36
51exit 0 37exit 0
diff --git a/debian/openssh-server.postinst.in b/debian/openssh-server.postinst
index ce1165ac9..94461083e 100644
--- a/debian/openssh-server.postinst.in
+++ b/debian/openssh-server.postinst
@@ -296,30 +296,6 @@ remove_old_init_links() {
296 rm -f /etc/rc0.d/K??ssh /etc/rc1.d/K??ssh /etc/rc6.d/K??ssh 296 rm -f /etc/rc0.d/K??ssh /etc/rc1.d/K??ssh /etc/rc6.d/K??ssh
297} 297}
298 298
299setup_init() {
300 case '@DISTRIBUTOR@' in
301 Ubuntu)
302 # Both init script and Upstart job are present; we want to
303 # operate on the Upstart job.
304 if [ -e /etc/init/ssh.conf ]; then
305 stop ssh 2>/dev/null || true
306 start ssh || true
307 fi
308 update-rc.d -f ssh remove >/dev/null || true
309 ;;
310 *)
311 if [ -x /etc/init.d/ssh ]; then
312 update-rc.d ssh start 16 2 3 4 5 . >/dev/null
313 if [ -x /usr/sbin/invoke-rc.d ]; then
314 invoke-rc.d ssh restart
315 else
316 /etc/init.d/ssh restart
317 fi
318 fi
319 ;;
320 esac
321}
322
323if [ "$action" = configure ]; then 299if [ "$action" = configure ]; then
324 create_sshdconfig 300 create_sshdconfig
325 create_keys 301 create_keys
@@ -329,7 +305,6 @@ if [ "$action" = configure ]; then
329 if dpkg --compare-versions "$2" lt 1:5.2p1-1; then 305 if dpkg --compare-versions "$2" lt 1:5.2p1-1; then
330 remove_old_init_links 306 remove_old_init_links
331 fi 307 fi
332 setup_init
333 # Renamed to /etc/ssh/moduli in 2.9.9 (!) 308 # Renamed to /etc/ssh/moduli in 2.9.9 (!)
334 if dpkg --compare-versions "$2" lt 1:4.7p1-1; then 309 if dpkg --compare-versions "$2" lt 1:4.7p1-1; then
335 rm -f /etc/ssh/primes 310 rm -f /etc/ssh/primes
diff --git a/debian/openssh-server.postrm b/debian/openssh-server.postrm
index 9bb9f1839..fdf0802c9 100644
--- a/debian/openssh-server.postrm
+++ b/debian/openssh-server.postrm
@@ -16,8 +16,6 @@ case $1 in
16 rm -f /etc/ssh/sshd_not_to_be_run 16 rm -f /etc/ssh/sshd_not_to_be_run
17 rmdir --ignore-fail-on-non-empty /etc/ssh 17 rmdir --ignore-fail-on-non-empty /etc/ssh
18 18
19 update-rc.d ssh remove >/dev/null
20
21 if which deluser >/dev/null 2>&1; then 19 if which deluser >/dev/null 2>&1; then
22 deluser --quiet sshd > /dev/null || true 20 deluser --quiet sshd > /dev/null || true
23 fi 21 fi
diff --git a/debian/openssh-server.prerm.in b/debian/openssh-server.prerm.in
deleted file mode 100644
index a20e67614..000000000
--- a/debian/openssh-server.prerm.in
+++ /dev/null
@@ -1,52 +0,0 @@
1#! /bin/sh
2# prerm script for ssh
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9# * <prerm> `remove'
10# * <old-prerm> `upgrade' <new-version>
11# * <new-prerm> `failed-upgrade' <old-version>
12# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
13# * <deconfigured's-prerm> `deconfigure' `in-favour'
14# <package-being-installed> <version> `removing'
15# <conflicting-package> <version>
16# for details, see /usr/share/doc/packaging-manual/
17
18case "$1" in
19 remove|deconfigure)
20 case '@DISTRIBUTOR@' in
21 Ubuntu)
22 # Both init script and Upstart job are present; we want to
23 # operate on the Upstart job.
24 if [ -e /etc/init/ssh.conf ]; then
25 stop ssh || true
26 fi
27 ;;
28 *)
29 if [ -x /etc/init.d/ssh ]; then
30 if [ -x /usr/sbin/invoke-rc.d ]; then
31 invoke-rc.d ssh stop
32 else
33 /etc/init.d/ssh stop
34 fi
35 fi
36 ;;
37 esac
38 ;;
39 upgrade|failed-upgrade)
40 ;;
41 *)
42 echo "prerm called with unknown argument \`$1'" >&2
43 exit 0
44 ;;
45esac
46
47# dh_installdeb will replace this with shell code automatically
48# generated by other debhelper scripts.
49
50#DEBHELPER#
51
52exit 0
diff --git a/debian/openssh-server.ssh.init.in b/debian/openssh-server.ssh.init
index e24cb1bed..bda7a92b8 100644
--- a/debian/openssh-server.ssh.init.in
+++ b/debian/openssh-server.ssh.init
@@ -16,15 +16,6 @@ set -e
16test -x /usr/sbin/sshd || exit 0 16test -x /usr/sbin/sshd || exit 0
17( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0 17( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0
18 18
19case '@DISTRIBUTOR@' in
20 Ubuntu)
21 # The init.d script is only for chroots.
22 if [ -e /etc/init/ssh.conf ] && ! ischroot; then
23 exec /lib/init/upstart-job ssh "$@"
24 fi
25 ;;
26esac
27
28umask 022 19umask 022
29 20
30if test -f /etc/default/ssh; then 21if test -f /etc/default/ssh; then
@@ -42,6 +33,12 @@ run_by_init() {
42 ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ] 33 ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
43} 34}
44 35
36check_for_upstart() {
37 if init_is_upstart; then
38 exit $1
39 fi
40}
41
45check_for_no_start() { 42check_for_no_start() {
46 # forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists 43 # forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
47 if [ -e /etc/ssh/sshd_not_to_be_run ]; then 44 if [ -e /etc/ssh/sshd_not_to_be_run ]; then
@@ -85,6 +82,7 @@ export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
85 82
86case "$1" in 83case "$1" in
87 start) 84 start)
85 check_for_upstart 1
88 check_privsep_dir 86 check_privsep_dir
89 check_for_no_start 87 check_for_no_start
90 check_dev_null 88 check_dev_null
@@ -96,6 +94,7 @@ case "$1" in
96 fi 94 fi
97 ;; 95 ;;
98 stop) 96 stop)
97 check_for_upstart 0
99 log_daemon_msg "Stopping OpenBSD Secure Shell server" "sshd" || true 98 log_daemon_msg "Stopping OpenBSD Secure Shell server" "sshd" || true
100 if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid; then 99 if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid; then
101 log_end_msg 0 || true 100 log_end_msg 0 || true
@@ -105,6 +104,7 @@ case "$1" in
105 ;; 104 ;;
106 105
107 reload|force-reload) 106 reload|force-reload)
107 check_for_upstart 1
108 check_for_no_start 108 check_for_no_start
109 check_config 109 check_config
110 log_daemon_msg "Reloading OpenBSD Secure Shell server's configuration" "sshd" || true 110 log_daemon_msg "Reloading OpenBSD Secure Shell server's configuration" "sshd" || true
@@ -116,6 +116,7 @@ case "$1" in
116 ;; 116 ;;
117 117
118 restart) 118 restart)
119 check_for_upstart 1
119 check_privsep_dir 120 check_privsep_dir
120 check_config 121 check_config
121 log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" || true 122 log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" || true
@@ -130,6 +131,7 @@ case "$1" in
130 ;; 131 ;;
131 132
132 try-restart) 133 try-restart)
134 check_for_upstart 1
133 check_privsep_dir 135 check_privsep_dir
134 check_config 136 check_config
135 log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" || true 137 log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" || true
@@ -160,6 +162,7 @@ case "$1" in
160 ;; 162 ;;
161 163
162 status) 164 status)
165 check_for_upstart 1
163 status_of_proc -p /var/run/sshd.pid /usr/sbin/sshd sshd && exit 0 || exit $? 166 status_of_proc -p /var/run/sshd.pid /usr/sbin/sshd sshd && exit 0 || exit $?
164 ;; 167 ;;
165 168
diff --git a/debian/rules b/debian/rules
index c78653be0..32cda5bc3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -115,16 +115,6 @@ confflags_udeb += --with-ldflags='-Wl,--as-needed'
115%: 115%:
116 dh $@ --with=autoreconf 116 dh $@ --with=autoreconf
117 117
118DISTRIBUTOR_REPLACE := \
119 debian/openssh-server.if-up \
120 debian/openssh-server.ssh.init \
121 debian/openssh-server.postinst \
122 debian/openssh-server.prerm \
123 debian/ssh-krb5.postinst
124
125debian/%: debian/%.in
126 sed 's/@DISTRIBUTOR@/$(DISTRIBUTOR)/g' $< >$@
127
128override_dh_auto_configure: 118override_dh_auto_configure:
129 dh_auto_configure -Bbuild-deb -- $(confflags) 119 dh_auto_configure -Bbuild-deb -- $(confflags)
130 dh_auto_configure -Bbuild-udeb -- $(confflags_udeb) 120 dh_auto_configure -Bbuild-udeb -- $(confflags_udeb)
@@ -157,14 +147,10 @@ endif
157 (cat debian/copyright.head; iconv -f ISO-8859-1 -t UTF-8 LICENCE) \ 147 (cat debian/copyright.head; iconv -f ISO-8859-1 -t UTF-8 LICENCE) \
158 > debian/copyright 148 > debian/copyright
159 149
160override_dh_clean:
161 dh_clean
162 rm -f $(DISTRIBUTOR_REPLACE)
163
164override_dh_auto_install: 150override_dh_auto_install:
165 $(MAKE) -C build-deb DESTDIR=`pwd`/debian/tmp install-nokeys 151 $(MAKE) -C build-deb DESTDIR=`pwd`/debian/tmp install-nokeys
166 152
167override_dh_install: $(DISTRIBUTOR_REPLACE) 153override_dh_install:
168 rm -f debian/tmp/etc/ssh/sshd_config 154 rm -f debian/tmp/etc/ssh/sshd_config
169 155
170 dh_install -Nopenssh-client-udeb -Nopenssh-server-udeb --fail-missing 156 dh_install -Nopenssh-client-udeb -Nopenssh-server-udeb --fail-missing
@@ -197,13 +183,7 @@ override_dh_installdocs:
197 mkdir -p debian/openssh-server/usr/share/doc/openssh-client 183 mkdir -p debian/openssh-server/usr/share/doc/openssh-client
198 184
199override_dh_installinit: 185override_dh_installinit:
200 dh_installinit -n --name ssh 186 dh_installinit -R --name ssh -- start 16 2 3 4 5 .
201ifeq ($(DISTRIBUTOR),Ubuntu)
202 # We need to keep the init script as well as the Upstart job for
203 # now, for the benefit of people running sshd in chroots.
204 install -D -o root -g root debian/openssh-server.ssh.init debian/openssh-server/etc/init.d/ssh
205 install -D -o root -g root -m 644 debian/openssh-server.ssh.default debian/openssh-server/etc/default/ssh
206endif
207 187
208override_dh_installpam: 188override_dh_installpam:
209 dh_installpam --name sshd 189 dh_installpam --name sshd
@@ -217,9 +197,6 @@ override_dh_shlibdeps:
217 dh_shlibdeps 197 dh_shlibdeps
218 debian/adjust-openssl-dependencies 198 debian/adjust-openssl-dependencies
219 199
220override_dh_installdeb: $(DISTRIBUTOR_REPLACE)
221 dh_installdeb
222
223override_dh_gencontrol: 200override_dh_gencontrol:
224 dh_gencontrol -- -V'openssh-server:Recommends=$(server_recommends)' 201 dh_gencontrol -- -V'openssh-server:Recommends=$(server_recommends)'
225 202
diff --git a/debian/ssh-krb5.postinst.in b/debian/ssh-krb5.postinst
index 9ed03f343..f799accfe 100644
--- a/debian/ssh-krb5.postinst.in
+++ b/debian/ssh-krb5.postinst
@@ -50,25 +50,9 @@ GSSAPIKeyExchange yes
50EOF 50EOF
51 fi 51 fi
52 fi 52 fi
53 case '@DISTRIBUTOR@' in 53 if [ -n "$changed" ]; then
54 Ubuntu) 54 invoke-rc.d ssh restart
55 # Both init script and Upstart job are present; we want to 55 fi
56 # operate on the Upstart job.
57 if [ -n "$changed" ] && [ -e /etc/init/ssh.conf ] ; then
58 stop ssh || true
59 start ssh || true
60 fi
61 ;;
62 *)
63 if [ -n "$changed" ] && [ -x /etc/init.d/ssh ] ; then
64 if [ -x /usr/sbin/invoke-rc.d ] ; then
65 invoke-rc.d ssh restart
66 else
67 /etc/init.d/ssh restart
68 fi
69 fi
70 ;;
71 esac
72 fi 56 fi
73fi 57fi
74 58