diff options
| author | Andrei Dinu <andrei.adrianx.dinu@intel.com> | 2013-01-28 10:50:04 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-01-28 14:49:04 +0000 |
| commit | f3dfb7c200389e08a362737fa27546e704907f0a (patch) | |
| tree | b002c69c90babce09bbd3f6b55e0b7cc83cfce35 /meta/recipes-connectivity/openssh/openssh-6.1p1/init | |
| parent | 3ba2ce25bdc78f660552d3d16272a551d434c527 (diff) | |
| download | poky-f3dfb7c200389e08a362737fa27546e704907f0a.tar.gz | |
openssh : upgrade to 6.1p1
(From OE-Core rev: 5534deb69b0a2835fbbf149a00d1f6ba61cc8160)
Signed-off-by: Andrei Dinu <andrei.adrianx.dinu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/openssh/openssh-6.1p1/init')
| -rw-r--r-- | meta/recipes-connectivity/openssh/openssh-6.1p1/init | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssh/openssh-6.1p1/init b/meta/recipes-connectivity/openssh/openssh-6.1p1/init new file mode 100644 index 0000000000..cde52ef3f4 --- /dev/null +++ b/meta/recipes-connectivity/openssh/openssh-6.1p1/init | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | #! /bin/sh | ||
| 2 | set -e | ||
| 3 | |||
| 4 | # /etc/init.d/ssh: start and stop the OpenBSD "secure shell" daemon | ||
| 5 | |||
| 6 | test -x /usr/sbin/sshd || exit 0 | ||
| 7 | ( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0 | ||
| 8 | |||
| 9 | if test -f /etc/default/ssh; then | ||
| 10 | . /etc/default/ssh | ||
| 11 | fi | ||
| 12 | |||
| 13 | check_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 | |||
| 21 | check_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 | |||
| 29 | check_config() { | ||
| 30 | /usr/sbin/sshd -t || exit 1 | ||
| 31 | } | ||
| 32 | |||
| 33 | check_keys() { | ||
| 34 | # create keys if necessary | ||
| 35 | if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then | ||
| 36 | echo " generating ssh RSA key..." | ||
| 37 | ssh-keygen -q -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa | ||
| 38 | fi | ||
| 39 | if [ ! -f /etc/ssh/ssh_host_ecdsa_key ]; then | ||
| 40 | echo " generating ssh ECDSA key..." | ||
| 41 | ssh-keygen -q -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa | ||
| 42 | fi | ||
| 43 | if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then | ||
| 44 | echo " generating ssh DSA key..." | ||
| 45 | ssh-keygen -q -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa | ||
| 46 | fi | ||
| 47 | } | ||
| 48 | |||
| 49 | export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" | ||
| 50 | |||
| 51 | case "$1" in | ||
| 52 | start) | ||
| 53 | check_for_no_start | ||
| 54 | echo "Starting OpenBSD Secure Shell server: sshd" | ||
| 55 | check_keys | ||
| 56 | check_privsep_dir | ||
| 57 | start-stop-daemon -S -x /usr/sbin/sshd -- $SSHD_OPTS | ||
| 58 | echo "done." | ||
| 59 | ;; | ||
| 60 | stop) | ||
| 61 | echo -n "Stopping OpenBSD Secure Shell server: sshd" | ||
| 62 | start-stop-daemon -K -x /usr/sbin/sshd | ||
| 63 | echo "." | ||
| 64 | ;; | ||
| 65 | |||
| 66 | reload|force-reload) | ||
| 67 | check_for_no_start | ||
| 68 | check_keys | ||
| 69 | check_config | ||
| 70 | echo -n "Reloading OpenBSD Secure Shell server's configuration" | ||
| 71 | start-stop-daemon -K -s 1 -x /usr/sbin/sshd | ||
| 72 | echo "." | ||
| 73 | ;; | ||
| 74 | |||
| 75 | restart) | ||
| 76 | check_keys | ||
| 77 | check_config | ||
| 78 | echo -n "Restarting OpenBSD Secure Shell server: sshd" | ||
| 79 | start-stop-daemon -K -oknodo -x /usr/sbin/sshd | ||
| 80 | check_for_no_start | ||
| 81 | check_privsep_dir | ||
| 82 | sleep 2 | ||
| 83 | start-stop-daemon -S -x /usr/sbin/sshd -- $SSHD_OPTS | ||
| 84 | echo "." | ||
| 85 | ;; | ||
| 86 | |||
| 87 | *) | ||
| 88 | echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}" | ||
| 89 | exit 1 | ||
| 90 | esac | ||
| 91 | |||
| 92 | exit 0 | ||
