diff options
Diffstat (limited to 'net-misc/tinyssh/files/tinyssh.initd')
-rw-r--r-- | net-misc/tinyssh/files/tinyssh.initd | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/net-misc/tinyssh/files/tinyssh.initd b/net-misc/tinyssh/files/tinyssh.initd new file mode 100644 index 000000000000..095a7f4e1056 --- /dev/null +++ b/net-misc/tinyssh/files/tinyssh.initd @@ -0,0 +1,30 @@ +#!/sbin/openrc-run +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +TINYSSH_CONFDIR="${TINYSSH_CONFDIR:-/etc/tinyssh}" +TINYSSH_KEYDIR="${TINYSSH_KEYDIR:-${TINYSSH_CONFDIR}/keys}" + +TINYSSHD="/usr/sbin/tinysshd" +MAKEKEY="${TINYSSHD}-makekey" +PRINTKEY="/usr/bin/tinysshd-printkey" + +command="/usr/bin/tcpserver" +command_args="-HRDl0 ${TINYSSH_IP:-0.0.0.0} ${TINYSSH_PORT:-22} + ${TINYSSHD} ${TINYSSH_OPTS:--l -v} ${TINYSSH_KEYDIR}" +command_background=yes +pidfile="/run/${RC_SVCNAME}.pid" +start_stop_daemon_args="${SSD_OPTS}" + +depend() { + use net +} + +start_pre() { + if [ "${RC_CMD}" != "restart" ]; then + checkpath -d "${TINYSSH_CONFDIR}" + if ! ${PRINTKEY} "${TINYSSH_KEYDIR}" >/dev/null 2>&1; then + ${MAKEKEY} "${TINYSSH_KEYDIR}" || return 1 + fi + fi +} |