diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-01-17 00:29:28 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-01-17 00:29:28 +0000 |
commit | 5de7651ebeee56e6deca4d5e357b22869719bb8f (patch) | |
tree | 35dfa806556becd8190a6e891d2434dc7caf7c21 /make/template/inspircd | |
parent | 54242e2c5839c5493a344badb49cbcb76e298f9f (diff) |
Make a ./configure --system to support system-wide installation of inspircd
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12275 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'make/template/inspircd')
-rw-r--r-- | make/template/inspircd | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/make/template/inspircd b/make/template/inspircd index 6a74d1ec1..92f3f3bac 100644 --- a/make/template/inspircd +++ b/make/template/inspircd @@ -22,6 +22,23 @@ my $runpath = "@BASE_DIR@"; my $valgrindlogpath = "$basepath/valgrindlogs"; my $executable = "@EXECUTABLE@"; my $version = "@VERSION@"; +my $uid = "@UID@"; + +if ($< == 0 || $> == 0) { + if ($uid !~ /^\d+$/) { + # Named UID, look it up + $uid = getpwnam $uid; + } + if (!$uid) { + die "Cannot find a valid UID to change to"; + } + # drop root if we were configured with an ircd UID + $< = $uid; + $> = $uid; + if ($< == 0 || $> == 0) { + die "Could not drop root: $!"; + } +} our($pid,$pidfile); # Lets see what they want to do.. Set the variable (Cause i'm a lazy coder) |