]> Sergey Matveev's repositories - public-inbox.git/commitdiff
daemon: document optional Net::Server dependency
authorEric Wong <e@80x24.org>
Sat, 5 Mar 2016 22:42:12 +0000 (22:42 +0000)
committerEric Wong <e@80x24.org>
Sat, 5 Mar 2016 22:42:35 +0000 (22:42 +0000)
Non-socket activation users will want to install Net::Server
for daemonization, pid file writing, and user/group switching.

INSTALL
lib/PublicInbox/Daemon.pm
t/httpd-unix.t

diff --git a/INSTALL b/INSTALL
index 54c344c7af1b486ab8191a8a592b6c814ed1378f..013e8d153c35d9f145449125945d1c7f1d7c5323 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -47,10 +47,11 @@ Optional modules:
   - DBI[3]                     libdbi-perl
   - DBD::SQLite[3]             libdbd-sqlite3-perl
   - Danga::Socket[4]           libdanga-socket-perl
+  - Net::Server[4]             libnet-server-perl
 
 [1] - Only required for serving/generating Atom and HTML pages.
-[3] - Optional for HTML web interface and NNTP server
-[4] - Optional for NNTP server
+[3] - Optional for HTML web interface and HTTP/NNTP servers
+[4] - Optional for HTTP and NNTP servers
 
 Copyright
 ---------
index 8a0af8de6a4a048ae9c3ae9c5644e663ad2700f4..51562624847852f56abeb4cab5c15f3ec0a88d6e 100644 (file)
@@ -94,7 +94,11 @@ sub daemonize () {
        return unless (defined $pid_file || defined $group || defined $user
                        || $daemonize);
 
-       require Net::Server::Daemonize;
+       eval { require Net::Server::Daemonize };
+       if ($@) {
+               die
+"Net::Server required for --pid-file, --group, --user, and --daemonize\n$@\n";
+       }
 
        Net::Server::Daemonize::check_pid_file($pid_file) if defined $pid_file;
        $uid = Net::Server::Daemonize::get_uid($user) if defined $user;
index 580d14d2abbf4cbd9d72aa69bdd2799e890a3355..b3368491b14bb892efa813e790999fff92155486 100644 (file)
@@ -81,7 +81,11 @@ check_sock($unix);
        is($?, 0, 'existing httpd exited successfully');
        ok(-S $unix, 'unix socket still exists');
 }
-{
+
+SKIP: {
+       eval 'require Net::Server::Daemonize';
+       skip('Net::Server missing for pid-file/daemonization test', 10) if $@;
+
        # wait for daemonization
        $spawn_httpd->("-l$unix", '-D', '-P', "$tmpdir/pid");
        my $kpid = $pid;