Add linux specific autosnapsmf module and dependencies
[time-slider.git] / usr / share / time-slider / lib / time_slider / timesliderd.py
index eb2e341..dc669b6 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.6
+#!/usr/bin/python2
 #
 # CDDL HEADER START
 #
@@ -31,6 +31,7 @@ import time
 import datetime
 import calendar
 import signal
+import argparse
 
 import glib
 import gobject
@@ -42,10 +43,10 @@ import dbus.mainloop.glib
 import dbussvc
 import zfs
 import smf
-import timeslidersmf
-import autosnapsmf
+import time_slider.linux.timeslidersmf as timeslidersmf
+import time_slider.linux.autosnapsmf as autosnapsmf
 import plugin
-from rbac import RBACprofile
+from time_slider.linux.rbac import RBACprofile
 import util
 
 _MINUTE = 60
@@ -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