Przeglądaj źródła

contrib: Add OpenRC initscripts for taud, ircd, and darkfid.

parazyd 4 lat temu
rodzic
commit
acaee0f926

+ 1 - 0
contrib/init/darkfid.confd

@@ -0,0 +1 @@
+USER="darkfid"

+ 35 - 0
contrib/init/darkfid.initd

@@ -0,0 +1,35 @@
+#!/sbin/openrc-run
+# Copyright 1999-2022 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+	use net
+}
+
+start() {
+	PWHOME="$(getent passwd $USER | awk -F: '{ print $6 }')"
+
+	ebegin "Starting darkfid"
+	env TERM="xterm" \
+		start-stop-daemon \
+			--start \
+			--make-pidfile \
+			--pidfile /var/run/darkfid.pid \
+			--background \
+			--user $USER \
+			--env HOME="${PWHOME:-/home/$USER}" \
+			--name darkfid \
+			--exec /usr/bin/screen -- -D -m -S darkfid /usr/local/bin/darkfid
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping darkfid"
+	# Because we've daemonized with screen, we need to replace the PID file
+	# with the real PID of the program
+	pgrep -P $(cat /var/run/darkfid.pid) > /var/run/darkfid.pid
+
+	start-stop-daemon --stop --signal 15 \
+		--pidfile /var/run/darkfid.pid
+	eend $?
+}

+ 1 - 0
contrib/init/ircd.confd

@@ -0,0 +1 @@
+USER="ircd"

+ 35 - 0
contrib/init/ircd.initd

@@ -0,0 +1,35 @@
+#!/sbin/openrc-run
+# Copyright 1999-2022 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+	use net
+}
+
+start() {
+	PWHOME="$(getent passwd $USER | awk -F: '{ print $6 }')"
+
+	ebegin "Starting ircd"
+	env TERM="xterm" \
+		start-stop-daemon \
+			--start \
+			--make-pidfile \
+			--pidfile /var/run/ircd.pid \
+			--background \
+			--user $USER \
+			--env HOME="${PWHOME:-/home/$USER}" \
+			--name ircd \
+			--exec /usr/bin/screen -- -D -m -S ircd /usr/local/bin/ircd
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping ircd"
+	# Because we've daemonized with screen, we need to replace the PID file
+	# with the real PID of the program
+	pgrep -P $(cat /var/run/ircd.pid) > /var/run/ircd.pid
+
+	start-stop-daemon --stop --signal 15 \
+		--pidfile /var/run/ircd.pid
+	eend $?
+}

+ 1 - 0
contrib/init/taud.confd

@@ -0,0 +1 @@
+USER="taud"

+ 35 - 0
contrib/init/taud.initd

@@ -0,0 +1,35 @@
+#!/sbin/openrc-run
+# Copyright 1999-2022 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+	use net
+}
+
+start() {
+	PWHOME="$(getent passwd $USER | awk -F: '{ print $6 }')"
+
+	ebegin "Starting taud"
+	env TERM="xterm" \
+		start-stop-daemon \
+			--start \
+			--make-pidfile \
+			--pidfile /var/run/taud.pid \
+			--background \
+			--user $USER \
+			--env HOME="${PWHOME:-/home/$USER}" \
+			--name taud \
+			--exec /usr/bin/screen -- -D -m -S taud /usr/local/bin/taud
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping taud"
+	# Because we've daemonized with screen, we need to replace the PID file
+	# with the real PID of the program
+	pgrep -P $(cat /var/run/taud.pid) > /var/run/taud.pid
+
+	start-stop-daemon --stop --signal 15 \
+		--pidfile /var/run/taud.pid
+	eend $?
+}