summaryrefslogtreecommitdiff
path: root/make
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-01-18 06:56:18 +0000
committerSadie Powell <sadie@witchery.services>2021-01-18 07:05:27 +0000
commita59ed4b39443eb788c15c65501898ca374387e2e (patch)
treea20c0bee867288e956d171ed733b3c7747c2a316 /make
parent8b2f3980cc8e5bfb0153981b5ca6b08ca39392c2 (diff)
Add a new runtime directory and move the pid file to it.
The data directory is intended for persistent files whereas the pid file is ephemeral. This distinction doesn't matter by default but on system-wide installs ephemeral runtime files go in /var/run or /run instead.
Diffstat (limited to 'make')
-rw-r--r--make/configure.pm1
-rw-r--r--make/template/apparmor1
-rw-r--r--make/template/config.h3
-rw-r--r--make/template/inspircd18
4 files changed, 8 insertions, 15 deletions
diff --git a/make/configure.pm b/make/configure.pm
index 91e2cc7d6..001de5fc7 100644
--- a/make/configure.pm
+++ b/make/configure.pm
@@ -192,6 +192,7 @@ sub cmd_update {
say 'Updating...';
my %config = read_config_file(CONFIGURE_CACHE_FILE);
$config{EXAMPLE_DIR} //= catdir $config{CONFIG_DIR}, 'examples';
+ $config{RUNTIME_DIR} //= $config{DATA_DIR};
my %compiler = get_compiler_info($config{CXX});
my %version = get_version $config{DISTRIBUTION};
parse_templates(\%config, \%compiler, \%version);
diff --git a/make/template/apparmor b/make/template/apparmor
index 83c248c55..ded5634e6 100644
--- a/make/template/apparmor
+++ b/make/template/apparmor
@@ -37,6 +37,7 @@
@MODULE_DIR@/core_*.so mr,
@MODULE_DIR@/m_*.so mr,
@LOG_DIR@/** w,
+ @RUNTIME_DIR@/** rw,
# Required by the ldap module:
#include <abstractions/ldapclient>
diff --git a/make/template/config.h b/make/template/config.h
index 034191893..97dd15453 100644
--- a/make/template/config.h
+++ b/make/template/config.h
@@ -43,6 +43,9 @@
/** The default location that module files are stored in. */
#define INSPIRCD_MODULE_PATH "@MODULE_DIR@"
+/** The default location that runtime files are stored in. */
+#define INSPIRCD_RUNTIME_PATH "@RUNTIME_DIR@"
+
/** The URL of the InspIRCd docs site. */
#define INSPIRCD_DOCS "https://docs.inspircd.org/@VERSION_MAJOR@/"
diff --git a/make/template/inspircd b/make/template/inspircd
index 0150bb994..4b316e0e0 100644
--- a/make/template/inspircd
+++ b/make/template/inspircd
@@ -66,7 +66,7 @@ my $basepath = "@BASE_DIR@";
my $confpath = "@CONFIG_DIR@";
my $binpath = "@BINARY_DIR@";
my $runpath = "@BASE_DIR@";
-my $datadir = "@DATA_DIR@";
+my $runtimedir = "@RUNTIME_DIR@";
my $valgrindlogpath = "$basepath/valgrindlogs";
my $executable = "inspircd";
my $version = "@VERSION_FULL@";
@@ -359,18 +359,6 @@ sub cmd_stop()
# Generic Helper Functions.
###
-# GetPidfile Version 2 - Now With Include Support..
-# I beg for months for include support in insp, then..
-# when it is added, it comes around and BITES ME IN THE ASS,
-# because i then have to code support into this script.. Evil.
-
-# Craig got bitten in the ass again --
-# in 1.1 beta the include file is manditory, therefore
-# if we cant find it, default to %conf%/inspircd.pid.
-# Note, this also contains a fix for when the pid file is
-# defined, but defined in a comment (line starts with #)
-# -- Brain
-
my %filesparsed;
sub getpidfile
@@ -404,7 +392,7 @@ sub getpidfile
if (($i =~ /<pid file=\"(\S+)\">/i) && ($i !~ /^#/))
{
# Set the PID file and return.
- $pidfile = expand_fragment $datadir, $1;
+ $pidfile = expand_fragment $runtimedir, $1;
return;
}
}
@@ -426,7 +414,7 @@ sub getpidfile
}
# End of includes / No includes found. Using default.
- $pidfile = $datadir . "/inspircd.pid";
+ $pidfile = $runtimedir . "/inspircd.pid";
}
sub getstatus {