def init(): """Initialization , all begin from here """ su() args = sys.argv args.pop(0) cmd = "/etc/rc.d/rc.sun" if len(args) == 1: if args[0] == "start": subprocess.call("{0} {1}".format(cmd, "start"), shell=True) elif args[0] == "stop": subprocess.call("{0} {1}".format(cmd, "stop"), shell=True) elif args[0] == "restart": subprocess.call("{0} {1}".format(cmd, "restart"), shell=True) elif args[0] == "check": message, count, packages = check_updates() if count > 0: print(message) for pkg in packages: print("{0}".format(pkg)) else: print(message) elif args[0] == "status": print(daemon_status()) elif args[0] == "help": usage() elif args[0] == "info": print(os_info()) else: print("try: 'sun help'") elif len(args) == 2 and args[0] == "start" and args[1] == "--gtk": subprocess.call("{0} {1}".format(cmd, "start--gtk"), shell=True) else: print("try: 'sun help'")
def init(): """Initialization , all begin from here """ su() args = sys.argv args.pop(0) cmd = "{0}sun_daemon".format(bin_path) if len(args) == 1: if args[0] == "start": print("Starting SUN daemon: {0} &".format(cmd)) subprocess.call("{0} &".format(cmd), shell=True) elif args[0] == "stop": print("Stopping SUN daemon: {0}".format(cmd)) subprocess.call("killall sun_daemon", shell=True) elif args[0] == "restart": print("Stopping SUN daemon: {0}".format(cmd)) subprocess.call("killall sun_daemon", shell=True) print("Starting SUN daemon: {0} &".format(cmd)) subprocess.call("{0} &".format(cmd), shell=True) elif args[0] == "check": _init_check_upodates() elif args[0] == "status": print(daemon_status()) elif args[0] == "help": usage() elif args[0] == "info": print(os_info()) else: print("try: 'sun help'") elif len(args) == 2 and args[0] == "start" and args[1] == "--gtk": subprocess.call("{0} {1}".format(cmd, "start--gtk"), shell=True) else: print("try: 'sun help'")
def _Info(self, data): self.dialog_title = "SUN - " + data self.message(os_info())