X-Git-Url: https://git.camperquake.de/gitweb.cgi?p=time-slider.git;a=blobdiff_plain;f=usr%2Fshare%2Ftime-slider%2Flib%2Ftime_slider%2Ftimesliderd.py;h=08a2937873dc5a4ffc67140ef2a68ba68951f922;hp=de4740547f8594f70bc085100f01c8e9a5749b79;hb=6980e994fb5bdd6a257522e2a01ffddc264e0bf4;hpb=f4594ed407bba1263b2bc93ce70e27a599e2ed3c diff --git a/usr/share/time-slider/lib/time_slider/timesliderd.py b/usr/share/time-slider/lib/time_slider/timesliderd.py index de47405..08a2937 100755 --- a/usr/share/time-slider/lib/time_slider/timesliderd.py +++ b/usr/share/time-slider/lib/time_slider/timesliderd.py @@ -31,6 +31,7 @@ import time import datetime import calendar import signal +import argparse import glib import gobject @@ -928,15 +929,13 @@ def create_daemon(): def main(argv): - # Check SMF invocation environment - if os.getenv("SMF_FMRI") == None or os.getenv("SMF_METHOD") != "start": - sys.stderr.write("Command line invocation of %s unsupported.\n" \ - % (sys.argv[0])) - sys.stderr.write("This command is intended for smf(5) invocation only.\n") - sys.exit(smf.SMF_EXIT_ERR_NOSMF) + parser = argparse.ArgumentParser() + parser.add_argument('--foreground', action='store_true', help='Do not daemonize', default=False) + args, _ = parser.parse_known_args() # Daemonise the service. - create_daemon() + if not args.foreground: + create_daemon() # The user security attributes checked are the following: # Note that UID == 0 will match any profile search so