logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

tinyssh.initd (810B)


  1. #!/sbin/openrc-run
  2. # Copyright 1999-2018 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. TINYSSH_CONFDIR="${TINYSSH_CONFDIR:-/etc/tinyssh}"
  5. TINYSSH_KEYDIR="${TINYSSH_KEYDIR:-${TINYSSH_CONFDIR}/keys}"
  6. TINYSSHD="/usr/sbin/tinysshd"
  7. MAKEKEY="${TINYSSHD}-makekey"
  8. PRINTKEY="/usr/bin/tinysshd-printkey"
  9. command="/usr/bin/tcpserver"
  10. command_args="-HRDl0 ${TINYSSH_IP:-0.0.0.0} ${TINYSSH_PORT:-22}
  11. ${TINYSSHD} ${TINYSSH_OPTS:--l -v} ${TINYSSH_KEYDIR}"
  12. command_background=yes
  13. pidfile="/run/${RC_SVCNAME}.pid"
  14. start_stop_daemon_args="${SSD_OPTS}"
  15. depend() {
  16. use net
  17. }
  18. start_pre() {
  19. if [ "${RC_CMD}" != "restart" ]; then
  20. checkpath -d "${TINYSSH_CONFDIR}"
  21. if ! ${PRINTKEY} "${TINYSSH_KEYDIR}" >/dev/null 2>&1; then
  22. ${MAKEKEY} "${TINYSSH_KEYDIR}" || return 1
  23. fi
  24. fi
  25. }