In previous mail incorrect plain patch was attached (one from #451949)
Sending correct one.
                        Pavel

P.S Sorry for incorrect version of mini-dinstall, it's upstream with
this patch
commit 6463dcd967d8f1e55a3d856e31d9fcb294772d97
Author: Pavel Shramov <[EMAIL PROTECTED]>
Date:   Sun Nov 11 13:32:16 2007 +0300

    add --foreground option

diff --git a/mini-dinstall b/mini-dinstall
index 6abada6..0a871d9 100755
--- a/mini-dinstall
+++ b/mini-dinstall
@@ -80,6 +80,7 @@ def usage(ecode, ver_only=None):
     print "  -q, --quiet\t\tDisplay less information"
     print "  -c, --config=FILE\tParse configuration info from FILE"
     print "  -d, --debug\t\tOutput information to stdout as well as log"
+    print "  -f, --foreground\tRun daemon in foreground"
     print "  --no-log\t\tDon't write information to log file"
     print "  -n, --no-act\t\tDon't actually perform changes"
     print "  -b, --batch\t\tDon't daemonize; run once, then exit"
@@ -90,8 +91,8 @@ def usage(ecode, ver_only=None):
     sys.exit(ecode)
 
 try:
-    opts, args = getopt.getopt(sys.argv[1:], 'vqc:dnbrk',
-                               ['verbose', 'quiet', 'config=', 'debug', 'no-log',
+    opts, args = getopt.getopt(sys.argv[1:], 'vqc:dfnbrk',
+                               ['verbose', 'quiet', 'config=', 'debug', 'foreground', 'no-log',
                                 'no-act', 'batch', 'run', 'kill', 'help', 'version', ])
 except getopt.GetoptError, e:
     sys.stderr.write("Error reading arguments: %s\n" % e)
@@ -117,6 +118,7 @@ run_mode = 0
 kill_mode = 0
 no_log = 0
 batch_mode = 0
+foreground_mode = 0
 custom_config_files = 0
 for key, val in opts:
     if key in ('-v', '--verbose'):
@@ -142,6 +144,8 @@ for key, val in opts:
         no_log = 1
     elif key in ('-b', '--batch'):
         batch_mode = 1
+    elif key in ('-f', '--foreground'):
+        foreground_mode = 1
     elif key in ('-r', '--run'):
         run_mode = 1
     elif key in ('-k', '--kill'):
@@ -1479,7 +1483,7 @@ if not no_act:
     lockfile = open(lockfilename, 'w')
     lockfile.close()
 
-if not batch_mode:
+if not batch_mode and not foreground_mode:
     # daemonize
     logger.debug("Daemonizing...")
     if os.fork() == 0:
@@ -1500,6 +1504,9 @@ if not batch_mode:
     sys.stderr = open("/dev/null")
     logger.debug("Finished daemonizing (pid %s)" % (os.getpid(),))
 
+if foreground_mode:
+    logger.debug("Running in foreground...")
+
 lockfile = open(lockfilename, 'w')
 lockfile.write("%s" % (os.getpid(),))
 lockfile.close()

Reply via email to