summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2021-12-31 07:51:06 +0000
committerSam James <sam@gentoo.org>2022-01-03 07:40:48 +0000
commit03f7fc88d9fd3fa086db52056a66014ef16fb1d4 (patch)
tree91022b25a0293ff85755574420a514f47ec18caf /net-irc/unrealircd/files
parentdev-libs/pocl: use 'distro' option for built kernels (diff)
downloadgentoo-03f7fc88d9fd3fa086db52056a66014ef16fb1d4.tar.gz
gentoo-03f7fc88d9fd3fa086db52056a66014ef16fb1d4.tar.bz2
gentoo-03f7fc88d9fd3fa086db52056a66014ef16fb1d4.zip
net-irc/unrealircd: add 5.2.3
- Add 5.2.3 - Add chroot support to init script - Add checkconfig support to init script Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'net-irc/unrealircd/files')
-rw-r--r--net-irc/unrealircd/files/unrealircd.confd-r437
-rw-r--r--net-irc/unrealircd/files/unrealircd.initd-r362
2 files changed, 99 insertions, 0 deletions
diff --git a/net-irc/unrealircd/files/unrealircd.confd-r4 b/net-irc/unrealircd/files/unrealircd.confd-r4
new file mode 100644
index 000000000000..934ac0e3f59f
--- /dev/null
+++ b/net-irc/unrealircd/files/unrealircd.confd-r4
@@ -0,0 +1,37 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Where to chroot to
+# Uncomment this line for chrooting
+#UNREALIRCD_CHROOT="/var/chroot/ircd"
+UNREALIRCD_CHROOT=""
+
+# Which configuration file to load instead of unrealircd.conf. If you
+# want to run multiple instances of unrealircd, you must edit
+# files::pidfile to match UNREALIRCD_PIDFILE. You should also ensure
+# that files::tunefile is different for each unrealircd instance. See
+# https://www.unrealircd.org/docs/Configuration#Files_block
+#
+# To support multiple instances of unrealircd, you may create symlinks
+# in /etc/init.d pointing to /etc/init.d/unrealircd. It is recommended
+# that the scheme unrealircd.${instance_name} be used. For each
+# instance, you may make a copy of this file with the appropriate name
+# to override default options specific to that instance.
+UNREALIRCD_CONF="${UNREALIRCD_CHROOT}/etc/unrealircd/${SVCNAME}.conf"
+
+# The path where unrealircd is configured to create its pidfile.
+UNREALIRCD_PIDFILE="${UNREALIRCD_CHROOT}/run/unrealircd/${SVCNAME#unreal}.pid"
+
+# extra options to pass to unrealircd ...
+# You should not specify the -f option here; use
+# UNREALIRCD_CONF instead.
+#
+# [-h servername]
+# [-p portnumber]
+# [-x loglevel]
+# [-t] (to enable debug output)
+UNREALIRCD_OPTS=""
+
+# Extra flags to pass to start-stop-daemon. When initially
+# debugging, removing --quiet may help.
+UNREALIRCD_SSD_OPTS="--quiet"
diff --git a/net-irc/unrealircd/files/unrealircd.initd-r3 b/net-irc/unrealircd/files/unrealircd.initd-r3
new file mode 100644
index 000000000000..d2ff1a64c969
--- /dev/null
+++ b/net-irc/unrealircd/files/unrealircd.initd-r3
@@ -0,0 +1,62 @@
+#!/sbin/openrc-run
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Defaults
+: ${UNREALIRCD_CONF:=/etc/unrealircd/${SVCNAME}.conf}
+: ${UNREALIRCD_PIDFILE:=/run/unrealircd/${SVCNAME#unreal}.pid}
+
+# Convenience variable for the chroot bits, not actually user-controllable via conf.d
+UNREALIRCD_USER="unrealircd"
+UNREALIRCD_BIN="/usr/bin/unrealircd"
+UNREALIRCD_COMMAND_ARGS="-F -f ${UNREALIRCD_CONF} ${UNREALIRCD_OPTS}"
+
+# Run the daemon in the foreground and let OpenRC background it.
+# This way the PID file is created securely, as root.
+# https://bugs.unrealircd.org/view.php?id=4990
+# https://bugs.gentoo.org/628434
+command_args="${UNREALIRCD_COMMAND_ARGS}"
+command_background=true
+pidfile="${UNREALIRCD_PIDFILE}"
+
+start_stop_daemon_args="${UNREALIRCD_SSD_OPTS}"
+extra_started_commands="checkconfig reload"
+
+if [ -n "${UNREALIRCD_CHROOT}" ]; then
+ command=/usr/bin/chroot
+ command_args="--userspec ${UNREALIRCD_USER}:${UNREALIRCD_USER} ${UNREALIRCD_CHROOT} ${UNREALIRCD_BIN} ${UNREALIRCD_COMMAND_ARGS}"
+else
+ # We're running it directly so no need for anything special.
+ command="${UNREALIRCD_BIN}"
+ command_user=${UNREALIRCD_USER}
+fi
+
+checkconfig() {
+ # command_args weirdness because We want to preserve the chroot arguments if it's set
+ su -s /bin/sh ${command_user:=root} -c "${command} ${command_args%${UNREALIRCD_COMMAND_ARGS}}" configtest
+}
+
+depend() {
+ use dns net
+ provide ircd
+}
+
+# It is unsafe for the unrealircd user to be able to write to its own
+# PID file, since root will be sending e.g. kill signals to the PID
+# listed in that file. Ensure that we overwrite the ownership and
+# permissions on /run/unrealircd from previous init scripts.
+start_pre() {
+ checkpath --directory --owner root:root --mode 0700 "${UNREALIRCD_CHROOT}"/run/unrealircd
+
+ checkconfig || return $?
+}
+
+reload() {
+ checkconfig || return $?
+
+ ebegin "Reloading ${RC_SVCNAME}"
+ start-stop-daemon --signal HUP \
+ --pidfile "${pidfile}" \
+ ${UNREALIRCD_SSD_OPTS}
+ eend $?
+}