openssh: handle multiple ports and simplify init script
authorPeter Wagner <tripolar@gmx.at>
Thu, 21 Mar 2019 18:29:07 +0000 (19:29 +0100)
committerPeter Wagner <tripolar@gmx.at>
Thu, 21 Mar 2019 18:31:29 +0000 (19:31 +0100)
Signed-off-by: Peter Wagner <tripolar@gmx.at>
net/openssh/Makefile
net/openssh/files/sshd.init

index 6ef5ca39fa29bb405e3d2f64da3da7a6cf7ee63c..d71cee690345ae04619018138480eadeeffa9730 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openssh
 PKG_VERSION:=7.9p1
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ \
index a75daae4cd3f9229be0183c505d266f6c7aa6ec1..f9292d954aa55b29019fe4448150ef856ab93bf0 100644 (file)
@@ -8,7 +8,8 @@ USE_PROCD=1
 PROG=/usr/sbin/sshd
 
 start_service() {
-       for type in rsa ecdsa ed25519; do {
+       for type in rsa ecdsa ed25519
+       do
                # check for keys
                key=/etc/ssh/ssh_host_${type}_key
                [ ! -f $key ] && {
@@ -17,10 +18,10 @@ start_service() {
                                /usr/bin/ssh-keygen -N '' -t $type -f $key 2>&- >&-
                        }
                }
-       }; done
+       done
        mkdir -m 0700 -p /var/empty
 
-       local lport=`grep ^Port /etc/ssh/sshd_config | cut -d " " -f 2`
+       local lport=$(awk '/^Port / { print $2; exit }' /etc/ssh/sshd_config)
        [ -z $lport ] && lport=22
 
        procd_open_instance
@@ -31,16 +32,13 @@ start_service() {
 
 shutdown() {
        local pid
-       local pids
-       local pid_mine
 
        stop
 
        # kill active clients
-       pid_mine="$$"
-       pids="$(pidof sshd)"
-       for pid in $pids; do
-               [ "$pid" = "$pid_mine" ] && continue
+       for pid in $(pidof sshd)
+       do
+               [ "$pid" == "$$" ] && continue
                [ -e "/proc/$pid/stat" ] && kill $pid
        done
 }