def plugService(device, state, wireless=False): # Do nothing if ifplugd is missing if not os.path.exists("/usr/sbin/ifplugd"): return if state == "up": # Do nothing if device is missing if not netutils.IF(device): return # Load service configuration config = loadConfig("/etc/conf.d/ifplugd") # Get arguments if wireless: args = config.get("IFPLUGD_WLAN_ARGS", "") else: args = config.get("IFPLUGD_ARGS", "") # Start service startService(command="/usr/sbin/ifplugd", args="%s -i %s" % (args, device), pidfile="/run/ifplugd.%s.pid" % device, detach=True, donotify=False) else: # Stop service stopService(pidfile="/run/ifplugd.%s.pid" % device, donotify=False)
import sys import comar from comar.service import loadConfig config_files = ("/etc/default/xdm", "/etc/conf.d/xdm") xdm_path = "/usr/bin/xdm" safe_xorg_conf = "/usr/share/X11/xorg-safe.conf" if __name__ == "__main__": boot = "--boot" in sys.argv config = {} for config_file in config_files: cfg = loadConfig(config_file) config.update(cfg) dm_name = config.get("DISPLAY_MANAGER", "xdm") cursor_theme = config.get("XCURSOR_THEME") desktop_file = loadConfig("/usr/share/display-managers/%s.desktop" % dm_name) dm_path = desktop_file.get("Exec", xdm_path).split()[0] if cursor_theme is None: cursor_theme = desktop_file.get("X-Pardus-XCursorTheme") if not os.access(dm_path, os.X_OK): dm_path = xdm_path env = os.environ
import comar from comar.service import loadConfig config_files = ("/etc/default/xdm", "/etc/conf.d/xdm") xdm_path = "/usr/bin/xdm" safe_xorg_conf = "/usr/share/X11/xorg-safe.conf" if __name__ == "__main__": boot = "--boot" in sys.argv config = {} for config_file in config_files: cfg = loadConfig(config_file) config.update(cfg) dm_name = config.get("DISPLAY_MANAGER", "xdm") cursor_theme = config.get("XCURSOR_THEME") desktop_file = loadConfig("/usr/share/display-managers/%s.desktop" % dm_name) dm_path = desktop_file.get("Exec", xdm_path).split()[0] if cursor_theme is None: cursor_theme = desktop_file.get("X-Pardus-XCursorTheme") if not os.access(dm_path, os.X_OK): dm_path = xdm_path env = os.environ env["PATH"] = "/sbin:/usr/sbin:/bin:/usr/bin"