X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=make%2Ftemplate%2Finspircd;h=139177100a9f46a7245420a74dda9b1ec05179fa;hb=414d9f0b30542d9b90fcea4e8345b012050b7de7;hp=1b9f25a866b49731003848d081352816fe579fdd;hpb=dd49cf696c14c1189efa9eca5318b856a804c985;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/make/template/inspircd b/make/template/inspircd index 1b9f25a86..139177100 100644 --- a/make/template/inspircd +++ b/make/template/inspircd @@ -1,16 +1,24 @@ #!/usr/bin/env perl -# +------------------------------------+ -# | Inspire Internet Relay Chat Daemon | -# +------------------------------------+ + +# +# InspIRCd -- Internet Relay Chat Daemon +# +# Copyright (C) 2009-2010 Daniel De Graaf # -# InspIRCd: (C) 2002-2010 InspIRCd Development Team -# See: http://wiki.inspircd.org/Credits +# 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 free but copyrighted software; see -# the file COPYING for details. +# 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 . # + + use strict; use POSIX; use Fcntl; @@ -19,12 +27,13 @@ my $basepath = "@BASE_DIR@"; my $confpath = "@CONFIG_DIR@/"; my $binpath = "@BINARY_DIR@"; my $runpath = "@BASE_DIR@"; +my $datadir = "@DATA_DIR@"; my $valgrindlogpath = "$basepath/valgrindlogs"; my $executable = "@EXECUTABLE@"; my $version = "@VERSION@"; my $uid = "@UID@"; -if ($< == 0 || $> == 0) { +if (!("--runasroot" ~~ @ARGV) && ($< == 0 || $> == 0)) { if ($uid !~ /^\d+$/) { # Named UID, look it up $uid = getpwnam $uid; @@ -374,13 +383,13 @@ sub getpidfile } # End of includes / No includes found. Using default. - $pidfile = $runpath . "/data/inspircd.pid"; + $pidfile = $datadir . "/inspircd.pid"; } sub getstatus { my $pid = getprocessid(); return 0 if $pid == 0; - return kill 0, $1; + return kill 0, $pid; } @@ -389,7 +398,7 @@ sub getprocessid { open PIDFILE, '<', $pidfile or return 0; while() { - /(\d+)/ and $pid = $1; + /^(\d+)$/ and $pid = $1; } close PIDFILE; return $pid;