Source: debpool
Severity: minor
Tags: patch

Here's a patch that will have debpool check for Proc::Daemon. If it
doesn't exist, debpool will print an error message, log it, and exit.
--- debpool_released/bin/debpool	2007-12-03 14:10:49.000000000 -0500
+++ debpool/bin/debpool	2007-12-09 23:18:42.000000000 -0500
@@ -98,12 +98,16 @@
 # and if so, whether we can manage to pull it off.
 
 if ($Options{'daemon'}) {
-    Log_Message("Trying to enter daemon mode.", LOG_GENERAL, LOG_DEBUG);
+    Log_Message("Trying to enter daemon mode.", LOG_GENERAL, LOG_INFO);
 
-    require Proc::Daemon;
-    Proc::Daemon::Init();
-
-    Log_Message("Now running as a daemon.", LOG_GENERAL, LOG_DEBUG);
+    if (eval{ require Proc::Daemon; }) {
+        Proc::Daemon::Init();
+        Log_Message("Now running as a daemon.", LOG_GENERAL, LOG_INFO);
+    } else {
+        print "ERROR: Running as a daemon requires installation of libproc-daemon-perl.\n";
+        Log_Message("Running as a daemon requires installation of libproc-daemon-perl.", LOG_GENERAL, LOG_ERROR);
+        exit 1;
+    }
 }
 
 # Create the directory tree. This is clean even it it already exists,

Reply via email to