Beispiel #1
0
    def __validatePlugin(self,plugin_file, digsig_file, req_checksum):
        calc_checksum = get_checksum(file(plugin_file, 'r').read())
        log.debug("D/L file checksum=%s" % calc_checksum)

        if req_checksum and req_checksum != calc_checksum:
            return PLUGIN_INSTALL_ERROR_PLUGIN_FILE_CHECKSUM_ERROR

        gpg = utils.which('gpg',True)
        if gpg:
            cmd = '%s --no-permission-warning --keyserver pgp.mit.edu --recv-keys 0xA59047B9' % gpg
            log.info("Receiving digital keys: %s" % cmd)
            status, output = utils.run(cmd)
            log.debug(output)

            if status != 0:
                return PLUGIN_INSTALL_ERROR_UNABLE_TO_RECV_KEYS

            cmd = '%s --no-permission-warning --verify %s %s' % (gpg, digsig_file, plugin_file)
            log.debug("Verifying plugin with digital keys: %s" % cmd)
            status, output = utils.run(cmd)
            log.debug(output)
            log.debug("%s status: %d" % (gpg, status))

            if status != 0:
                return PLUGIN_INSTALL_ERROR_DIGITAL_SIGN_BAD

        return PLUGIN_INSTALL_ERROR_NONE
Beispiel #2
0
    def NextButton_clicked(self):
        beginWaitCursor()
        try:
            if self.Error_msg ==  QUEUES_SMART_INSTALL_ENABLED:
                self.disable_smart_install()

            elif  self.Error_msg == QUEUES_PAUSED:
                cups.enablePrinter(self.printerName)
                msg ="'"+self.printerName+"' is enabled successfully"
                SuccessUI(self, self.__tr(msg))

            else:
                status, status_str = cups.cups_operation(cups.delPrinter, GUI_MODE, 'qt4', self, self.printerName)

                if status != cups.IPP_OK:
                    msg="Failed to remove ' "+self.printerName+" ' queue.\nRemove using hp-toolbox..."
                    FailureUI(self, self.__tr(msg))
                else:
                    msg="' "+self.printerName+" ' removed successfully.\nRe-configuring this printer by hp-setup..."
                    log.debug(msg)
                    path = utils.which('hp-setup')
                    if path:
                        log.debug("Starting hp-setup")
                        utils.run('hp-setup --gui')

        finally:
            endWaitCursor()
        self.result = True
        self.close()
Beispiel #3
0
    def disable_smart_install(self):
        if not utils.check_network_connection():
            FailureUI(self, queryString(ERROR_NO_NETWORK))
        else:
            sts, HPLIP_file = utils.download_from_network(HPLIP_INFO_SITE)
            if sts == 0:
                hplip_si_conf = ConfigBase(HPLIP_file)
                source = hplip_si_conf.get("SMART_INSTALL","url","")
                if not source :
                    FailureUI(self, queryString(ERROR_FAILED_TO_DOWNLOAD_FILE, 0, HPLIP_INFO_SITE))
                    return 

            response_file, smart_install_run = utils.download_from_network(source)
            response_asc, smart_install_asc = utils.download_from_network(source+'.asc')
            
            if response_file == 0   and response_asc == 0:

                gpg_obj = validation.GPG_Verification()
                digsig_sts, error_str = gpg_obj.validate(smart_install_run, smart_install_asc)

                if ERROR_SUCCESS == digsig_sts:
                    sts, out = utils.run("sh %s"%smart_install_run)
                else:
                
                    if QMessageBox.question(self, " ",
                        self.__tr("<b>%s</b><p>Without this, it is not possible to authenticate and validate this tool prior to installation.</p>Do you still want to run Smart Install disabler?" %error_str),
                                            QMessageBox.Yes | QMessageBox.No, QMessageBox.No) == QMessageBox.Yes:
                        # Disabling without verification.
                        sts, out = utils.run("sh %s"%smart_install_run)

            else:
                if response_asc:
                    FailureUI(self, queryString(ERROR_FAILED_TO_DOWNLOAD_FILE, 0, source + ".asc"))
                else:
                    FailureUI(self, queryString(ERROR_FAILED_TO_DOWNLOAD_FILE, 0, source))
