diff options
author | jc_gargma <jc_gargma@iserlohn-fortress.net> | 2018-10-31 02:23:34 -0700 |
---|---|---|
committer | jc_gargma <jc_gargma@iserlohn-fortress.net> | 2018-10-31 02:23:34 -0700 |
commit | 3ef164cf641373e19665de1e34957d486729146c (patch) | |
tree | fd861542a6578be7d3cba5ef1cf8fc9c4f776a2d | |
download | openssh-openrc-3ef164cf641373e19665de1e34957d486729146c.tar.xz |
Initial commit
-rw-r--r-- | PKGBUILD | 39 | ||||
-rw-r--r-- | sshd.confd | 21 | ||||
-rwxr-xr-x | sshd.initd | 65 |
3 files changed, 125 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..aee31de --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,39 @@ +# Maintainer: jc_gargma <jc_gargma@iserlohn-fortress.net> + +# # I maintain this because: +# Artix version triggers warnings on every other service +# which clutters up the logs + +pkgname=openssh-openrc +pkgver=20181031 +pkgrel=1 +pkgdesc="OpenRC openssh init script" +arch=('any') +url="https://neueland.iserlohn-fortress.net/gitea/jc_gargma" +license=('GPL2') +groups=('openrc-system') +provides=('init-openssh') +depends=('openrc' 'openssh') +conflicts=('init-openssh') +backup=('etc/conf.d/sshd') +source=("sshd.confd" + "sshd.initd") +sha256sums=('29c6d57ac3ec6018cadc6ba6cd9b90c9ed46e20049b970fdcc68ee2481a2ee41' + '43a483014bf177f9238e54a7b8210d5a76830beb67c18999409e543fd744c9e4') + +pkgver() { + date +%Y%m%d +} + +_inst_initd(){ + install -Dm755 ${srcdir}/$1.initd ${pkgdir}/etc/init.d/$1 +} + +_inst_confd(){ + install -Dm644 ${srcdir}/$1.confd ${pkgdir}/etc/conf.d/$1 +} + +package() { + _inst_confd 'sshd' + _inst_initd 'sshd' +} diff --git a/sshd.confd b/sshd.confd new file mode 100644 index 0000000..05a90e7 --- /dev/null +++ b/sshd.confd @@ -0,0 +1,21 @@ +# /etc/conf.d/sshd: config file for /etc/init.d/sshd + +# Where is your sshd_config file stored? + +SSHD_CONFDIR="/etc/ssh" + + +# Any random options you want to pass to sshd. +# See the sshd(8) manpage for more info. + +SSHD_OPTS="" + + +# Pid file to use (needs to be absolute path). + +#SSHD_PIDFILE="/run/sshd.pid" + + +# Path to the sshd binary (needs to be absolute path). + +#SSHD_BINARY="/usr/bin/sshd" diff --git a/sshd.initd b/sshd.initd new file mode 100755 index 0000000..dd0b146 --- /dev/null +++ b/sshd.initd @@ -0,0 +1,65 @@ +#!/usr/bin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +extra_commands="checkconfig" +extra_started_commands="reload" + +: ${SSHD_CONFDIR:=/etc/ssh} +: ${SSHD_CONFIG:=${SSHD_CONFDIR}/sshd_config} +: ${SSHD_PIDFILE:=/run/${SVCNAME}.pid} +: ${SSHD_BINARY:=/usr/bin/sshd} + +depend() { + use logger dns +} + +checkconfig() { + if [ ! -d /var/empty ] ; then + mkdir -p /var/empty || return 1 + fi + + if [ ! -e "${SSHD_CONFIG}" ] ; then + eerror "You need an ${SSHD_CONFIG} file to run sshd" + eerror "There is a sample file in /usr/share/doc/openssh" + return 1 + fi + + ssh-keygen -A || return 1 + + [ "${SSHD_PIDFILE}" != "/run/sshd.pid" ] \ + && SSHD_OPTS="${SSHD_OPTS} -o PidFile=${SSHD_PIDFILE}" + [ "${SSHD_CONFIG}" != "/etc/ssh/sshd_config" ] \ + && SSHD_OPTS="${SSHD_OPTS} -f ${SSHD_CONFIG}" + + "${SSHD_BINARY}" -t ${SSHD_OPTS} || return 1 +} + +start() { + checkconfig || return 1 + + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --exec "${SSHD_BINARY}" \ + --pidfile "${SSHD_PIDFILE}" \ + -- ${SSHD_OPTS} + eend $? +} + +stop() { + if [ "${RC_CMD}" = "restart" ] ; then + checkconfig || return 1 + fi + + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --exec "${SSHD_BINARY}" \ + --pidfile "${SSHD_PIDFILE}" --quiet + eend $? +} + +reload() { + checkconfig || return 1 + ebegin "Reloading ${SVCNAME}" + start-stop-daemon --signal HUP \ + --exec "${SSHD_BINARY}" --pidfile "${SSHD_PIDFILE}" + eend $? +} |