summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2012-11-26 16:25:31 +0000
committerColin Watson <cjwatson@debian.org>2012-11-26 16:25:31 +0000
commit7a429f23d389f21d7f98737e6f641442c794226e (patch)
tree081c82baf752290222b4347ef462b4cc9338b9d6
parent5095210e1b6b15e1430b99bcb914645cde299329 (diff)
Merge Upstart job scripting support from Ubuntu, to handle the Upstart job being primary there.
-rw-r--r--debian/control2
-rw-r--r--debian/openssh-server.if-up.in (renamed from debian/openssh-server.if-up)23
-rw-r--r--debian/openssh-server.postinst.in (renamed from debian/openssh-server.postinst)27
-rw-r--r--debian/openssh-server.prerm.in (renamed from debian/openssh-server.prerm)23
-rw-r--r--debian/openssh-server.ssh.init.in (renamed from debian/openssh-server.ssh.init)9
-rwxr-xr-xdebian/rules26
-rw-r--r--debian/ssh-krb5.postinst.in (renamed from debian/ssh-krb5.postinst)26
7 files changed, 106 insertions, 30 deletions
diff --git a/debian/control b/debian/control
index c4182d981..600d5c915 100644
--- a/debian/control
+++ b/debian/control
@@ -44,7 +44,7 @@ Description: secure shell (SSH) client, for secure access to remote machines
44Package: openssh-server 44Package: openssh-server
45Priority: optional 45Priority: optional
46Architecture: any 46Architecture: any
47Depends: ${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 47Depends: ${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)
48Recommends: xauth, ncurses-term, ${openssh-server:Recommends} 48Recommends: xauth, ncurses-term, ${openssh-server:Recommends}
49Conflicts: 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) 49Conflicts: 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)
50Replaces: ssh, openssh-client (<< 1:3.8.1p1-11), ssh-krb5 50Replaces: ssh, openssh-client (<< 1:3.8.1p1-11), ssh-krb5
diff --git a/debian/openssh-server.if-up b/debian/openssh-server.if-up.in
index ce5d4dd17..871493068 100644
--- a/debian/openssh-server.if-up
+++ b/debian/openssh-server.if-up.in
@@ -30,11 +30,22 @@ if [ ! -f /var/run/sshd.pid ] || \
30 exit 0 30 exit 0
31fi 31fi
32 32
33# We'd like to use 'reload' here, but it has some problems; see #502444. 33case '@DISTRIBUTOR@' in
34if [ -x /usr/sbin/invoke-rc.d ]; then 34 Ubuntu)
35 invoke-rc.d ssh restart >/dev/null 2>&1 || true 35 # Both init script and Upstart job are present; we want to operate
36else 36 # on the Upstart job.
37 /etc/init.d/ssh restart >/dev/null 2>&1 || true 37 stop ssh || true
38fi 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
39 50
40exit 0 51exit 0
diff --git a/debian/openssh-server.postinst b/debian/openssh-server.postinst.in
index cf3fa68ea..9aa568292 100644
--- a/debian/openssh-server.postinst
+++ b/debian/openssh-server.postinst.in
@@ -417,14 +417,27 @@ remove_old_init_links() {
417} 417}
418 418
419setup_init() { 419setup_init() {
420 if [ -x /etc/init.d/ssh ]; then 420 case '@DISTRIBUTOR@' in
421 update-rc.d ssh start 16 2 3 4 5 . >/dev/null 421 Ubuntu)
422 if [ -x /usr/sbin/invoke-rc.d ]; then 422 # Both init script and Upstart job are present; we want to
423 invoke-rc.d ssh restart 423 # operate on the Upstart job.
424 else 424 if [ -e /etc/init/ssh.conf ]; then
425 /etc/init.d/ssh restart 425 stop ssh 2>/dev/null || true
426 start ssh || true
426 fi 427 fi
427 fi 428 update-rc.d -f ssh remove >/dev/null || true
429 ;;
430 *)
431 if [ -x /etc/init.d/ssh ]; then
432 update-rc.d ssh start 16 2 3 4 5 . >/dev/null
433 if [ -x /usr/sbin/invoke-rc.d ]; then
434 invoke-rc.d ssh restart
435 else
436 /etc/init.d/ssh restart
437 fi
438 fi
439 ;;
440 esac
428} 441}
429 442
430commit_transfer_conffile () { 443commit_transfer_conffile () {
diff --git a/debian/openssh-server.prerm b/debian/openssh-server.prerm.in
index 9c3313aac..188434d27 100644
--- a/debian/openssh-server.prerm
+++ b/debian/openssh-server.prerm.in
@@ -17,13 +17,24 @@ set -e
17 17
18case "$1" in 18case "$1" in
19 remove|deconfigure) 19 remove|deconfigure)
20 if [ -x /etc/init.d/ssh ]; then 20 case '@DISTRIBUTOR@' in
21 if [ -x /usr/sbin/invoke-rc.d ]; then 21 Ubuntu)
22 invoke-rc.d ssh stop 22 # Both init script and Upstart job are present; we want to
23 else 23 # operate on the Upstart job.
24 /etc/init.d/ssh stop 24 if [ -e /etc/init/ssh.conf ]; then
25 stop ssh || true
25 fi 26 fi
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
27 ;; 38 ;;
28 upgrade) 39 upgrade)
29 # remove symlink on downgrade to when it was a directory 40 # remove symlink on downgrade to when it was a directory
diff --git a/debian/openssh-server.ssh.init b/debian/openssh-server.ssh.init.in
index f4c6f251f..e24cb1bed 100644
--- a/debian/openssh-server.ssh.init
+++ b/debian/openssh-server.ssh.init.in
@@ -16,6 +16,15 @@ 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
19umask 022 28umask 022
20 29
21if test -f /etc/default/ssh; then 30if test -f /etc/default/ssh; then
diff --git a/debian/rules b/debian/rules
index a2efd3a0b..5cf42b692 100755
--- a/debian/rules
+++ b/debian/rules
@@ -44,7 +44,7 @@ endif
44# Change the version string to include the Debian version 44# Change the version string to include the Debian version
45SSH_EXTRAVERSION := Debian-$(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/Version: //p' | sed -e 's/[^-]*-//') 45SSH_EXTRAVERSION := Debian-$(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/Version: //p' | sed -e 's/[^-]*-//')
46 46
47DISTRIBUTOR := $(shell dpkg-vendor --derives-from Ubuntu 2>/dev/null && echo Ubuntu) 47DISTRIBUTOR := $(shell if dpkg-vendor --derives-from Ubuntu 2>/dev/null; then echo Ubuntu; else echo Debian; fi)
48ifeq ($(DISTRIBUTOR),Ubuntu) 48ifeq ($(DISTRIBUTOR),Ubuntu)
49DEFAULT_PATH := /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games 49DEFAULT_PATH := /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
50else 50else
@@ -115,6 +115,16 @@ confflags_udeb += --with-ldflags='-Wl,--as-needed'
115%: 115%:
116 dh $@ 116 dh $@
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
118override_dh_auto_configure: 128override_dh_auto_configure:
119 dh_auto_configure -Bbuild-deb -- $(confflags) 129 dh_auto_configure -Bbuild-deb -- $(confflags)
120 dh_auto_configure -Bbuild-udeb -- $(confflags_udeb) 130 dh_auto_configure -Bbuild-udeb -- $(confflags_udeb)
@@ -147,10 +157,14 @@ endif
147 (cat debian/copyright.head; iconv -f ISO-8859-1 -t UTF-8 LICENCE) \ 157 (cat debian/copyright.head; iconv -f ISO-8859-1 -t UTF-8 LICENCE) \
148 > debian/copyright 158 > debian/copyright
149 159
160override_dh_clean:
161 dh_clean
162 rm -f $(DISTRIBUTOR_REPLACE)
163
150override_dh_auto_install: 164override_dh_auto_install:
151 $(MAKE) -C build-deb DESTDIR=`pwd`/debian/tmp install-nokeys 165 $(MAKE) -C build-deb DESTDIR=`pwd`/debian/tmp install-nokeys
152 166
153override_dh_install: 167override_dh_install: $(DISTRIBUTOR_REPLACE)
154 rm -f debian/tmp/etc/ssh/sshd_config 168 rm -f debian/tmp/etc/ssh/sshd_config
155 169
156 dh_install -Nopenssh-client-udeb -Nopenssh-server-udeb --fail-missing 170 dh_install -Nopenssh-client-udeb -Nopenssh-server-udeb --fail-missing
@@ -176,6 +190,12 @@ override_dh_installdocs:
176 190
177override_dh_installinit: 191override_dh_installinit:
178 dh_installinit -n --name ssh 192 dh_installinit -n --name ssh
193ifeq ($(DISTRIBUTOR),Ubuntu)
194 # We need to keep the init script as well as the Upstart job for
195 # now, for the benefit of people running sshd in chroots.
196 install -D -o root -g root debian/openssh-server.ssh.init debian/openssh-server/etc/init.d/ssh
197 install -D -o root -g root -m 644 debian/openssh-server.ssh.default debian/openssh-server/etc/default/ssh
198endif
179 199
180override_dh_installpam: 200override_dh_installpam:
181 dh_installpam --name sshd 201 dh_installpam --name sshd
@@ -189,7 +209,7 @@ override_dh_shlibdeps:
189 dh_shlibdeps 209 dh_shlibdeps
190 debian/adjust-openssl-dependencies 210 debian/adjust-openssl-dependencies
191 211
192override_dh_installdeb: 212override_dh_installdeb: $(DISTRIBUTOR_REPLACE)
193 dh_installdeb 213 dh_installdeb
194 perl -i debian/substitute-conffile.pl \ 214 perl -i debian/substitute-conffile.pl \
195 ETC_SSH_MODULI debian/openssh-client/etc/ssh/moduli \ 215 ETC_SSH_MODULI debian/openssh-client/etc/ssh/moduli \
diff --git a/debian/ssh-krb5.postinst b/debian/ssh-krb5.postinst.in
index 4d943d861..ce45c86df 100644
--- a/debian/ssh-krb5.postinst
+++ b/debian/ssh-krb5.postinst.in
@@ -58,13 +58,25 @@ GSSAPIKeyExchange yes
58EOF 58EOF
59 fi 59 fi
60 fi 60 fi
61 if [ -n "$changed" ] && [ -x /etc/init.d/ssh ] ; then 61 case '@DISTRIBUTOR@' in
62 if [ -x /usr/sbin/invoke-rc.d ] ; then 62 Ubuntu)
63 invoke-rc.d ssh restart 63 # Both init script and Upstart job are present; we want to
64 else 64 # operate on the Upstart job.
65 /etc/init.d/ssh restart 65 if [ -n "$changed" ] && [ -e /etc/init/ssh.conf ] ; then
66 fi 66 stop ssh || true
67 fi 67 start ssh || true
68 fi
69 ;;
70 *)
71 if [ -n "$changed" ] && [ -x /etc/init.d/ssh ] ; then
72 if [ -x /usr/sbin/invoke-rc.d ] ; then
73 invoke-rc.d ssh restart
74 else
75 /etc/init.d/ssh restart
76 fi
77 fi
78 ;;
79 esac
68 fi 80 fi
69fi 81fi
70 82