Beispiel #4
0
    def disable_smart_install(self):
        if not utils.check_network_connection():
            FailureUI(self, queryString(ERROR_NO_NETWORK))
        else:
            sts, HPLIP_file = utils.download_from_network(HPLIP_INFO_SITE)
            if sts == 0:
                hplip_si_conf = ConfigBase(HPLIP_file)
                source = hplip_si_conf.get("SMART_INSTALL","url","")
                if not source :
                    FailureUI(self, queryString(ERROR_FAILED_TO_DOWNLOAD_FILE, 0, HPLIP_INFO_SITE))
                    return 

            response_file, smart_install_run = utils.download_from_network(source)
            response_asc, smart_install_asc = utils.download_from_network(source+'.asc')
            
            if response_file == 0   and response_asc == 0:

                gpg_obj = validation.GPG_Verification()
                digsig_sts, error_str = gpg_obj.validate(smart_install_run, smart_install_asc)

                if ERROR_SUCCESS == digsig_sts:
                    sts, out = utils.run("sh %s"%smart_install_run)
                else:
                
                    if QMessageBox.question(self, " ",
                        self.__tr("<b>%s</b><p>Without this, it is not possible to authenticate and validate this tool prior to installation.</p>Do you still want to run Smart Install disabler?" %error_str),
                        QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes:
                        # Disabling without verification.
                        sts, out = utils.run("sh %s"%smart_install_run)

            else:
                if response_asc:
                    FailureUI(self, queryString(ERROR_FAILED_TO_DOWNLOAD_FILE, 0, source + ".asc"))
                else:
                    FailureUI(self, queryString(ERROR_FAILED_TO_DOWNLOAD_FILE, 0, source))
Beispiel #5
0
def restore_loglevels():
    result = False
    cmd = 'cp -f %s %s' % (CUPS_BACKUP_FILE, CUPS_FILE)
    log.debug("Restoring CUPS conf file. cmd=%s" % cmd)
    sts, out = utils.run(cmd)
    if sts == 0:
        cmd = 'rm -f %s' % CUPS_BACKUP_FILE
        log.debug("Removing Temporary file.. cmd=%s" % cmd)
        sts, out = utils.run(cmd)
        if sts != 0:
            log.warn("Failed to remove the Temporary backup file=%s" %
                     CUPS_BACKUP_FILE)
    else:
        log.error("Failed to restore cups config file = %s" % CUPS_FILE)
    log.debug("Restarting CUPS service")

    cmd = None
    if utils.which('service'):
        cmd = os.path.join(utils.which('service'), 'service') + " cups restart"
    elif utils.which('systemctl'):
        cmd = os.path.join(utils.which('systemctl'),
                           'systemctl') + " restart %s.service" % service_name
    elif os.path.exists('/etc/init.d/cups'):
        cmd = "/etc/init.d/cups restart"
    else:
        log.error("service command not found.. Please restart cups manually..")

    if cmd:
        log.debug("CUPS restart cmd = %s" % cmd)
        sts, out = utils.run(cmd)
        if sts == 0:
            result = True

    return result
Beispiel #6
0
def backup_clearLog(strLog):
    if os.path.exists(strLog):
        iArch = 1
        while os.path.exists("%s.%d" % (strLog, iArch)) or os.path.exists(
                "%s.%d.gz" % (strLog, iArch)):
            iArch += 1
        sts, out = utils.run('cp %s %s.%d' % (strLog, strLog, iArch))
        if sts != 0:
            log.error("Failed to archive %s log file" % strLog)
        else:
            cmd = 'cat /dev/null > %s' % strLog
            sts = os_utils.execute(cmd)
            if sts != 0:
                log.warn("Failed to clear the %s log file" % strLog)
            if utils.which('gzip'):
                sts, out = utils.run('gzip %s.%d' % (strLog, iArch))
                if sts != 0:
                    log.info("Existing %s log file copied to %s.%d" %
                             (strLog, strLog, iArch))
                else:
                    log.info("Existing %s log file copied to %s.%d.gz" %
                             (strLog, strLog, iArch))
            else:
                log.info("Existing %s log file copied to %s.%d" %
                         (strLog, strLog, iArch))
Beispiel #7
0
    def NextButton_clicked(self):
        beginWaitCursor()
        try:
            if self.Error_msg == QUEUES_SMART_INSTALL_ENABLED:
                self.disable_smart_install()

            elif self.Error_msg == QUEUES_PAUSED:
                cups.enablePrinter(self.printerName)
                msg = "'" + self.printerName + "' is enabled successfully"
                SuccessUI(self, self.__tr(msg))

            else:
                status, status_str = cups.cups_operation(
                    cups.delPrinter, GUI_MODE, 'qt4', self, self.printerName)

                if status != cups.IPP_OK:
                    msg = "Failed to remove ' " + self.printerName + " ' queue.\nRemove using hp-toolbox..."
                    FailureUI(self, self.__tr(msg))
                else:
                    msg = "' " + self.printerName + " ' removed successfully.\nRe-configuring this printer by hp-setup..."
                    log.debug(msg)
                    path = utils.which('hp-setup')
                    if path:
                        log.debug("Starting hp-setup")
                        utils.run('hp-setup --gui')

        finally:
            endWaitCursor()
        self.result = True
        self.close()
Beispiel #8
0
def restore_loglevels():
    result = False
    cmd='cp -f %s %s'%(CUPS_BACKUP_FILE,CUPS_FILE)
    log.debug("Restoring CUPS conf file. cmd=%s"%cmd)
    sts, out = utils.run(cmd)
    if sts == 0:
       cmd='rm -f %s'%CUPS_BACKUP_FILE
       log.debug("Removing Temporary file.. cmd=%s"%cmd)
       sts,out = utils.run(cmd)
       if sts != 0:
            log.warn("Failed to remove the Temporary backup file=%s"%CUPS_BACKUP_FILE)
    else:
       log.error("Failed to restore cups config file = %s"%CUPS_FILE)
    log.debug("Restarting CUPS service")

    cmd=None
    if utils.which('service'):
       cmd = os.path.join(utils.which('service'), 'service')+" cups restart"
    elif utils.which('systemctl'):
       cmd = os.path.join(utils.which('systemctl'), 'systemctl')+" restart %s.service"%service_name
    elif os.path.exists('/etc/init.d/cups'):
       cmd = "/etc/init.d/cups restart"
    else:
       log.error("service command not found.. Please restart cups manually..")

    if cmd:
        log.debug("CUPS restart cmd = %s"%cmd)
        sts,out = utils.run(cmd)
        if sts == 0:
           result = True

    return result
Beispiel #9
0
    def validate(self,time_flag=DEPENDENCY_RUN_AND_COMPILE_TIME, is_quiet_mode= False):
        ############ Variables #######################
        cups_ddk_not_req = False
        hpmudext_avail = False
        ui_toolkit = sys_conf.get('configure','ui-toolkit')
        org_log_location = log.get_where()

        if is_quiet_mode:
            log.set_where(log.LOG_TO_FILE)

        IS_LIBUSB01_ENABLED = sys_conf.get('configure', 'libusb01-build', 'no')
        vrs =self.get_distro_data('versions_list')
        supported_distro_vrs= self.distro_version
        if self.distro_version not in vrs and len(vrs):
            supported_distro_vrs= vrs[len(vrs)-1]
            log.warn(log.bold("%s-%s version is not supported. Using %s-%s versions dependencies to verify and install..." \
                     %(self.distro_name, self.distro_version, self.distro_name, supported_distro_vrs)))
          
        tui.header("SYSTEM INFO")
        Sts, Kernel_info =utils.run("uname -r -v -o")
        Sts, Host_info =utils.run("uname -n")
        Sts, Proc_info =utils.run("uname -r -v -o")
        log.info(" Kernel: %s Host: %s Proc: %s Distribution: %s %s"\
             %(Kernel_info,Host_info,Proc_info,self.distro_name, self.distro_version))
        log.info(" Bitness: %s bit\n"%utils.getBitness())
        tui.header("HPLIP CONFIGURATION")
        v = sys_conf.get('hplip', 'version')
        if v:
            home = sys_conf.get('dirs', 'home')
            log.info("HPLIP-Version: HPLIP %s" %v)
            log.info("HPLIP-Home: %s" %home)
            if self.is_auto_installer_support():
                log.info("HPLIP-Installation: Auto installation is supported for %s distro  %s version " %(self.distro_name, self.distro_version))
            else:
                log.warn("HPLIP-Installation: Auto installation is not supported for %s distro  %s version " %(self.distro_name, self.distro_version))

            log.info()
            log.info(log.bold("Current contents of '/etc/hp/hplip.conf' file:"))
            try:
                output = file('/etc/hp/hplip.conf', 'r').read()
            except (IOError, OSError), e:
                log.error("Could not access file: %s. Check HPLIP installation." % e.strerror)
                self.num_errors += 1
            else:
                log.info(output)

            log.info()
            log.info(log.bold("Current contents of '/var/lib/hp/hplip.state' file:"))
            try:
                output = file(os.path.expanduser('/var/lib/hp/hplip.state'), 'r').read()
            except (IOError, OSError), e:
                log.info("Plugins are not installed. Could not access file: %s" % e.strerror)
Beispiel #10
0
def check_cups_process():
    cups_running_sts = False
    sts, output = utils.run('lpstat -r')
    if sts == 0 and ('is running' in output):
        cups_running_sts = True

    return cups_running_sts
Beispiel #11
0
def get_already_added_queues(udev_MDL, udev_serial_no, udev_back_end,
                             remove_non_hp_config):
    status, output = utils.run('lpstat -v')

    same_printer_queues = []
    for p in output.splitlines():
        try:
            match = LPSTAT_PAT.search(p)
            printer_name = match.group(1)
            device_uri = match.group(2)
            if device_uri.startswith("cups-pdf:/"):
                continue
            if not USB_PATTERN.search(device_uri):
                continue

            back_end = BACK_END_PATTERN.search(device_uri).group(1)
            serial = USB_PATTERN.search(device_uri).group(1)
            log.debug(
                "udev_serial_no[%s] serial[%s] udev_back_end[%s] back_end[%s]"
                % (udev_serial_no, serial, udev_back_end, back_end))
            if udev_serial_no == serial and (udev_back_end == back_end
                                             or back_end == 'usb'):
                if remove_non_hp_config and printer_name.find(
                        '_') == -1 and printer_name.find('-') != -1:
                    log.debug("Removed %s Queue" % printer_name)
                    # remove queues using cups API
                    cups.delPrinter(printer_name)
                else:
                    same_printer_queues.append(printer_name)

        except AttributeError:
            pass

    log.debug(same_printer_queues)
    return same_printer_queues
Beispiel #12
0
def start_systray():
    Systray_Is_Running = False
    status, output = utils.Is_Process_Running('hp-systray')
    if status is False:
        log.debug("hp-systray is not running.")
        if os.getuid() == 0:
            log.error("Run \'hp-systray &\' in a terminal. ")
        else:
            log.debug("Starting hp-systray service")
            child_pid = os.fork()
            if child_pid == 0:
                status, output = utils.run('hp-systray &', True, None, 1,
                                           False)
                if status is not 0:
                    log.error(
                        "Failed to start \'hp-systray\' service. Manually run \'hp-sysray &\' from terminal as non-root user."
                    )
                sys.exit()
            else:
                time.sleep(1)
                status, output = utils.Is_Process_Running('hp-systray')
                if status is True:
                    Systray_Is_Running = True
    else:
        Systray_Is_Running = True
        log.debug("hp-systray service is running\n")
    return Systray_Is_Running
Beispiel #13
0
def add_group(core):
    result = False
    add_user_to_group = core.get_distro_ver_data('add_user_to_group', '')
    if add_user_to_group:
        usermod = os.path.join(
            utils.which("usermod"),
            "usermod") + " %s %s" % (add_user_to_group, prop.username)
    else:
        usermod = os.path.join(utils.which("usermod"),
                               "usermod") + " %s %s" % ("-Glp", prop.username)

    su_sudo = utils.su_sudo()
    password_f = None
    if su_sudo is "su":
        name, version, is_su = utils.os_release()
        log.debug("name = %s version = %s is_su = %s" % (name, version, is_su))
        if (name == 'Fedora' and version >= '14' and is_su == True):
            #using su opening GUI apps fail in Fedora 14.
            #To run GUI apps as root, you need a root login shell (su -) in Fedora 14
            su_sudo = 'su - -c "%s"'
        else:
            su_sudo = 'su -c "%s"'

        password_f = "get_password_ui"
#        password_f = utils.get_password
    cmd = su_sudo % usermod
    log.info("cmd = %s" % cmd)
    #    sts, output = utils.run(cmd, True, password_f, -1,True,cmd)
    sts, output = utils.run(
        cmd, True, password_f, 1, True,
        "Please enter root/superuser password to add 'lp' group")
    if sts == 0:
        result = True

    return result
Beispiel #14
0
def install_firmware(pluginObj,Plugin_Installation_Completed, USB_param):
    #timeout check for plugin installation
    sleep_timeout = 6000	# 10 mins time out
    while Plugin_Installation_Completed is False and sleep_timeout != 0:
	time.sleep(0.3)	#0.3 sec delay
	sleep_timeout = sleep_timeout -3

	ps_plugin,output = utils.Is_Process_Running('hp-plugin')
	ps_diagnose_plugin,output = utils.Is_Process_Running('hp-diagnose_plugin')

        if ps_plugin is False and ps_diagnose_plugin is False:
            Plugin_Installation_Completed = True
            if pluginObj.getStatus() == PLUGIN_INSTALLED:
                break
            else:
                log.error("Failed to download firmware required files. manually run hp-plugin command in terminal fisrt")
                sys.exit(1)

    execmd="hp-firmware"
    options=""
    if USB_param is not None:
        options += " -y3 %s"%(USB_param)
    if log_level is 'debug':
        options += " -g"

    cmd= execmd + options
    log.info("Starting Firmware installation.")
    log.debug("Running command : %s " %cmd)
    Status, out=utils.run(cmd)
def start_systray():
    Systray_Is_Running = False
    status, output = utils.Is_Process_Running("hp-systray")
    if status is False:
        log.debug("hp-systray is not running.")
        if os.getuid() == 0:
            log.error("Run 'hp-systray &' in a terminal. ")
        else:
            log.debug("Starting hp-systray service")
            child_pid = os.fork()
            if child_pid == 0:
                status, output = utils.run("hp-systray &", True, None, 1, False)
                if status is not 0:
                    log.error(
                        "Failed to start 'hp-systray' service. Manually run 'hp-sysray &' from terminal as non-root user."
                    )
                sys.exit()
            else:
                time.sleep(1)
                status, output = utils.Is_Process_Running("hp-systray")
                if status is True:
                    Systray_Is_Running = True
    else:
        Systray_Is_Running = True
        log.debug("hp-systray service is running\n")
    return Systray_Is_Running
Beispiel #16
0
def install_firmware(pluginObj, Plugin_Installation_Completed, USB_param):
    #timeout check for plugin installation
    sleep_timeout = 6000  # 10 mins time out
    while Plugin_Installation_Completed is False and sleep_timeout != 0:
        time.sleep(0.3)  #0.3 sec delay
        sleep_timeout = sleep_timeout - 3

        ps_plugin, output = utils.Is_Process_Running('hp-plugin')
        ps_diagnose_plugin, output = utils.Is_Process_Running(
            'hp-diagnose_plugin')

        if ps_plugin is False and ps_diagnose_plugin is False:
            Plugin_Installation_Completed = True
            if pluginObj.getStatus() == PLUGIN_INSTALLED:
                break
            else:
                log.error(
                    "Failed to download firmware required files. manually run hp-plugin command in terminal fisrt"
                )
                sys.exit(1)

    execmd = "hp-firmware"
    options = ""
    if USB_param is not None:
        options += " -y3 %s" % (USB_param)
    if log_level is 'debug':
        options += " -g"

    cmd = execmd + options
    log.info("Starting Firmware installation.")
    log.debug("Running command : %s " % cmd)
    Status, out = utils.run(cmd)
Beispiel #17
0
def get_version(cmd, def_ver='-'):
    log.debug("Checking: %s" % (cmd))
    status, output = utils.run(cmd)

    if status != 0:
        log.debug("Not found!")
        return def_ver
    else:
        try:
            line = output.splitlines()[0]
        except IndexError:
            line = ''

        log.debug(line)
        match_obj = ver1_pat.search(line)
        try:
            ver = match_obj.group(1)
        except AttributeError:
            match_obj = ver_pat.search(line)
            try:
                ver = match_obj.group(1)
            except AttributeError:
                return def_ver
            else:
                return ver
        else:
            return ver
Beispiel #18
0
def check_cups_process():
    cups_running_sts = False
    sts, output = utils.run('lpstat -r')
    if sts == 0 and ('is running' in output):
        cups_running_sts = True
    
    return cups_running_sts
def check_cups_process():
    cups_running_sts = False
    sts, output = utils.run("lpstat -r")
    if sts == 0 and ("is running" in output):
        cups_running_sts = True

    return cups_running_sts
Beispiel #20
0
def update_ld_output():
    # For library checks
    global ld_output
    status, ld_output = utils.run('%s -p' % os.path.join(utils.which('ldconfig'), 'ldconfig'), log_output=False)

    if status != 0:
        log.debug("ldconfig failed.")
Beispiel #21
0
def add_group(core):
    result = False
    add_user_to_group = core.get_distro_ver_data('add_user_to_group', '')
    if add_user_to_group:
        usermod = os.path.join(utils.which("usermod"), "usermod") + " %s %s" % (add_user_to_group, prop.username)
    else:
        usermod = os.path.join(utils.which("usermod"), "usermod") + " %s %s" % ("-Glp", prop.username)

    su_sudo = utils.su_sudo()
    password_f = None
    if su_sudo is "su":
        name,version,is_su = utils.os_release()
        log.debug("name = %s version = %s is_su = %s" %(name,version,is_su))
        if ( name == 'Fedora' and version >= '14' and is_su == True):
           #using su opening GUI apps fail in Fedora 14. 
           #To run GUI apps as root, you need a root login shell (su -) in Fedora 14   
           su_sudo = 'su - -c "%s"'
        else:
           su_sudo = 'su -c "%s"'

        password_f = "get_password_ui"
#        password_f = utils.get_password
    cmd =su_sudo % usermod
    log.info("cmd = %s" %cmd)
#    sts, output = utils.run(cmd, True, password_f, -1,True,cmd)  
    sts, output = utils.run(cmd, True, password_f, 1, True, "Please enter root/superuser password to add 'lp' group")
    if sts == 0:
        result = True
        
    return result
Beispiel #22
0
def get_version(cmd,def_ver='-'):
    log.debug("Checking: %s" % (cmd))
    status, output = utils.run(cmd)

    if status != 0:
        log.debug("Not found!")
        return def_ver
    else:
        try:
            line = output.splitlines()[0]
        except IndexError:
            line = ''

        log.debug(line)
        match_obj = ver1_pat.search(line)
        try:
            ver = match_obj.group(1)
        except AttributeError:
            match_obj = ver_pat.search(line)
            try:
                ver = match_obj.group(1)
            except AttributeError:
                return def_ver
            else:
                return ver
        else:
            return ver
Beispiel #23
0
def check_tool(cmd, min_ver=0.0):
    log.debug("Checking: %s (min ver=%f)" % (cmd, min_ver))
    status, output = utils.run(cmd)

    if status != 0:
        log.debug("Not found!")
        return False
    else:
        if min_ver:
            try:
                line = output.splitlines()[0]
            except IndexError:
                line = ''
            log.debug(line)
            match_obj = ver_pat.search(line)
            try:
                ver = match_obj.group(1)
            except AttributeError:
                ver = ''

            try:
                v_f = float(ver)
            except ValueError:
                return False
            else:
                log.debug("Ver=%f Min ver=%f" % (v_f, min_ver))

                if v_f < min_ver:
                    log.debug("Found, but newer version required.")

                return v_f >= min_ver
        else:
            log.debug("Found.")
            return True
Beispiel #24
0
def handle_plugin_install():
    
#    child_process=os.fork()
#    if child_process ==0: 	### child process
#        child_pid=os.getpid()
#        utils.run('hp-diagnose_plugin',True, None, 1, False)
#        os.kill(child_pid,signal.SIGKILL)
#
#    else:	## parent process
#        log.debug("Started Plug-in installation wizard")

##### TBD: Valdiation pending for Plug-in is already running or not?... 
    child_process=os.fork()
    if child_process== 0:	# child process
        lockObj = utils.Sync_Lock("/tmp/pluginInstall.tmp")
        lockObj.acquire()
        child_pid=os.getpid()
        core = core_install.CoreInstall()
        core.set_plugin_version()
        if not core.check_for_plugin():
            sts,out = utils.run('hp-diagnose_plugin',True, None, 1, False)
            if sts != 0:
                log.error("Failed to load hp-diagnose_plugin")
                #TBD FailureUI needs to add
        else:	
            log.debug("Device Plug-in was already installed. Not Invoking Plug-in installation wizard")

        lockObj.release()
        os.kill(child_pid,signal.SIGKILL)

    else: #parent process
        log.debug("Started Plug-in installation wizard")
Beispiel #25
0
def update_ld_output():
    # For library checks
    global ld_output
    status, ld_output = utils.run('%s -p' % os.path.join(utils.which('ldconfig'), 'ldconfig'), log_output=False)

    if status != 0:
        log.debug("ldconfig failed.")
Beispiel #26
0
def get_usb_details(vid_pid):
    result_cnt = 0
    param_result = {"idVendor":'', "iProduct":'',  "bNumInterfaces":'', "bInterfaceClass":''}
    param_search = {"idVendor": re.compile(r"""\s*idVendor\s*([0-9a-fx]{1,})\s*.*""", re.I),
                    "iProduct" : re.compile(r"""\s*iProduct\s*[0-9a-fx]{1,}\s*(.*)""", re.I),
                    "bNumInterfaces" : re.compile(r"""\s*bNumInterfaces\s*(\d{1,})\s*.*""", re.I),
                    "bInterfaceClass" : re.compile(r"""\s*bInterfaceClass\s*(\d{1,})\s*.*""", re.I)  }

    lsusb_cmd = utils.which('lsusb',True)
    if lsusb_cmd:
        sts,out = utils.run("%s -d %s -v"%(lsusb_cmd, vid_pid), passwordObj = None, pswd_msg='', log_output=False)
        if sts == 0:
            for l in out.splitlines():
                for s in param_search:
                    if s in l:
                        result_cnt += 1
                        if param_search[s].match(l):
                            param_result[s] = param_search[s].match(l).group(1)
                        else:
                            log.warn("TBD... Shouldn't have entered into this condition. key[%s]"%s)

                        if "idVendor" ==  s and param_result[s].lower() != "0x03f0":  # if non-HP vendor, ignoring usb parsing.
                            return False, {}
                        elif "iProduct" == s and param_result[s] == "":
                            return False, {}

                        break

                if result_cnt == len(param_result):  # To avoid extra parsing...
                     break

    return True, param_result
Beispiel #27
0
def check_tool(cmd, min_ver=0.0):
    log.debug("Checking: %s (min ver=%f)" % (cmd, min_ver))
    status, output = utils.run(cmd)

    if status != 0:
        log.debug("Not found!")
        return False
    else:
        if min_ver:
            try:
                line = output.splitlines()[0]
            except IndexError:
                line = ''
            log.debug(line)
            match_obj = ver_pat.search(line)
            try:
                ver = match_obj.group(1)
            except AttributeError:
                ver = ''

            try:
                v_f = float(ver)
            except ValueError:
                return False
            else:
                log.debug("Ver=%f Min ver=%f" % (v_f, min_ver))

                if v_f < min_ver:
                    log.debug("Found, but newer version required.")

                return v_f >= min_ver
        else:
            log.debug("Found.")
            return True
Beispiel #28
0
def install_firmware(Plugin_Installation_Completed):

    # timeout check for plugin installation
    sleep_timeout = 6000  # 10 mins time out
    while Plugin_Installation_Completed is False and sleep_timeout != 0:
        time.sleep(0.3)  # 0.3 sec delay
        sleep_timeout = sleep_timeout - 3

        ps_plugin, output = utils.Is_Process_Running("hp-plugin")
        ps_diagnose_plugin, output = utils.Is_Process_Running("hp-diagnose_plugin")

        if ps_plugin is False and ps_diagnose_plugin is False:
            Plugin_Installation_Completed = True
            if core.check_for_plugin() == PLUGIN_INSTALLED:
                break
            else:
                log.error(
                    "Failed to download firmware required files. manually run hp-plugin command in terminal fisrt"
                )
                sys.exit(1)

    execmd = "hp-firmware"
    options = ""
    if usb_bus_id is not None and usb_device_id is not None:
        options += " -y3 %s:%s" % (usb_bus_id, usb_device_id)

    if log_level is "debug":
        options += " -g"

    cmd = execmd + options
    log.info("Starting Firmware installation.")
    log.debug("Running command : %s " % cmd)
    Status, out = utils.run(cmd)
Beispiel #29
0
def get_already_added_queues(udev_MDL, udev_serial_no, udev_back_end,remove_non_hp_config):
    status, output = utils.run('lpstat -v')

    same_printer_queues = []
    for p in output.splitlines():
        try:
            match = LPSTAT_PAT.search(p)
            printer_name = match.group(1)
            device_uri = match.group(2)
            if device_uri.startswith("cups-pdf:/"):
                  continue
            if not USB_PATTERN.search(device_uri):
                  continue

            back_end = BACK_END_PATTERN.search(device_uri).group(1)
            serial = USB_PATTERN.search(device_uri).group(1)
            log.debug("udev_serial_no[%s] serial[%s] udev_back_end[%s] back_end[%s]"%(udev_serial_no, serial, udev_back_end, back_end))
            if udev_serial_no == serial and (udev_back_end == back_end or back_end == 'usb'):
                if remove_non_hp_config and printer_name.find('_') == -1 and printer_name.find('-') != -1:
                    log.debug("Removed %s Queue"%printer_name)
                    # remove queues using cups API
                    cups.delPrinter(printer_name)
                else:
                    same_printer_queues.append(printer_name)

        except AttributeError:
            pass

    log.debug(same_printer_queues)
    return same_printer_queues
Beispiel #30
0
    def __getPluginInformation(self, callback=None):
        status, url, check_sum = ERROR_NO_NETWORK, '', ''

        if self.__plugin_conf_file.startswith('http://'):
            if not utils.check_network_connection():
                log.error("Network connection not detected.")
                return ERROR_NO_NETWORK, '', 0

        local_conf_fp, local_conf = utils.make_temp_file()

        try:
            try:
                if self.__plugin_conf_file.startswith('file://'):
                    status, filename = utils.download_from_network(
                        self.__plugin_conf_file, local_conf, True)
                else:
                    wget = utils.which("wget", True)
                    if wget:
                        status, output = utils.run(
                            "%s --tries=3 --timeout=60 --output-document=%s %s --cache=off"
                            % (wget, local_conf, self.__plugin_conf_file))
                        if status:
                            log.error(
                                "Plugin download failed with error code = %d" %
                                status)
                            return status, url, check_sum
                    else:
                        log.error(
                            "Please install wget package to download the plugin."
                        )
                        return status, url, check_sum
            except IOError as e:
                log.error("I/O Error: %s" % e.strerror)
                return status, url, check_sum

            if not os.path.exists(local_conf):
                log.error("plugin.conf not found.")
                return status, url, check_sum

            try:
                plugin_conf_p = ConfigBase(local_conf)
                url = plugin_conf_p.get(self.__required_version, 'url', '')
                check_sum = plugin_conf_p.get(self.__required_version,
                                              'checksum')
                status = ERROR_SUCCESS
            except (KeyError, configparser.NoSectionError) as e:
                log.error(
                    "Error reading plugin.conf: Missing section [%s]  Error[%s]"
                    % (self.__required_version, e))
                return ERROR_FILE_NOT_FOUND, url, check_sum

            if url == '':
                return ERROR_FILE_NOT_FOUND, url, check_sum

        finally:
            os.close(local_conf_fp)
            os.remove(local_conf)

        return status, url, check_sum
Beispiel #31
0
    def __gpg_check(self, hplip_package, hplip_digsig, passwordObj):
        cmd = '%s --no-permission-warning --verify %s %s' % (self.__gpg, hplip_digsig, hplip_package)
        cmd = passwordObj.getAuthCmd()%cmd
        log.debug("Verifying file %s with digital keys: %s" % (hplip_package,cmd))

        status, output = utils.run(cmd, passwordObj)
        log.debug("%s status: %d  output:%s" % (self.__gpg, status,output))
        return status
Beispiel #32
0
    def executePrint(self):
        for cmd in self.OptionsToolBox.getPrintCommands(self.Files.file_list):
            log.debug(cmd)
            status, output = utils.run(cmd, log_output=True, password_func=None, timeout=1)
            if status != 0:
                FailureUI(self, self.__tr("<b>Print command failed with status code %1.</b><p>%2</p>").arg(status).arg(cmd))

        self.close()
Beispiel #33
0
def check_lsmod(module):
    global mod_output

    if not mod_output:
        lsmod = utils.which('lsmod')
        status, mod_output = utils.run(os.path.join(lsmod, 'lsmod'), log_output=False)

    return mod_output.find(module) >= 0
Beispiel #34
0
    def executePrint(self):
        for cmd in self.OptionsToolBox.getPrintCommands(self.Files.file_list):
            log.debug(cmd)
            status, output = utils.run(cmd)
            if status != 0:
                FailureUI(self, self.__tr("<b>Print command failed with status code %s.</b><p>%s</p>"%(status,cmd)))

        self.close()
Beispiel #35
0
def check_lsmod(module):
    global mod_output

    if not mod_output:
        lsmod = utils.which('lsmod')
        status, mod_output = utils.run(os.path.join(lsmod, 'lsmod'), log_output=False)

    return mod_output.find(module) >= 0
Beispiel #36
0
def restart(passwordObj):
    ok = False
    shutdown = utils.which('shutdown')
    if shutdown and passwordObj:
        cmd = "%s -r now" % (os.path.join(shutdown, "shutdown"))
        cmd = passwordObj.getAuthCmd() % cmd
        status, output = utils.run(cmd, passwordObj, "Need authentication to restart system")

        ok = (status == 0)
    return ok
Beispiel #37
0
    def acquire_gpg_key(self, passwordObj):
        cmd = '%s --no-permission-warning --keyserver %s --recv-keys 0x%X' \
              % (self.__gpg, self.__pgp_site, self.__key)

        cmd = passwordObj.getAuthCmd()%cmd
        log.info("Receiving digital keys: %s" % cmd)

        status, output = utils.run(cmd, passwordObj)
        log.debug(output)
        return status 
Beispiel #38
0
    def SetupButton_clicked(self):
        self.close()

        if utils.which('hp-setup'):
            cmd = 'hp-setup -u'
        else:
            cmd = 'python ./setup.py -u'

        log.debug(cmd)
        utils.run(cmd)

        try:
            self.parent().rescanDevices()
        except Error:
            QMessageBox.critical(
                self, self.windowTitle(),
                self.__tr(
                    "<b>An error occurred.</b><p>Please re-start the Device Manager and try again."
                ), QMessageBox.Ok, QMessageBox.NoButton, QMessageBox.NoButton)
    def setupPushButton_clicked(self):
        self.close()

        if utils.which('hp-setup'):
            cmd = 'hp-setup -u'
        else:
            cmd = 'python ./setup.py -u'

        log.debug(cmd)
        utils.run(cmd, log_output=True, password_func=None, timeout=1)

        try:
            self.parent().RescanDevices()
        except Error:
            QMessageBox.critical(
                self, self.caption(),
                self.__tr(
                    "<b>An error occurred.</b><p>Please re-start the Device Manager and try again."
                ), QMessageBox.Ok, QMessageBox.NoButton, QMessageBox.NoButton)
Beispiel #40
0
def enable_log():
    result = False
    cmd = 'cp -f %s %s' % (CUPS_FILE, CUPS_BACKUP_FILE)
    log.debug("Backup CUPS conf file. cmd =%s" % cmd)
    sts, out = utils.run(cmd)
    if sts != 0:
        log.error("Failed to take back cups file=%s" % CUPS_FILE)

    #check if cups is log level enabled or disable
    cmd = "grep 'LogLevel warn' %s" % CUPS_FILE
    log.debug("cmd= %s" % cmd)
    sts, out = utils.run(cmd)
    if sts == 0:
        cmd = "vi -c '%s/LogLevel warn/LogLevel debug\rhpLogLevel 15/' -c 'wq' %s" % (
            "%s", CUPS_FILE)
        log.debug("Changing 'Log level' to debug. cmd=%s" % cmd)
        sts, cmd = utils.run(cmd)
        if sts != 0:
            log.error("Failed to update Loglevel to Debug in cups=%s" %
                      CUPS_FILE)

        cmd = None
        if utils.which('service'):
            cmd = os.path.join(utils.which('service'),
                               'service') + " cups restart"
        elif utils.which('systemctl'):
            cmd = os.path.join(
                utils.which('systemctl'),
                'systemctl') + " restart %s.service" % service_name
        elif os.path.exists('/etc/init.d/cups'):
            cmd = "/etc/init.d/cups restart"
        else:
            log.error(
                "service command not found.. Please restart cups manually..")

        if cmd:
            log.debug("CUPS restart cmd = %s" % cmd)
            sts, out = utils.run(cmd)
            if sts == 0:
                result = True

    return result
Beispiel #41
0
    def setupPushButton_clicked(self):
        self.close()

        if utils.which('hp-setup'):
            cmd = 'hp-setup -u'
        else:
            cmd = 'python ./setup.py -u'

        log.debug(cmd)
        utils.run(cmd, log_output=True, password_func=None, timeout=1)

        try:
            self.parent().RescanDevices()
        except Error:
            QMessageBox.critical(self,
                                    self.caption(),
                                    self.__tr("<b>An error occurred.</b><p>Please re-start the Device Manager and try again."),
                                    QMessageBox.Ok,
                                    QMessageBox.NoButton,
                                    QMessageBox.NoButton)
Beispiel #42
0
    def NextButton_clicked(self):
        try:
            if self.Error_msg != QUEUES_PAUSED:
                cups.delPrinter(self.printerName)
                msg = "' " + self.printerName + " ' removed successfully.\nRe-configuring this printer by hp-setup..."
                log.debug(msg)
                path = utils.which('hp-setup')
                if path:
                    log.debug("Starting hp-setup")
                    utils.run('hp-setup')

            else:
                cups.enablePrinter(self.printerName)
                msg = "'" + self.printerName + "' is enabled successfully"
                SuccessUI(self, self.__tr(msg))

        finally:
            endWaitCursor()
        self.result = True
        self.close()
Beispiel #43
0
    def __gpg_check(self, hplip_package, hplip_digsig):

        cmd = '%s --homedir %s -no-permission-warning --verify %s %s' % (self.__gpg, self.__gpg_dir, hplip_digsig, hplip_package)

        log.debug("Verifying file %s : cmd = [%s]" % (hplip_package,cmd))

        status, output = utils.run(cmd)

        log.debug("%s status: %d  output:%s" % (self.__gpg, status,output))

        return status
Beispiel #44
0
    def NextButton_clicked(self):
        try:
            if self.Error_msg != QUEUES_PAUSED:
                cups.delPrinter(self.printerName)
                msg = "' " + self.printerName + " ' removed successfully.\nRe-configuring this printer by hp-setup..."
                log.debug(msg)
                path = utils.which("hp-setup")
                if path:
                    log.debug("Starting hp-setup")
                    utils.run("hp-setup")

            else:
                cups.enablePrinter(self.printerName)
                msg = "'" + self.printerName + "' is enabled successfully"
                SuccessUI(self, self.__tr(msg))

        finally:
            endWaitCursor()
        self.result = True
        self.close()
Beispiel #45
0
    def SetupButton_clicked(self):
        self.close()

        if utils.which('hp-setup'):
            cmd = 'hp-setup -u'
        else:
            cmd = 'python ./setup.py -u'

        log.debug(cmd)
        utils.run(cmd)

        try:
            self.parent().rescanDevices()
        except Error:
            QMessageBox.critical(self,
                                    self.windowTitle(),
                                    self.__tr("<b>An error occurred.</b><p>Please re-start the Device Manager and try again."),
                                    QMessageBox.Ok,
                                    QMessageBox.NoButton,
                                    QMessageBox.NoButton)
Beispiel #46
0
def restart(passwordObj):
    ok = False
    shutdown = utils.which('shutdown')
    if shutdown and passwordObj:
        cmd = "%s -r now" % (os.path.join(shutdown, "shutdown"))
        cmd = passwordObj.getAuthCmd() % cmd
        status, output = utils.run(cmd, passwordObj,
                                   "Need authentication to restart system")

        ok = (status == 0)
    return ok
Beispiel #47
0
def backup_clearLog(strLog):
    if os.path.exists(strLog):
        iArch =1
        while os.path.exists("%s.%d"%(strLog, iArch)) or os.path.exists("%s.%d.gz"%(strLog, iArch)):
            iArch +=1
        sts,out = utils.run('cp %s %s.%d'%(strLog, strLog, iArch))
        if sts != 0:
            log.error("Failed to archive %s log file"%strLog)
        else:
            cmd = 'cat /dev/null > %s' % strLog
            sts = os_utils.execute(cmd)
            if sts != 0:
                log.warn("Failed to clear the %s log file"%strLog)
            if utils.which('gzip'):
                sts,out = utils.run ('gzip %s.%d'%(strLog, iArch))
                if sts != 0:
                    log.info("Existing %s log file copied to %s.%d"%(strLog, strLog, iArch))
                else:
                    log.info("Existing %s log file copied to %s.%d.gz"%(strLog, strLog, iArch))
            else:
                log.info("Existing %s log file copied to %s.%d"%(strLog, strLog, iArch))
Beispiel #48
0
    def executePrint(self):
        for cmd in self.OptionsToolBox.getPrintCommands(self.Files.file_list):
            log.debug(cmd)
            status, output = utils.run(cmd)
            if status != 0:
                FailureUI(
                    self,
                    self.__tr(
                        "<b>Print command failed with status code %s.</b><p>%s</p>"
                        % (status, cmd)))

        self.close()
Beispiel #49
0
    def __acquire_gpg_key(self):

        cmd = '%s --homedir %s --no-permission-warning --keyserver %s --recv-keys 0x%X' \
              % (self.__gpg, self.__gpg_dir, self.__pgp_site, self.__key)

        log.info("Receiving digital keys: %s" % cmd)
        status, output = utils.run(cmd)
        log.debug(output)

        self.__change_owner(True)

        return status
Beispiel #50
0
    def __acquire_gpg_key(self):

        cmd = '%s --homedir %s --no-permission-warning --keyserver %s --recv-keys 0x%X' \
              % (self.__gpg, self.__gpg_dir, self.__pgp_site, self.__key)

        log.info("Receiving digital keys: %s" % cmd)
        status, output = utils.run(cmd)
        log.debug(output)

        self.__change_owner(True)

        return status 
Beispiel #51
0
    def __gpg_check(self, hplip_package, hplip_digsig):

        cmd = '%s --homedir %s -no-permission-warning --verify %s %s' % (
            self.__gpg, self.__gpg_dir, hplip_digsig, hplip_package)

        log.debug("Verifying file %s : cmd = [%s]" % (hplip_package, cmd))

        status, output = utils.run(cmd)

        log.debug("%s status: %d  output:%s" % (self.__gpg, status, output))

        return status
Beispiel #52
0
def run_hp_tools(cmd):
    if cmd is not None:
        hpCommand = utils.which(cmd, True)

        if not hpCommand:
            hpCommand = cmd

        log.debug(hpCommand)
        status, output = utils.run(hpCommand)
        return status == 0
    else:
        log.error("Command not found")
        return False
Beispiel #53
0
def run_hp_tools(cmd):
    if cmd is not None:
        hpCommand = utils.which(cmd, True)

        if not hpCommand:
            hpCommand = cmd

        log.debug(hpCommand)
        status, output = utils.run(hpCommand)
        return status == 0
    else:
        log.error("Command not found")
        return False
Beispiel #54
0
def get_usb_details(vid_pid):
    result_cnt = 0
    param_result = {
        "idVendor": '',
        "iProduct": '',
        "bNumInterfaces": '',
        "bInterfaceClass": ''
    }
    param_search = {
        "idVendor":
        re.compile(r"""\s*idVendor\s*([0-9a-fx]{1,})\s*.*""", re.I),
        "iProduct":
        re.compile(r"""\s*iProduct\s*[0-9a-fx]{1,}\s*(.*)""", re.I),
        "bNumInterfaces":
        re.compile(r"""\s*bNumInterfaces\s*(\d{1,})\s*.*""", re.I),
        "bInterfaceClass":
        re.compile(r"""\s*bInterfaceClass\s*(\d{1,})\s*.*""", re.I)
    }

    lsusb_cmd = utils.which('lsusb', True)
    if lsusb_cmd:
        sts, out = utils.run("%s -d %s -v" % (lsusb_cmd, vid_pid),
                             passwordObj=None,
                             pswd_msg='',
                             log_output=False)
        if sts == 0:
            for l in out.splitlines():
                for s in param_search:
                    if s in l:
                        result_cnt += 1
                        if param_search[s].match(l):
                            param_result[s] = param_search[s].match(l).group(1)
                        else:
                            log.warn(
                                "TBD... Shouldn't have entered into this condition. key[%s]"
                                % s)

                        if "idVendor" == s and param_result[s].lower(
                        ) != "0x03f0":  # if non-HP vendor, ignoring usb parsing.
                            return False, {}
                        elif "iProduct" == s and param_result[s] == "":
                            return False, {}

                        break

                if result_cnt == len(
                        param_result):  # To avoid extra parsing...
                    break

    return True, param_result
    def executePrint(self):
        for cmd in self.OptionsToolBox.getPrintCommands(self.Files.file_list):
            log.debug(cmd)
            status, output = utils.run(cmd,
                                       log_output=True,
                                       password_func=None,
                                       timeout=1)
            if status != 0:
                FailureUI(
                    self,
                    self.__tr(
                        "<b>Print command failed with status code %1.</b><p>%2</p>"
                    ).arg(status).arg(cmd))

        self.close()
Beispiel #56
0
def check_user_groups():
    result = False
    sts, output = utils.run('groups')
    if sts != 0:
        log.error("Failed to get groups")
    else:
        output = output.rstrip('\r\n')
        log.debug("groups =%s " % output)
        grp_list = output.split(' ')
        cnt = 0
        while cnt < len(grp_list):
            if grp_list[cnt] == 'lp':
                result = True
                break
            cnt += 1

    return result
Beispiel #57
0
def run_hp_tools_with_auth(cmd, passwordObj):
    if cmd is not None and passwordObj is not None:
        hpCommand = utils.which(cmd, True)

        if not hpCommand:  #if it is local command like. ./setup.py
            hpCommand = cmd

        hpCommand = passwordObj.getAuthCmd() % hpCommand

        log.debug(hpCommand)
        status, output = utils.run(
            hpCommand, passwordObj,
            "Need authentication to run %s command" % cmd)
        return status == 0
    else:
        log.error("Command not found or password object is not valid")
        return False
Beispiel #58
0
def get_smartinstall_enabled_devices():
    smartinstall_dev_list = []
    lsusb_cmd = utils.which('lsusb', True)

    if not lsusb_cmd:
        log.error("Failed to find the lsusb command")
        return smartinstall_dev_list

    try:
        sts, out = utils.run(lsusb_cmd)
        if sts != 0:
            log.error("Failed to run the %s command" % lsusb_cmd)
            return smartinstall_dev_list

        for d in out.splitlines():
            usb_dev_pat = re.compile(r""".*([0-9a-f]{4}:([0-9a-f]{4}))\s*""",
                                     re.I)

            if usb_dev_pat.match(d):
                vid_pid = usb_dev_pat.match(d).group(1)

                bsts, usb_params = get_usb_details(vid_pid)
                if not bsts:
                    continue  # These are not HP-devices

                log.debug(
                    "Product['%s'],Interfaces[%s],InterfaceClass[%s]" %
                    (usb_params["iProduct"], usb_params["bNumInterfaces"],
                     usb_params["bInterfaceClass"]))
                if usb_params["bNumInterfaces"] == '1' and usb_params[
                        "bInterfaceClass"] == '8' and "laserjet" in usb_params[
                            "iProduct"].lower():  #'8' is MASS STORAGE
                    smartinstall_dev_list.append(usb_params["iProduct"])

            else:
                log.warn("Failed to find vid and pid for USB device[%s]" % d)

    except KeyError:
        pass

    if smartinstall_dev_list:
        smartinstall_dev_list = utils.uniqueList(smartinstall_dev_list)

    return smartinstall_dev_list
Beispiel #59
0
def run_open_mdns_port(core, passwordObj, callback=None):
    open_mdns_port_cmd = core.get_distro_ver_data('open_mdns_port')
    log.debug(open_mdns_port_cmd)
    if open_mdns_port_cmd and passwordObj:
        x = 1
        for cmd in open_mdns_port_cmd:
            cmd = passwordObj.getAuthCmd() % cmd
            status, output = utils.run(
                cmd, passwordObj,
                "Need authentication to open mdns port [%s]" % cmd)

            if status != 0:
                log.warn("An error occurred running '%s'" % cmd)
                log.warn(output)

            if callback is not None:
                callback(cmd, "Open mDNS/Bonjour step %d" % x)

            x += 1
Beispiel #60
0
def handle_plugin_install():

    child_process = os.fork()
    if child_process == 0:  # child process
        lockObj = utils.Sync_Lock("/tmp/pluginInstall.tmp")
        lockObj.acquire()
        child_pid = os.getpid()
        core = core_install.CoreInstall(core_install.MODE_CHECK)
        core.set_plugin_version()
        if core.check_for_plugin() != PLUGIN_INSTALLED:
            sts, out = utils.run('hp-diagnose_plugin', True, None, 1, False)
            if sts != 0:
                log.error("Failed to load hp-diagnose_plugin")
                #TBD FailureUI needs to add
        else:
            log.debug(
                "Device Plug-in was already installed. Not Invoking Plug-in installation wizard"
            )

        lockObj.release()
        os.kill(child_pid, signal.SIGKILL)
    else:  #parent process
        log.debug("Started Plug-in installation wizard")