community/tinyssh: terminate sessions on shutdown

Copied from openssh sshd.initd
This commit is contained in:
Peter Shkenev 2023-03-28 16:56:35 +00:00 committed by alice
parent 121e8abc8e
commit 8af9caeae0
2 changed files with 14 additions and 2 deletions

View File

@ -2,7 +2,7 @@
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=tinyssh
pkgver=20230101
pkgrel=0
pkgrel=1
pkgdesc="Small SSH server using NaCl / TweetNaCl (no dependency on OpenSSL)"
url="https://tinyssh.org/"
license="CC0-1.0"
@ -61,6 +61,6 @@ openrc() {
sha512sums="
6beaf266058a89a78c710abd1a02feff0641a93d0d92aa07a1ad1ba3f6b3344bc312bb5a4cd5c06c6dcc83d25e48a801f9cfcfbb3de0f73904f36d32d4430482 tinyssh-20230101.tar.gz
408c85f113e554eb1e22b29b75a17765a2ed6046d34d1d9d800cd99ea94b5db4f39611347ebfb9e5ffd58071beb61f00319aacb7264184ba89d28cf279965b12 tinyssh.initd
d25f2d80f360528aaf7956ef6d257b09692c22de10e70c7eed132253c3903297269ff60f948f57a587fcd677fa9207b59715c54f257a777c95cc497570d21b56 tinyssh.initd
7c6282a6ae972d83d3e624530cac4958adee1e2313d0e44aff38c94bde1a3f549a536ec80e594d44c29a6a981919dd30322e8d8511626fdb6493c98587047392 tinyssh.confd
"

View File

@ -28,3 +28,15 @@ start_pre() {
tinysshd-makekey $keydir 2>/dev/null
fi
}
stop_post() {
if [ "$RC_RUNLEVEL" = "shutdown" ]; then
local _tinysshd_pids=$(pgrep tinysshd)
if [ -n "$_tinysshd_pids" ]; then
ebegin "Shutting down ssh connections"
# shellcheck disable=SC2086
kill -TERM $_tinysshd_pids >/dev/null 2>&1
eend 0
fi
fi
}