From adc5cb35ba0d880e567a07ad8a4c80a413fbf911 Mon Sep 17 00:00:00 2001 From: pepe Date: Sat, 29 Jul 2023 21:08:12 +0000 Subject: [PATCH] ): --- init.d/cronie | 13 +++++++ init.d/dmcrypt | 0 init.d/sshd | 87 +++++++++++++++++++++++++++++++++++++++++++ xbps.d/noextract.conf | 3 ++ 4 files changed, 103 insertions(+) create mode 100755 init.d/cronie mode change 100644 => 100755 init.d/dmcrypt create mode 100755 init.d/sshd diff --git a/init.d/cronie b/init.d/cronie new file mode 100755 index 0000000..fb86f41 --- /dev/null +++ b/init.d/cronie @@ -0,0 +1,13 @@ +#!/sbin/openrc-run +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +command="/usr/bin/crond" +command_args="${CRONDARGS}" +pidfile="/run/crond.pid" + +depend() { + use clock logger + need localmount + provide cron +} diff --git a/init.d/dmcrypt b/init.d/dmcrypt old mode 100644 new mode 100755 diff --git a/init.d/sshd b/init.d/sshd new file mode 100755 index 0000000..826e1a8 --- /dev/null +++ b/init.d/sshd @@ -0,0 +1,87 @@ +#!/sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +extra_commands="checkconfig" +extra_started_commands="reload" + +: ${SSHD_CONFDIR:=${RC_PREFIX%/}/etc/ssh} +: ${SSHD_CONFIG:=${SSHD_CONFDIR}/sshd_config} +: ${SSHD_PIDFILE:=${RC_PREFIX%/}/run/${SVCNAME}.pid} +: ${SSHD_BINARY:=${RC_PREFIX%/}/usr/local/bin/sshd} +: ${SSHD_KEYGEN_BINARY:=${RC_PREFIX%/}/usr/local/bin/ssh-keygen} + +command="${SSHD_BINARY}" +pidfile="${SSHD_PIDFILE}" +command_args="${SSHD_OPTS} -o PidFile=${pidfile} -f ${SSHD_CONFIG}" + +# Wait one second (length chosen arbitrarily) to see if sshd actually +# creates a PID file, or if it crashes for some reason like not being +# able to bind to the address in ListenAddress (bug 617596). +: ${SSHD_SSD_OPTS:=--wait 1000} +start_stop_daemon_args="${SSHD_SSD_OPTS}" + +depend() { + # Entropy can be used by ssh-keygen, among other things, but + # is not strictly required (bug 470020). + use logger dns entropy + if [ "${rc_need+set}" = "set" ] ; then + : # Do nothing, the user has explicitly set rc_need + else + local x warn_addr + for x in $(awk '/^ListenAddress/{ print $2 }' "$SSHD_CONFIG" 2>/dev/null) ; do + case "${x}" in + 0.0.0.0|0.0.0.0:*) ;; + ::|\[::\]*) ;; + *) warn_addr="${warn_addr} ${x}" ;; + esac + done + if [ -n "${warn_addr}" ] ; then + need net + ewarn "You are binding an interface in ListenAddress statement in your sshd_config!" + ewarn "You must add rc_need=\"net.FOO\" to your ${RC_PREFIX%/}/etc/conf.d/sshd" + ewarn "where FOO is the interface(s) providing the following address(es):" + ewarn "${warn_addr}" + fi + fi +} + +checkconfig() { + checkpath --mode 0755 --directory "${RC_PREFIX%/}/var/empty" + + 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 + + ${SSHD_KEYGEN_BINARY} -A || return 2 + + "${command}" -t ${command_args} || return 3 +} + +start_pre() { + # Make sure that the user's config isn't busted before we try + # to start the daemon (this will produce better error messages + # than if we just try to start it blindly). + # + # We always need to call checkconfig because this function will + # also generate any missing host key and you can start a + # non-running service with "restart" argument. + checkconfig || return $? +} + +stop_pre() { + # If this is a restart, check to make sure the user's config + # isn't busted before we stop the running daemon. + if [ "${RC_CMD}" = "restart" ] ; then + checkconfig || return $? + fi +} + +reload() { + checkconfig || return $? + ebegin "Reloading ${SVCNAME}" + start-stop-daemon --signal HUP --pidfile "${pidfile}" + eend $? +} diff --git a/xbps.d/noextract.conf b/xbps.d/noextract.conf index 4c6ef74..72c8344 100644 --- a/xbps.d/noextract.conf +++ b/xbps.d/noextract.conf @@ -1,3 +1,6 @@ +noextract=/etc/anacrontab +noextract=/etc/cron.d/0hourly +noextract=/etc/cron.hourly/0anacron noextract=/etc/sv/* noextract=/usr/bin/ldd noextract=/usr/bin/lddtree