From f45d31f950ef0540bfc81ad53cecb6d4037ba630 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 13 Jun 2025 09:44:40 +0100 Subject: Add an OpenRC init script. --- make/template/inspircd.openrc | 56 +++++++++++++++++++++++++++++++++++++++++++ make/template/main.mk | 2 ++ 2 files changed, 58 insertions(+) create mode 100644 make/template/inspircd.openrc 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 +# +# 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 . +# + +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 -- cgit v1.3.1-10-gc9f91