#!/sbin/openrc-run
# Generated by ../utrans from:
#  9c36778605edb201ec5b7d1676887fc00249fa1b2582ec89e158c55b45b4659c  ./input/ssh.socket
#  35b2858970feb78e985900b33ba8cb84249dfadbf296155e5639cafcf1dd40a3  ./input/ssh.service

description="OpenBSD Secure Shell server."
# Documentation:
#  man:sshd(8)
#  man:sshd_config(5)

supervisor="supervise-daemon"
command="/usr/bin/socket-activate"
command_args="--unix::22 -- /usr/sbin/sshd -D $SSHD_OPTS"
depend() {
    use mountnfs mountnfs-bootclean umountnfs sendsigs mountall mountall-bootclean mountoverflowtmp umountfs
    after auditd mountnfs mountnfs-bootclean umountnfs sendsigs networking ifupdown mountall mountall-bootclean mountoverflowtmp umountfs
    provide sshd
}
start_pre() {
  [ ! -e '/etc/ssh/sshd_not_to_be_run' ] || start() { einfo "Skipped due to ConditionPathExists !/etc/ssh/sshd_not_to_be_run"; }
  mkdir -p -m 0755 "${RUNTIME_DIRECTORY:?}"
  /usr/sbin/sshd -t
}
stop_post() {
  rm -r "${RUNTIME_DIRECTORY:?}"
}
extra_started_commands="reload"
reload() {
  ebegin "Reloading ${RC_SVCNAME}"
  /usr/sbin/sshd -t
  /bin/kill -HUP $MAINPID
}
