aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Sadie Powell2025-06-13 09:44:40 +0100
committerGravatar Sadie Powell2025-06-13 10:57:36 +0100
commitf45d31f950ef0540bfc81ad53cecb6d4037ba630 (patch)
tree2006e4ec4b21aa5dd31507351ed58ed06c3fd6da
parentThe macOS init script should be installed as a text file. (diff)
Add an OpenRC init script.
-rw-r--r--make/template/inspircd.openrc56
-rw-r--r--make/template/main.mk2
2 files changed, 58 insertions, 0 deletions
diff --git a/make/template/inspircd.openrc b/make/template/inspircd.openrc
new file mode 100644
index 000000000..8f755bb91
--- /dev/null
+++ b/make/template/inspircd.openrc
@@ -0,0 +1,56 @@
+%mode 0750
+%platform linux
+#!/sbin/openrc-run
+#
+# InspIRCd -- Internet Relay Chat Daemon
+#
+# Copyright (C) 2025 Sadie Powell <sadie@witchery.services>
+#
+# This file is part of InspIRCd. InspIRCd is free software: you can
+# redistribute it and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation, version 2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+name=$RC_SVCNAME
+description="InspIRCd - Internet Relay Chat Daemon"
+
+command="@BINARY_DIR@/inspircd"
+command_args="--nofork --nopid"
+command_user="@USER@:@GROUP@"
+pidfile="@RUNTIME_DIR@/${RC_SVCNAME}.pid"
+supervisor="supervise-daemon"
+
+extra_commands="version"
+extra_started_commands="reload sslreload"
+
+depend() {
+ need net
+ use dns netmount
+ provide ircd
+}
+
+reload() {
+ ebegin "Reloading ${RC_SVCNAME} configuration"
+ ${supervisor} ${RC_SVCNAME} --signal HUP --pidfile "${pidfile}"
+ eend $?
+}
+
+sslreload() {
+ ebegin "Reloading ${RC_SVCNAME} SSL profiles"
+ ${supervisor} ${RC_SVCNAME} --signal USR1 --pidfile "${pidfile}"
+ eend $?
+}
+
+version() {
+ ebegin "Print ${RC_SVCNAME} version"
+ ${command} --version
+ eend $?
+}
diff --git a/make/template/main.mk b/make/template/main.mk
index 3d4dd71db..8bc24a513 100644
--- a/make/template/main.mk
+++ b/make/template/main.mk
@@ -275,6 +275,7 @@ ifeq ($(SYSTEM), darwin)
-$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/org.inspircd.plist $(SCRPATH) 2>/dev/null
endif
ifeq ($(SYSTEM), linux)
+ -$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/inspircd.openrc $(SCRPATH) 2>/dev/null
-$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd.service $(SCRPATH) 2>/dev/null
endif
-$(INSTALL) $(INSTFLAGS) -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/inspircd.1 $(MANPATH) 2>/dev/null
@@ -326,6 +327,7 @@ deinstall:
-rm -f $(MODPATH)/m_*.$(DLLEXT)
-rm -f $(SCRPATH)/apparmor
-rm -f $(SCRPATH)/inspircd
+ -rm -f $(SCRPATH)/inspircd.openrc
-rm -f $(SCRPATH)/inspircd.service
-rm -f $(SCRPATH)/logrotate
-rm -f $(SCRPATH)/org.inspircd.plist