]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Move the init scripts out of the prefix into the new script dir.
authorPeter Powell <petpow@saberuk.com>
Thu, 21 Sep 2017 17:44:29 +0000 (18:44 +0100)
committerPeter Powell <petpow@saberuk.com>
Thu, 21 Sep 2017 19:49:49 +0000 (20:49 +0100)
The previous directory was okay for home directory installs but
was problematic for system wide installs.

configure
make/configure.pm
make/template/inspircd
make/template/inspircd.service
make/template/main.mk

index ca2e2f19ba6a2596a430077de263aff6ccced1df..c1052dff94da1f5d84487211536880e53876bbc2 100755 (executable)
--- a/configure
+++ b/configure
@@ -59,6 +59,7 @@ my ($opt_binary_dir,
     $opt_manual_dir,
     $opt_module_dir,
     $opt_prefix,
+    $opt_script_dir,
     $opt_socketengine,
     $opt_system,
     $opt_uid);
@@ -88,6 +89,7 @@ GetOptions(
        'manual-dir=s'         => \$opt_manual_dir,
        'module-dir=s'         => \$opt_module_dir,
        'prefix=s'             => \$opt_prefix,
+       'script-dir=s'         => \$opt_script_dir,
        'socketengine=s'       => \$opt_socketengine,
        'system'               => \$opt_system,
        'uid=s'                => \$opt_uid,
@@ -122,6 +124,7 @@ our $interactive = !(
        defined $opt_manual_dir ||
        defined $opt_module_dir ||
        defined $opt_prefix ||
+       defined $opt_script_dir ||
        defined $opt_socketengine ||
        defined $opt_system ||
        defined $opt_uid
@@ -184,6 +187,7 @@ if (defined $opt_system) {
        $config{LOG_DIR}    = $opt_module_dir // '/var/log/inspircd';
        $config{MANUAL_DIR} = $opt_manual_dir // '/usr/share/man/man1';
        $config{MODULE_DIR} = $opt_module_dir // '/usr/lib/inspircd';
+       $config{SCRIPT_DIR} = $opt_script_dir // '/usr/share/inspircd'
 } else {
        $config{BASE_DIR}   = $opt_prefix     // $config{BASE_DIR}   // rel2abs 'run';
        $config{BINARY_DIR} = $opt_binary_dir // $config{BINARY_DIR} // rel2abs $config{BASE_DIR} . '/bin';
@@ -192,6 +196,7 @@ if (defined $opt_system) {
        $config{LOG_DIR}    = $opt_log_dir    // $config{LOG_DIR}    // rel2abs $config{BASE_DIR} . '/logs';
        $config{MANUAL_DIR} = $opt_manual_dir // $config{MANUAL_DIR} // rel2abs $config{BASE_DIR} . '/manuals';
        $config{MODULE_DIR} = $opt_module_dir // $config{MODULE_DIR} // rel2abs $config{BASE_DIR} . '/modules';
+       $config{SCRIPT_DIR} = $opt_script_dir // $config{SCRIPT_DIR} // $config{BASE_DIR};
 }
 
 # Parse --gid=123 or --gid=foo and extract the group id.
@@ -334,6 +339,7 @@ print_format <<"EOM";
   <|GREEN Log:|>    $config{LOG_DIR}
   <|GREEN Manual:|> $config{MANUAL_DIR}
   <|GREEN Module:|> $config{MODULE_DIR}
+  <|GREEN Script:|> $config{SCRIPT_DIR}
 
 <|GREEN Execution Group:|> $config{GROUP} ($config{GID})
 <|GREEN Execution User:|>  $config{USER} ($config{UID})
index dfdbf5f75d680b7ab8e0669b154b8fd60849f588..82d14f5649d7f0f847de376bf8c3cbcc3bed68b5 100644 (file)
@@ -139,6 +139,9 @@ PATH OPTIONS
   --module-dir=[dir]            The location where the loadable modules are
                                 stored.
                                 [$PWD/run/modules]
+  --script-dir=[dir]            The location where the scripts, such as the
+                                init scripts, are stored.
+                                [$PWD/run]
 
 EXTRA MODULE OPTIONS
 
index 949f85ceef845e3cc5b3583025bcec539b0a5455..2ea0a54927277cc11b16262ff45c8d4c2b82c636 100644 (file)
@@ -48,6 +48,7 @@ use constant {
     GENERIC_EXIT_NOT_RUNNING => 7
 };
 
+my $scriptpath = "@SCRIPT_DIR@"
 my $basepath   =       "@BASE_DIR@";
 my $confpath   =       "@CONFIG_DIR@/";
 my $binpath    =       "@BINARY_DIR@";
@@ -203,7 +204,7 @@ sub dev_debug(@)
        checkgdb();
 
        # If we are still alive here.. Try starting the IRCd..
-       exec 'gdb', "--command=$basepath/.gdbargs", '--args', "$binpath/$executable", qw(--nofork --debug), @_;
+       exec 'gdb', "--command=$scriptpath/.gdbargs", '--args', "$binpath/$executable", qw(--nofork --debug), @_;
        die "Failed to start GDB: $!\n";
 }
 
@@ -222,7 +223,7 @@ sub dev_screendebug(@)
        # If we are still alive here.. Try starting the IRCd..
        print "Starting InspIRCd in `screen`, type `screen -r` when the ircd crashes to view the gdb output and get a backtrace.\n";
        print "Once you're inside the screen session press ^C + d to re-detach from the session\n";
-       exec qw(screen -m -d gdb), "--command=$basepath/.gdbargs", '-args', "$binpath/$executable", qw(--nofork --debug --nolog), @_;
+       exec qw(screen -m -d gdb), "--command=$scriptpath/.gdbargs", '-args', "$binpath/$executable", qw(--nofork --debug --nolog), @_;
        die "Failed to start screen: $!\n";
 }
 
index e5f28a674cda6ffeb6a1c853401bdaeda8797db9..c05e618226dcfb88facfd65aa38b76438197547f 100644 (file)
@@ -24,9 +24,9 @@ Description=InspIRCd - Internet Relay Chat Daemon
 Requires=network.target
 
 [Service]
-ExecReload=@BASE_DIR@/inspircd rehash
-ExecStart=@BASE_DIR@/inspircd start
-ExecStop=@BASE_DIR@/inspircd stop
+ExecReload=@SCRIPT_DIR@/inspircd rehash
+ExecStart=@SCRIPT_DIR@/inspircd start
+ExecStop=@SCRIPT_DIR@/inspircd stop
 PIDFile=@DATA_DIR@/inspircd.pid
 Restart=on-failure
 Type=forking
index 49c77da0555f53a2710dfbe7385ab2367e0fd24b..ff464a2283f996140296b7e756691b2cb340db0b 100644 (file)
@@ -45,6 +45,7 @@ MODPATH = "$(DESTDIR)@MODULE_DIR@"
 LOGPATH = "$(DESTDIR)@LOG_DIR@"
 DATPATH = "$(DESTDIR)@DATA_DIR@"
 BINPATH = "$(DESTDIR)@BINARY_DIR@"
+SCRPATH = "$(DESTDIR)@SCRIPT_DIR@"
 INSTALL = install
 INSTUID = @UID@
 INSTMODE_DIR = 0750
@@ -224,17 +225,18 @@ install: target
        @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/services
        @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MANPATH)
        @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MODPATH)
