log_level = 'debug' elif o == '-s': quiet_mode = True if not log.set_level(log_level): usage() if not quiet_mode: utils.log_title(__title__, __version__) mod.lockInstance(__mod__, True) log_file = os.path.normpath('%s/hplip_queues.log'%prop.user_dir) log.debug(log.bold("Saving output in log file: %s" % log_file)) if os.path.exists(log_file): try: os.remove(log_file) except OSError: pass log.set_logfile(log_file) log.set_where(log.LOG_TO_CONSOLE_AND_FILE) passwordObj = password.Password(mode) queues.main_function(passwordObj, mode,ui_toolkit, quiet_mode ) except KeyboardInterrupt: log.error("User exit") mod.unlockInstance() log.debug("Done.")
if ignore_plugin_check is False and plugin > PLUGIN_NONE: from installer import pluginhandler pluginObj = pluginhandler.PluginHandle() plugin_sts = pluginObj.getStatus() if plugin_sts != pluginhandler.PLUGIN_INSTALLED: if plugin_sts == pluginhandler.PLUGIN_VERSION_MISMATCH: tui.header("UPDATING PLUGIN") else: tui.header("PLUG-IN INSTALLATION") hp_plugin = utils.which('hp-plugin') if hp_plugin: cmd = "hp-plugin -i" if os.getuid() != 0: from base import password PasswordObj = password.Password(INTERACTIVE_MODE) PasswordObj.clearPassword() log.info("Enter Password to install the plugin") cmd = PasswordObj.getAuthCmd() % cmd # su -c '%s' --> su -c 'hp-plugin -i' if os_utils.execute(cmd) != 0: log.error("Failed to install Plugin.") clean_exit(1) ppds = cups.getSystemPPDs() default_model = utils.xstrip( model.replace('series', '').replace('Series', ''), '_') installed_print_devices = device.getSupportedCUPSDevices(['hp'])
if utils.to_bool(sys_conf.get('configure', 'policy-kit')): try: obj = PolicyKit() su_sudo = "%s" need_sudo = False log.debug("Using PolicyKit for authentication") except dbus.DBusException, ex: log.error("PolicyKit NOT installed when configured for use. [%s]" % ex) if os.geteuid() == 0: su_sudo = "%s" need_sudo = False passwordObj = password.Password(Mode) if need_sudo: su_sudo = passwordObj.getAuthType() if su_sudo is None: log.error("Unable to find a suitable sudo command to run 'hp-plugin'") return (False, False) req = '--required' if not required: req = '--optional' if utils.which("hp-plugin"): p_path = "hp-plugin" else: p_path = "python ./plugin.py"