mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 21:37:15 +02:00
community/tinyssh: modernise initd / use supervise-daemon
This commit is contained in:
parent
1a437ad05a
commit
0719889eb4
@ -2,7 +2,7 @@
|
||||
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
|
||||
pkgname=tinyssh
|
||||
pkgver=20161101
|
||||
pkgrel=0
|
||||
pkgrel=1
|
||||
pkgdesc="Small SSH server using NaCl / TweetNaCl (no dependency on OpenSSL)"
|
||||
url="http://tinyssh.org/"
|
||||
arch="all"
|
||||
@ -53,5 +53,5 @@ EOF
|
||||
}
|
||||
|
||||
sha512sums="684aac5bf8f8713582bc4a0459680f7b9f32ea6bfa7896c2e48b8431ff5e1f4cf067d055986ecfa988edd32cea13694c1621a86d0b9652fce45954284cf1eafd tinyssh-20161101.tar.gz
|
||||
d10f995c6687e706453e51d06b3466427d476036efdbd86db2f9330281e46049bf2e3698208524b3f70cdbd30373f5bf46c7164dd626d22b3fa9a75ca5d8d478 tinyssh.initd
|
||||
4513bd0d43ef0825fbd77365a8a7adefcd99211102df76003becf7e3a09a47ad9bbd16a68c3fadfb7868e0562f8d42a26106b7582cb70490a7e52a7d1e6110e9 tinyssh.confd"
|
||||
4bba2c283e1c266734d26647b4c400c2fce258cd9957b41f637a5e875ce995b4cdef9eeea147178174facc311fc6e23a6ebcf10b05fb75222582605dc9b1fde5 tinyssh.initd
|
||||
7c6282a6ae972d83d3e624530cac4958adee1e2313d0e44aff38c94bde1a3f549a536ec80e594d44c29a6a981919dd30322e8d8511626fdb6493c98587047392 tinyssh.confd"
|
||||
|
@ -3,6 +3,8 @@
|
||||
# Specify daemon options here:
|
||||
# OPTIONS="-l -v"
|
||||
|
||||
# override config directory / port here:
|
||||
# override config directory / ip / port here:
|
||||
# CONFDIR=/etc/tinyssh
|
||||
# PORT=22
|
||||
# IP=0.0.0.0
|
||||
|
||||
|
@ -1,43 +1,51 @@
|
||||
#!/sbin/openrc-run
|
||||
# Alpine Linux init.d for TinySSH
|
||||
# Copyright 2015 Stuart Cardall (developer@it-offshore.co.uk)
|
||||
# Copyright 2017 Stuart Cardall (https://github.com/itoffshore)
|
||||
# Distributed under the terms of the GNU General Public License, v2 or later #
|
||||
|
||||
name=tinysshd
|
||||
daemon=/usr/sbin/$name
|
||||
supervisor=supervise-daemon
|
||||
description="Small SSH server using NaCl (no dependency on OpenSSL)"
|
||||
|
||||
nice="0"
|
||||
pidfile="/run/tinysshd.sd.pid"
|
||||
supervise_daemon_args=""
|
||||
|
||||
daemon=/usr/sbin/tinysshd
|
||||
keygen=$daemon-makekey
|
||||
|
||||
CONFDIR=${CONFDIR:-/etc/tinyssh}
|
||||
keydir=${CONFDIR}/sshkeys
|
||||
OPTIONS=${OPTIONS:-\-v -l}
|
||||
PORT=${PORT:-22}
|
||||
pidfile=/var/run/$name.pid
|
||||
server_opts="-HRDl0 0.0.0.0 ${PORT} $daemon ${OPTIONS} $keydir"
|
||||
IP=${IP:-0.0.0.0}
|
||||
|
||||
command="tcpserver"
|
||||
command_args="-HRDl0 ${IP} ${PORT} $daemon ${OPTIONS} $keydir"
|
||||
proxy_env=/etc/profile.d/proxy.sh
|
||||
|
||||
depend() {
|
||||
use net
|
||||
after logger firewall
|
||||
use net
|
||||
after logger firewall
|
||||
}
|
||||
|
||||
checkconfig() {
|
||||
in_contr() {
|
||||
grep "container=" /proc/1/environ
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
checkpath --directory ${CONFDIR}
|
||||
eval $keygen $keydir 2>/dev/null
|
||||
|
||||
if [ -z "$(in_contr)" ]; then
|
||||
supervise_daemon_args="$supervise_daemon_args -N $nice"
|
||||
fi
|
||||
|
||||
# tinyssh also runs from inetd without tcpserver
|
||||
if [ ! -f /usr/bin/tcpserver ]; then
|
||||
apk add --quiet ucspi-tcp
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
checkconfig
|
||||
ebegin "Starting ${name}"
|
||||
start-stop-daemon --start --make-pidfile --background --pidfile $pidfile \
|
||||
--exec tcpserver -- $server_opts
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping ${name}"
|
||||
start-stop-daemon --stop --quiet \
|
||||
--pidfile $pidfile
|
||||
eend $?
|
||||
if [ ! -x /usr/bin/tcpserver ]; then
|
||||
# openrc does not use proxy environment by default
|
||||
if [ -f "$proxy_env" ]; then
|
||||
. $proxy_env
|
||||
fi
|
||||
apk add ucspi-tcp6
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user