浏览代码

contrib: Clean up initscripts

x 7 月之前
父节点
当前提交
4cb693e606

+ 0 - 1
contrib/init/darkfid.confd

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

+ 0 - 37
contrib/init/darkfid.initd

@@ -1,37 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2023 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 -- \
-				    -L -Logfile /home/darkfid/screenlog.0 \
-				    -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 $?
-}

+ 0 - 1
contrib/init/faucetd.confd

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

+ 0 - 37
contrib/init/faucetd.initd

@@ -1,37 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2023 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 faucetd"
-	env TERM="xterm" \
-		start-stop-daemon \
-			--start \
-			--make-pidfile \
-			--pidfile /var/run/faucetd.pid \
-			--background \
-			--user $USER \
-			--env HOME="${PWHOME:-/home/$USER}" \
-			--name faucetd \
-            --exec /usr/bin/screen -- \
-				-L -Logfile /home/faucetd/screenlog.0 \
-				-d -m -S faucetd /usr/local/bin/faucetd
-	eend $?
-}
-
-stop() {
-	ebegin "Stopping faucetd"
-	# 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/faucetd.pid) > /var/run/faucetd.pid
-
-	start-stop-daemon --stop --signal 15 \
-		--pidfile /var/run/faucetd.pid
-	eend $?
-}

+ 0 - 1
contrib/init/lilith.confd

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

+ 0 - 37
contrib/init/lilith.initd

@@ -1,37 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2023 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 lilith"
-	env TERM="xterm" DARKFI_LOG="/tmp/lilith.log" LOG_TARGETS="!MessageSubsystem::notify" \
-		start-stop-daemon \
-			--start \
-			--make-pidfile \
-			--pidfile /var/run/lilith.pid \
-			--background \
-			--user $USER \
-			--env HOME="${PWHOME:-/home/$USER}" \
-			--name lilith \
-			--exec /usr/bin/screen -- \
-				    -L -Logfile /home/lilith/screenlog.0 \
-				    -d -m -S lilith /usr/local/bin/lilith
-	eend $?
-}
-
-stop() {
-	ebegin "Stopping lilith"
-	# 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/lilith.pid) > /var/run/lilith.pid
-
-	start-stop-daemon --stop --signal 15 \
-		--pidfile /var/run/lilith.pid
-	eend $?
-}

+ 5 - 0
contrib/init/openrc/README.md

@@ -0,0 +1,5 @@
+# OpenRC service files
+
+These init files can be used with OpenRC.
+
+They should be applicable for any daemon, just modify the names.

+ 13 - 0
contrib/init/openrc/darkfid.init

@@ -0,0 +1,13 @@
+#!/sbin/openrc-run
+# Distributed under the terms of the GNU General Public License v2
+
+description="darkfid daemon"
+
+command="/usr/bin/darkfid"
+command_background=true
+command_user="${USER}"
+pidfile="/run/darkfid.pid"
+
+depend() {
+	use net
+}

+ 0 - 1
contrib/runit-init/README.md → contrib/init/runit/README.md

@@ -62,4 +62,3 @@ the logger command. You can test logger output like this:
 ```bash
     $ vlogger -t darky -p daemon hello123
 ```
-

+ 0 - 0
contrib/runit-init/darkirc/log/run → contrib/init/runit/darkirc/log/run


+ 0 - 0
contrib/runit-init/darkirc/run → contrib/init/runit/darkirc/run


+ 0 - 0
contrib/runit-init/taud/log/run → contrib/init/runit/taud/log/run


+ 0 - 0
contrib/runit-init/taud/run → contrib/init/runit/taud/run


+ 0 - 1
contrib/init/taud.confd

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

+ 0 - 37
contrib/init/taud.initd

@@ -1,37 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2023 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 -- \
-				    -L -Logfile /home/taud/screenlog.0 \
-				    -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 $?
-}

+ 0 - 1
contrib/init/wikid.confd

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

+ 0 - 37
contrib/init/wikid.initd

@@ -1,37 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2023 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 darkwikid"
-	env TERM="xterm" \
-		start-stop-daemon \
-			--start \
-			--make-pidfile \
-			--pidfile /var/run/darkwikid.pid \
-			--background \
-			--user $USER \
-			--env HOME="${PWHOME:-/home/$USER}" \
-			--name darkwikid \
-			--exec /usr/bin/screen -- \
-				    -L -Logfile /home/wiki/screenlog.0 \
-				    -d -m -S darkwikid /usr/local/bin/darkwikid
-	eend $?
-}
-
-stop() {
-	ebegin "Stopping darkwikid"
-	# 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/darkwikid.pid) > /var/run/darkwikid.pid
-
-	start-stop-daemon --stop --signal 15 \
-		--pidfile /var/run/darkwikid.pid
-	eend $?
-}

+ 1 - 1
contrib/license.header

@@ -1,6 +1,6 @@
 /* This file is part of DarkFi (https://dark.fi)
  *
- * Copyright (C) 2020-2025 Dyne.org foundation
+ * Copyright (C) 2020-2026 Dyne.org foundation
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as