+       @-$(INSTALL) -d -m $(INSTMODE_DIR) $(SCRPATH)
        [ "$(BUILDPATH)/bin/" -ef $(BINPATH) ] || $(INSTALL) -m $(INSTMODE_BIN) "$(BUILDPATH)/bin/inspircd" $(BINPATH)
 ifndef INSPIRCD_STATIC
        [ "$(BUILDPATH)/modules/" -ef $(MODPATH) ] || $(INSTALL) -m $(INSTMODE_LIB) "$(BUILDPATH)/modules/"*.so $(MODPATH)
 endif
-       -$(INSTALL) -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/inspircd $(BASE) 2>/dev/null
-       -$(INSTALL) -m $(INSTMODE_LIB) .gdbargs $(BASE)/.gdbargs 2>/dev/null
+       -$(INSTALL) -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/inspircd $(SCRPATH) 2>/dev/null
+       -$(INSTALL) -m $(INSTMODE_LIB) .gdbargs $(SCRPATH)/.gdbargs 2>/dev/null
 ifeq ($(SYSTEM), darwin)
-       -$(INSTALL) -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/org.inspircd.plist $(BASE) 2>/dev/null
+       -$(INSTALL) -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/org.inspircd.plist $(SCRPATH) 2>/dev/null
 endif
 ifeq ($(SYSTEM), linux)
-       -$(INSTALL) -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd.service $(BASE) 2>/dev/null
+       -$(INSTALL) -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd.service $(SCRPATH) 2>/dev/null
 endif
        -$(INSTALL) -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd.1 $(MANPATH) 2>/dev/null
        -$(INSTALL) -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd-genssl.1 $(MANPATH) 2>/dev/null
@@ -253,7 +255,7 @@ endif
        @echo '  Binaries:' $(BINPATH)
        @echo '  Modules:' $(MODPATH)
        @echo '  Data:' $(DATPATH)
-       @echo 'To start the ircd, run:' $(BASE)/inspircd start
+       @echo 'To start the ircd, run:' $(SCRPATH)/inspircd start
        @echo 'Remember to create your config file:' $(CONPATH)/inspircd.conf
        @echo 'Examples are available at:' $(CONPATH)/examples/
 
@@ -275,9 +277,9 @@ deinstall:
        -rm -f $(MANPATH)/inspircd-genssl.1
        -rm -f $(MODPATH)/m_*.so
        -rm -f $(MODPATH)/core_*.so
-       -rm -f $(BASE)/.gdbargs
-       -rm -f $(BASE)/inspircd.service
-       -rm -f $(BASE)/org.inspircd.plist
+       -rm -f $(SCRPATH)/.gdbargs
+       -rm -f $(SCRPATH)/inspircd.service
+       -rm -f $(SCRPATH)/org.inspircd.plist
 
 configureclean:
        rm -f .gdbargs