Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
Index: doctor.py
===================================================================
--- doctor.py	(nonexistent)
+++ doctor.py	(revision 93)
@@ -0,0 +1,363 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2012-2020 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Author: Amarnath Chitumalla
+#
+
+__version__ = '1.0'
+__title__ = 'Self Diagnse Utility and Healing Utility'
+__mod__ = 'hp-doctor'
+__doc__ = """Tool checks for the deprecated, plug-in, dependencies, queues, permission issues and provides self diagnose steps"""
+
+
+# global import
+import getopt
+import os
+import sys
+import getpass
+
+#local import
+from base.g import *
+from base.strings import *
+try:
+    from base import utils, tui, module,queues, os_utils, services, smart_install
+except ImportError as e:
+    if 'cupsext' in e.args[0] :
+        check_extension_module_env('cupsext')
+    else:
+        log.exception("")
+        sys.exit(1)
+        
+from installer.core_install import *
+from check import DependenciesCheck
+
+USAGE = [(__doc__, "", "name", True),
+         ("Usage: %s [OPTIONS]" % __mod__, "", "summary", True),
+         utils.USAGE_SPACE,
+         utils.USAGE_MODE,
+         ("Run in interactive mode:", "-i or --interactive (Default)", "option", False),
+#         ("Run in graphical UI mode:", "-u or --gui (future use)", "option", False),
+         utils.USAGE_SPACE,
+         utils.USAGE_OPTIONS,
+         utils.USAGE_HELP,
+         utils.USAGE_LOGGING1, utils.USAGE_LOGGING2, utils.USAGE_LOGGING3,
+#         ("Non-interactive mode:","-n(Without asking permissions)(future use)","option",False),
+#         ("Perform the task for the given device id:","-d<device id>(future use)","option",False),
+#         ("Take options from the file instead of command line:","-f<file> (future use)","option",False)
+
+        ]
+
+##########################global variables ##########################3
+MODE = INTERACTIVE_MODE
+DEVICE_URI = None
+PERFORM_IN_NON_INTERACTIVE_MODE=False
+LOG_LEVEL=None
+VALID_AUTHENTICATION = False
+IS_RESTART_REQ = False
+DONOT_CLOSE_TERMINAL=False
+SUMMARY_ONLY = False
+
+#################################### functions #########################
+def usage(typ='text'):
+    if typ == 'text':
+        utils.log_title(__title__, __version__)
+
+    utils.format_text(USAGE, typ, __title__, __mod__, __version__)
+    clean_exit(2)
+
+
+def append_options(cmd):
+    if MODE == INTERACTIVE_MODE:
+        cmd += " -i "
+    elif MODE == GUI_MODE:
+        cmd += " -u "
+
+    if PERFORM_IN_NON_INTERACTIVE_MODE:
+        cmd += " -n "
+
+    if LOG_LEVEL:
+        cmd += " -l%s"%LOG_LEVEL
+
+    # Adding quiet mode option..
+    cmd += " -s "
+    return cmd
+
+
+def authenticate(core):
+    global VALID_AUTHENTICATION
+    if not services.running_as_root() and VALID_AUTHENTICATION == False:
+        ###TBD
+        # if MODE == GUI_MODE:
+        #    GUI passwrd query..
+        # else:
+        if core.passwordObj.getAuthType() == "sudo":
+            tui.title("ENTER SUDO PASSWORD")
+        else:
+            tui.title("ENTER ROOT/SUPERUSER PASSWORD")
+
+        VALID_AUTHENTICATION = core.check_password()
+    else:
+        VALID_AUTHENTICATION = True
+
+    if not VALID_AUTHENTICATION:
+        log.error("3 incorrect attempts. (or) Insufficient permissions(i.e. try with sudo user).\nExiting.")
+        clean_exit(3)
+
+    return VALID_AUTHENTICATION
+
+
+def install_plugin(core):
+    plugin_sts = core.get_plugin_status()
+    if plugin_sts == PLUGIN_VERSION_MISMATCH:
+        ok,user_input =tui.enter_choice("Found Plugin version mismatch. Press 'y' to re-install the plugin(y=yes*, n=no):",['y', 'n'], 'y')
+    elif plugin_sts == PLUGIN_FILES_CORRUPTED:
+        ok,user_input =tui.enter_choice("Plugins corrupted. Press 'y' to re-install the plugin(y=yes*, n=no):",['y', 'n'], 'y')
+    elif plugin_sts == PLUGIN_NOT_INSTALLED:
+        ok,user_input =tui.enter_choice("Plugin's are missing. Press 'y' to install the plugin(y=yes*, n=no):",['y', 'n'], 'y')
+    elif plugin_sts == PLUGIN_INSTALLED:
+        log.info("Plugin's already installed")
+        return True
+    else:
+        log.info("No plug-in printers are configured.")
+        return True
+
+    if ok and user_input == 'y':
+#        authenticate(core)
+        cmd='hp-plugin'
+        cmd = append_options(cmd)
+        sts = os_utils.execute(cmd)
+        if sts == 0:
+            return True
+        else:
+            log.info(log.bold("Failed to install Plugin. Please run 'hp-plugin' command to install plugin manually"))
+    return False
+
+
+def deprecated_check(core):
+    if core.validate_distro_version():
+        log.debug("This distro is supported.")
+        log.info("No Deprecated items are found")
+    else:
+        log.error("This distro (i.e %s  %s) is either deprecated or not yet supported."%(core.distro_name, core.distro_version))
+        ok,user_input =tui.enter_choice(log.red("The diagnosis is limited on unsupported platforms. Do you want to continue?(y=yes*, n=no):"),['y', 'n'], 'y')
+        if not ok or user_input !='y':
+            clean_exit(2)
+
+
+def display_missing_dependencies(required_dependencies=[],optional_dependencies=[], missing_cmd=[]):
+    if len(required_dependencies):
+        log.info(log.bold("Missing Required Dependencies"))
+        log.info(log.bold('-'*len("Missing Required Dependencies")))
+        for packages_to_install in required_dependencies:
+           if 'cups' in packages_to_install:
+               log.error("'%s' package is missing or '%s' service is not running."%(packages_to_install,'cups'))
+           else:
+               log.error("'%s' package is missing/incompatible "%packages_to_install)
+
+    if len(optional_dependencies):
+        log.info(log.bold("Missing Optional Dependencies"))
+        log.info(log.bold('-'*len("Missing Optional Dependencies")))
+        for packages_to_install in optional_dependencies:
+            log.error("'%s' package is missing/incompatible "%packages_to_install)
+
+    if len(missing_cmd):
+        log.info(log.bold("Missing Commands"))
+        log.info(log.bold('-'*len("Missing Commands")))
+        for cmd in missing_cmd:
+            log.error("'%s' is missing"%cmd)
+
+
+def clean_exit(exit_code=0):
+    mod.unlockInstance()
+
+    if DONOT_CLOSE_TERMINAL:
+        log.info("\n\nPlease close this terminal manually. ")
+        try:
+            while 1:
+                pass
+        except KeyboardInterrupt:
+            pass
+
+    sys.exit(exit_code)
+
+
+#################################### Main #########################
+log.set_module(__mod__)
+try:
+    mod = module.Module(__mod__, __title__, __version__, __doc__, USAGE,
+                    (INTERACTIVE_MODE, GUI_MODE),
+                    (UI_TOOLKIT_QT3, UI_TOOLKIT_QT4, UI_TOOLKIT_QT5), True)
+
+    opts, device_uri, printer_name, mode, ui_toolkit, loc = \
+               mod.parseStdOpts('hl:gnid:f:w', ['summary-only','help', 'help-rest', 'help-man', 'help-desc', 'interactive', 'gui', 'lang=','logging=', 'debug'],
+                     handle_device_printer=False)
+
+except getopt.GetoptError as e:
+    log.error(e.msg)
+    usage()
+
+if os.getenv("HPLIP_DEBUG"):
+    log.set_level('debug')
+    LOG_LEVEL = 'debug'
+
+for o, a in opts:
+    if o == '-n':
+        MODE = NON_INTERACTIVE_MODE
+        PERFORM_IN_NON_INTERACTIVE_MODE = True
+        log.warn("NON_INTERACTIVE mode is not yet supported.")
+        #TBD
+        usage()
+    elif o == '-d':
+        DEVICE_URI=a
+    elif o in ('-u', '--gui'):
+        log.warn("GUI is not yet supported.")
+        #TBD
+        usage()
+    elif o == '-f':
+        log.warn("Option from file is not yet supported")
+        #TBD
+        usage()
+    elif o in ('-l', '--logging'):
+        LOG_LEVEL = a.lower().strip()
+        if not log.set_level(LOG_LEVEL):
+            usage()
+    elif o == '-w':
+        DONOT_CLOSE_TERMINAL = True
+
+    elif o == '--summary-only':
+        SUMMARY_ONLY = True
+
+
+try:
+    if os.geteuid() == 0:
+        log.error("%s %s"  %(__mod__, queryString(ERROR_RUNNING_AS_ROOT)))
+        sys.exit(1)
+
+    mod.lockInstance('')
+    mod.quiet= False
+    mod.showTitle()
+    log_file = os.path.normpath('%s/hp-doctor.log'%prop.user_dir)
+
+    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)
+
+    log.debug("Upgrade log saved in: %s" % log.bold(log_file))
+    log.debug("")
+
+    if PERFORM_IN_NON_INTERACTIVE_MODE and os.geteuid() != 0:
+        log.error("Non Interactive mode should be run in root mode.")
+        clean_exit(1)
+
+    ui_toolkit = sys_conf.get('configure','ui-toolkit')
+
+    dep =  DependenciesCheck(MODE_CHECK,INTERACTIVE_MODE,ui_toolkit)
+    dep.core.init()
+    log.info(log.bold("\n\nChecking for Deprecated items...."))
+
+    deprecated_check(dep.core)
+
+    log.info(log.bold("\n\nChecking for HPLIP updates...."))
+    upgrade_cmd = utils.which('hp-upgrade',True)
+    if upgrade_cmd:
+        #checking for latest version of HPLIP.
+        upgrade_cmd = append_options(upgrade_cmd)
+        sts = os_utils.execute(upgrade_cmd)
+        if sts != 0:
+            log.error("Failed to upgrade latest HPLIP. Is hp-upgrade already running (i.e. foreground or background)?")
+    else:
+        log.error("Failed to locate hp-upgrade utility")
+
+    ### Dependency check
+    log.info(log.bold("\n\nChecking for Dependencies...."))
+    if SUMMARY_ONLY:
+        num_errors, num_warns = dep.validate(DEPENDENCY_RUN_AND_COMPILE_TIME, True)
+    else:
+        num_errors, num_warns = dep.validate(DEPENDENCY_RUN_AND_COMPILE_TIME, False)
+
+    if num_errors or num_warns:
+
+        if dep.get_required_deps() or dep.get_optional_deps() or dep.get_cmd_to_run():
+            display_missing_dependencies(dep.get_required_deps(),dep.get_optional_deps(), dep.get_cmd_to_run())
+            authenticate(dep.core)
+            dep.core.install_missing_dependencies(INTERACTIVE_MODE,dep.get_required_deps(),dep.get_optional_deps(), dep.get_cmd_to_run())
+
+        log.info(log.bold("\n\nChecking Permissions...."))
+#        if not core.get_missing_user_grps() and not core.get_disable_selinux_status():
+        # if not core.get_disable_selinux_status():
+        #     log.info("Permissions are correct.")
+
+#        if core.get_missing_user_grps():
+#            log.info(log.bold("Missing User Groups"))
+#            log.info(log.bold('-'*len("Missing User Groups")))
+#            log.info("%s"%core.get_missing_user_grps())
+#            authenticate(core)
+#            if core.add_groups_to_user(core.get_missing_user_grps(), core.get_user_grp_cmd()):
+#                IS_RESTART_REQ = True
+
+        # if core.get_disable_selinux_status():
+        #     log.info(log.bold("SELinux Status"))
+        #     log.info(log.bold('-'*len("SELinux Status")))
+        #     log.info("SELinux is enabled. Needs to be disabled")
+        #     authenticate(core)
+        #     if core.disable_SELinux():
+        #         IS_RESTART_REQ = True
+
+    log.info(log.bold("\n\nChecking for Configured Queues...."))
+    queues.main_function(dep.core.passwordObj, MODE,ui_toolkit, False, DEVICE_URI)
+
+    log.info(log.bold("\n\nChecking for HP Properitery Plugin's...."))
+    ### Check for Plugin Printers
+    install_plugin(dep)
+
+    smart_ins_dev_list = smart_install.get_smartinstall_enabled_devices()
+    if smart_ins_dev_list:
+        log.info(log.bold("\n\nChecking for 'CD-ROM'/'Smart Install' Detected Devices...."))
+        url, tool_name = smart_install.get_SmartInstall_tool_info()
+        for printer in smart_ins_dev_list:
+            log.error("Smart Install is Enabled in '%s' Printer. This needs to be disabled."%printer)
+        log.info(log.bold("\nRefer link '%s' to disable Smart Install manually.\n"%(url)))
+
+    comm_err_dev = dep.get_communication_error_devs()
+    if comm_err_dev:
+        log.info(log.bold("\n\nChecking for Printer Status...."))
+        for printer in comm_err_dev:
+            log.error("'%s' Printer is either Powered-OFF or Failed to communicate."%printer)
+            log.info(log.bold("Turn On Printer and re-run %s"%__mod__))
+
+    if IS_RESTART_REQ:
+        log.info(log.bold("\nPlease reboot the system before performing any function."))
+
+    log.info(log.bold("\nDiagnose completed...\n"))
+    log.info("")
+    log.info("")
+    log.info("More information on Troubleshooting,How-To's and Support is available on http://hplipopensource.com/hplip-web/index.html")
+        
+    clean_exit(0)
+
+
+except KeyboardInterrupt:
+    log.error("User exit")
+    clean_exit(1)
+
Index: logcapture.py
===================================================================
--- logcapture.py	(nonexistent)
+++ logcapture.py	(revision 93)
@@ -0,0 +1,366 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2003-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Author: Amarnath Chitumalla
+#
+from __future__ import print_function
+__version__ = '1.0'
+__title__ = 'HPLIP logs capture Utility'
+__mod__ = 'hp-logcapture'
+__doc__ = """Captures the HPLIP log files."""
+
+import os
+import sys
+import getopt
+import glob
+import datetime
+
+from base.g import *
+from base import utils,tui,module, os_utils
+from base.sixext import to_string_utf8
+from subprocess import Popen, PIPE
+from installer.core_install import *
+
+CUPS_FILE='/etc/cups/cupsd.conf'
+CUPS_BACKUP_FILE='/etc/cups/cupsd.conf_orginal'
+LOG_FOLDER_PATH='./'
+LOG_FOLDER_NAME='hplip_troubleshoot_logs'
+LOG_FILES=LOG_FOLDER_PATH + LOG_FOLDER_NAME
+TMP_DIR = "/var/spool/cups/tmp"
+USER_NAME =""
+USERS={}
+################ is_journal() function ##############
+#Capture logs from system journal for Fedora 21 onwards
+
+def is_journal():
+    core =  CoreInstall(MODE_INSTALLER, INTERACTIVE_MODE)
+    core.get_distro()
+    distro_name = core.distro_name
+    distro_ver = core.distro_version
+    if distro_name == "fedora" and distro_ver >=" 21" :
+        journal = True
+    else:
+        journal = False
+    return journal
+
+############ enable_log() function ############
+#This function changes CUPS conf log level to debug and restarts CUPS service.
+
+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 = "sed -i 's/LogLevel.*warn/LogLevel debug\rhpLogLevel 15/' %s "%CUPS_FILE
+        log.debug("Changing 'Log level' to debug. cmd=%s"%cmd)
+        sts= os.system(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
+
+############ restore_loglevels() function ############
+#This function restores CUPS conf file to previous value and restarts CUPS service.
+
+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
+
+def usage(typ='text'):
+    if typ == 'text':
+        utils.log_title(__title__, __version__)
+
+    utils.format_text(USAGE, typ, __title__, __mod__, __version__)
+    sys.exit(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))
+
+
+
+USAGE = [(__doc__, "", "name", True),
+         ("Usage: [su -c /sudo] %s [USER INFO] [OPTIONS]" % __mod__, "", "summary", True),
+         ("e.g. su -c '%s'"%__mod__,"","summary",True),
+         ("[USER INFO]", "", "heading", False),
+         ("User name for which logs to be collected:", "--user=<username> ", "option", False),
+         utils.USAGE_OPTIONS,
+         utils.USAGE_HELP,
+         utils.USAGE_LOGGING1, utils.USAGE_LOGGING2, utils.USAGE_LOGGING3,
+        ]
+
+
+######## Main #######
+try:
+    mod = module.Module(__mod__, __title__, __version__, __doc__, USAGE,
+                    (INTERACTIVE_MODE,),run_as_root_ok=True, quiet=True)
+
+    opts, device_uri, printer_name, mode, ui_toolkit, loc = \
+               mod.parseStdOpts('hl:g:r', ['help', 'help-rest', 'help-man', 'help-desc', 'logging=', 'debug','user='],handle_device_printer=False)
+except getopt.GetoptError as e:
+    log.error(e.msg)
+    usage()
+
+if os.getenv("HPLIP_DEBUG"):
+    log.set_level('debug')
+
+for o, a in opts:
+    if o in ('-h', '--help'):
+        usage()
+
+    elif o == '--help-rest':
+        usage('rest')
+
+    elif o == '--help-man':
+        usage('man')
+
+    elif o == '--help-desc':
+        print(__doc__, end=' ')
+        clean_exit(0,False)
+
+    elif o in ('-l', '--logging'):
+        log_level = a.lower().strip()
+        if not log.set_level(log_level):
+            usage()
+
+    elif o in ('-g', '--debug'):
+        log.set_level('debug')
+
+    elif o == '--user':
+        USER_NAME = a
+
+
+
+if os.getuid() != 0:
+    log.error("logCapture needs root permissions since cups service restart requires....")
+    sys.exit()
+
+if not USER_NAME:
+    pout = Popen(["who"], stdout=PIPE)
+    output = to_string_utf8(pout.communicate()[0])
+    if output:
+        USER_NAME = output.split(' ')[0]
+
+    if not USER_NAME:
+        log.error("Failed to get the user name. Try again by passing '--user' option")
+        sys.exit(1)
+
+if not os.path.exists(TMP_DIR):
+    TMP_DIR = "/tmp"
+
+cmd = "mkdir -p %s"%LOG_FILES
+log.debug("Creating temporary logs folder =%s"%cmd)
+sts, out = utils.run(cmd)
+if sts != 0:
+   log.error("Failed to create directory =%s. Exiting"%LOG_FILES)
+   sys.exit(1)
+
+sts,out = utils.run('chmod 755  %s'%LOG_FILES)
+if sts != 0:
+    log.error("Failed to change permissions for %s."%(LOG_FILES))
+
+
+USERS[USER_NAME]="/home/"+USER_NAME+"/.hplip"
+
+USERS['root']="/root/.hplip"
+for u in USERS:
+    sts, out = utils.run('mkdir -p %s/%s'%(LOG_FILES,u))
+    if sts != 0:
+       log.error("Failed to create directory =%s. Exiting"%LOG_FILES)
+       sys.exit(1)
+
+    sts,out = utils.run('chmod 755  %s/%s'%(LOG_FILES,u))
+    if sts != 0:
+        log.error("Failed to change permissions for %s/%s."%(LOG_FILES,u))
+
+
+enable_log()
+
+#### Clearing previous logs.. ###########
+if not is_journal():
+    ok,user_input = tui.enter_choice("Archiving system logs (i.e. syslog, message, error_log). Press (y=yes*, n=no, q=quit):",['y', 'n','q'], 'y')
+    if not ok or user_input == "q":
+        restore_loglevels()
+        log.warn("User exit")
+        sys.exit(1)
+
+    if ok and user_input == "y":
+        backup_clearLog('/var/log/syslog')
+        backup_clearLog('/var/log/messages')
+        backup_clearLog('/var/log/cups/error_log')
+
+
+
+######## Waiting for user to completed job #######
+while 1:
+    log_time = datetime.datetime.strftime(datetime.datetime.now(),'%Y-%m-%d %H:%M:%S')
+    log.info(log.bold("\nPlease perform the tasks (Print, scan, fax) for which you need to collect the logs."))
+    ok,user_input =tui.enter_choice("Are you done with tasks?. Press (y=yes*, q=quit):",['y','q'], 'y')
+    if ok and user_input == "y":
+        break;
+    elif not ok or user_input == "q":
+        restore_loglevels()
+        log.warn("User exit")
+        sys.exit(1)
+
+######## Copying logs to Temporary log folder #######
+sts,out = utils.run('hp-check')
+if sts != 0:
+    log.error("Failed to run hp-check command")
+
+log.debug("Copying logs to Temporary folder =%s"%LOG_FILES)
+if not is_journal():
+    if os.path.exists('/var/log/syslog'):
+        sts,out = utils.run ('cp -f /var/log/syslog %s/syslog.log'%LOG_FILES)
+        if sts != 0:
+           log.error("Failed to capture %s log file."%("/var/log/syslog"))
+
+    if os.path.exists('/var/log/messages'):
+        sts,out = utils.run('cp -f /var/log/messages %s/messages.log'%LOG_FILES)
+        if sts != 0:
+           log.error("Failed to capture %s log file."%("/var/log/messages"))
+
+    if os.path.exists('/var/log/cups/error_log'):
+        sts,out = utils.run('cp -f /var/log/cups/error_log %s/cups_error_log.log'%LOG_FILES)
+        if sts != 0:
+           log.error("Failed to capture %s log file."%("/var/log/cups/error_log"))
+else:
+    log.debug("Collecting cups logs from system journal")
+    cmd = "journalctl -u cups.service -e --since '%s' " %log_time
+    sts = os.system(cmd + "> %s/cups_error.log"%LOG_FILES)
+    if sts != 0:
+        log.error("Failed to capture logs from journal")
+
+
+    log.debug("Collecting messages from system journal")
+    cmd = "journalctl --since '%s' " %log_time
+    sts = os.system(cmd + "> %s/messages.log"%LOG_FILES)
+    if sts != 0:
+        log.error("Failed to capture messages from journal")
+
+for u in USERS:
+    sts = os.system('cp -f %s/*.log  %s/%s 2>/devnull '%(USERS[u],LOG_FILES,u))
+
+sts,out = utils.run('mv -f ./hp-check.log %s'%LOG_FILES)
+if sts != 0:
+    log.error("Failed to capture %s log files."%("./hp-check.log"))
+cmd = 'chmod 666  %s/*.log' % LOG_FILES
+sts = os_utils.execute(cmd)
+if sts != 0:
+    log.error("Failed to change permissions for %s."%(LOG_FILES))
+
+######## Compressing log files #######
+cmd = 'tar -zcf %s.tar.gz %s'%(LOG_FOLDER_NAME,LOG_FILES)
+log.debug("Compressing logs. cmd =%s"%cmd)
+
+sts_compress,out = utils.run(cmd)
+if sts_compress != 0:
+    log.error("Failed to compress %s folder."%(LOG_FILES))
+else:
+    log.debug("Changing Permissions of ./%s.tar.gz "%LOG_FOLDER_NAME)
+    sts,out = utils.run('chmod 666 -R ./%s.tar.gz'%(LOG_FOLDER_NAME))
+    if sts != 0:
+        log.error("Failed to change permissions for %s.tar.gz."%(LOG_FILES))
+    log.debug("Removing Temporary log files..")
+    sts,out = utils.run('rm -rf %s'%LOG_FILES)
+    if sts != 0:
+        log.error("Failed to remove temporary files. Remove manually."%(LOG_FILES))
+
+restore_loglevels()
+
+log.info("")
+log.info("")
+if sts_compress == 0:
+    log.info(log.bold("Logs are saved as %s/%s.tar.gz"%( os.getcwd(),LOG_FOLDER_NAME)))
+    log.info(log.bold("Please create a bug @https://bugs.launchpad.net/hplip/+filebug and upload this log file."))
+else:
+    log.info(log.bold("Logs are saved as %s/%s"%(os.getcwd(),LOG_FOLDER_NAME)))
+log.info("")

Property changes on: logcapture.py
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: uninstall.py
===================================================================
--- uninstall.py	(nonexistent)
+++ uninstall.py	(revision 93)
@@ -0,0 +1,132 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2011-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Author: Amarnath Chitumalla
+#
+from __future__ import print_function
+__version__ = '1.0'
+__title__ = 'HPLIP Uninstaller'
+__mod__ = 'hp-uninstall'
+__doc__ = "Uninstaller for HPLIP ."
+
+# Std Lib
+import getopt, os, sys, re, time
+
+# Local
+from base.g import *
+from base import utils, tui
+from installer.core_install import *
+
+
+USAGE = [(__doc__, "", "name", True),
+         ("Usage: %s [OPTIONS]" % __mod__, "", "summary", True),
+         utils.USAGE_SPACE,
+         utils.USAGE_OPTIONS,
+         utils.USAGE_LOGGING1, utils.USAGE_LOGGING2, utils.USAGE_LOGGING3,
+         ("Non-interactive mode:", "-n (without asking for permission)","option",False),
+         utils.USAGE_HELP,
+        ]
+
+
+def usage(typ='text'):
+    if typ == 'text':
+        utils.log_title(__title__, __version__)
+
+    utils.format_text(USAGE, typ, __title__, __mod__, __version__)
+    sys.exit(0)
+
+mode = INTERACTIVE_MODE
+auto = False
+log_level = None
+
+
+
+log.set_module(__mod__)
+
+
+try:
+    opts, args = getopt.getopt(sys.argv[1:], 'hl:gn',
+        ['help', 'help-rest', 'help-man', 'help-desc', 'gui', 'lang=','logging=', 'debug'])
+
+except getopt.GetoptError as e:
+    log.error(e.msg)
+    usage()
+    sys.exit(1)
+
+if os.getenv("HPLIP_DEBUG"):
+    log.set_level('debug')
+
+for o, a in opts:
+    if o in ('-h', '--help'):
+        usage()
+
+    elif o == '--help-rest':
+        usage('rest')
+
+    elif o == '--help-man':
+        usage('man')
+
+    elif o in ('-q', '--lang'):
+        language = a.lower()
+
+    elif o == '--help-desc':
+        print(__doc__, end=' ')
+        sys.exit(0)
+
+    elif o in ('-l', '--logging'):
+        log_level = a.lower().strip()
+#        if not log.set_level(log_level):
+#            usage()
+
+    elif o in ('-g', '--debug'):
+        log_level = 'debug'
+#        log.set_level('debug')
+
+    elif o == '-n':
+        mode = NON_INTERACTIVE_MODE
+
+
+if log_level is not None:
+    if not log.set_level(log_level):
+        usage()
+        
+log_file = os.path.normpath('%s/hplip-uninstall.log'%prop.user_dir)
+if os.getuid() != 0:
+    log.error("To run 'hp-uninstall' utility, you must have root privileges.(Try using 'sudo' or 'su -c')")
+    sys.exit(1)
+
+if os.path.exists(log_file):
+    os.remove(log_file)
+
+log.set_logfile(log_file)
+log.set_where(log.LOG_TO_CONSOLE_AND_FILE)
+
+log.debug("Log file=%s" % log_file)
+log.debug("euid = %d" % os.geteuid())
+
+utils.log_title(__title__, __version__, True)
+
+log.info("Uninstaller log saved in: %s" % log.bold(log_file))
+log.info("")
+
+core =  CoreInstall(MODE_CHECK, INTERACTIVE_MODE)
+core.init()
+
+core.uninstall(mode)
+

Property changes on: uninstall.py
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: upgrade.py
===================================================================
--- upgrade.py	(nonexistent)
+++ upgrade.py	(revision 93)
@@ -0,0 +1,446 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+#
+# (c) Copyright 2011-2015 HP Development Company, L.P.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Author: Amarnath Chitumalla
+#
+from __future__ import print_function
+__version__ = '1.0'
+__title__ = 'HPLIP upgrade latest version'
+__mod__ = 'hp-upgrade'
+__doc__ = "HPLIP installer to upgrade to latest version."
+
+# Std Lib
+import getopt, os, sys, re, time, datetime
+
+# Local
+from base.g import *
+from base.strings import *
+from base import utils, tui, module, os_utils, services, validation
+from installer.core_install import *
+from base.sixext.moves import input
+
+
+USAGE = [(__doc__, "", "name", True),
+         ("Usage: %s [OPTIONS]" % __mod__, "", "summary", True),
+         utils.USAGE_SPACE,
+         utils.USAGE_MODE,
+         ("Run in interactive mode:", "-i or --interactive (Default)", "option", False),
+#         ("Run in graphical UI mode:", "-u or --gui (future use)", "option", False),
+         utils.USAGE_SPACE,
+         utils.USAGE_OPTIONS,
+         utils.USAGE_HELP,
+         utils.USAGE_LOGGING1, utils.USAGE_LOGGING2, utils.USAGE_LOGGING3,
+         ("Check for update and notify:","--notify","option",False),
+         ("Check only available version:","--check","option",False),
+#         ("Non-interactive mode:","-n(Without asking permissions)(future use)","option",False),
+         ("Specify the path to the .run file on local system:","-p<path>","option", False),
+         ("Download HPLIP package location:","-d<path> (default location ~/Downloads)","option", False),
+         ("Override existing HPLIP installation even if latest vesrion is installed:","-o","option",False),
+#         ("Take options from the file instead of command line:","-f<file> (future use)","option",False)
+        ]
+
+mode = INTERACTIVE_MODE
+EXISTING_PACKAGE_PATH=None
+PATH_TO_DOWNLOAD_INSTALLER=os.path.expanduser('~/Downloads')
+FORCE_INSTALL=False
+CHECKING_ONLY=False
+NOTIFY=False
+HPLIP_VERSION_INFO_SOURCEFORGE_SITE ="http://hplip.sourceforge.net/hplip_web.conf"
+HPLIP_WEB_SITE ="http://hplipopensource.com/hplip-web/index.html"
+HPLIP_PACKAGE_SITE = "http://sourceforge.net/projects/hplip/files/hplip"
+IS_QUIET_MODE = False
+DONOT_CLOSE_TERMINAL = False
+CURRENT_WORKING_DIR = ''
+
+def hold_terminal():
+    if DONOT_CLOSE_TERMINAL:
+        log.info("\n\nPlease close this terminal manually. ")
+        try:
+            while 1:
+                pass
+        except KeyboardInterrupt:
+            pass
+
+
+def usage(typ='text'):
+    if typ == 'text':
+        utils.log_title(__title__, __version__)
+
+    utils.format_text(USAGE, typ, __title__, __mod__, __version__)
+    hold_terminal()
+    sys.exit(0)
+
+def clean_exit(code=0, waitTerminal=True):
+    if not NOTIFY and not CHECKING_ONLY and not IS_QUIET_MODE:
+        log.info("")
+        log.info("Done.")
+    change_spinner_state(True)
+    mod.unlockInstance()
+    hold_terminal()
+    sys.exit(code)
+
+
+def parse_HPLIP_version(hplip_version_file, pat):
+    ver = "0.0.0"
+    if not os.path.exists(hplip_version_file):
+        return ver
+
+    try:
+        fp= open(hplip_version_file, 'r')
+    except IOError:
+        log.error("Failed to get hplip version since %s file is not found."%hplip_version_file)
+        return ver
+    data = fp.read()
+    for line in data.splitlines():
+        if pat.search(line):
+            ver = pat.search(line).group(1)
+            break
+
+    log.debug("Latest HPLIP version = %s." % ver)
+    return ver
+
+
+def get_hplip_version_from_sourceforge():
+    HPLIP_latest_ver="0.0.0"
+
+    # get HPLIP version info from hplip_web.conf file
+    sts, HPLIP_Ver_file = utils.download_from_network(HPLIP_VERSION_INFO_SOURCEFORGE_SITE)
+    if sts == 0:
+        hplip_version_conf = ConfigBase(HPLIP_Ver_file)
+        HPLIP_latest_ver = hplip_version_conf.get("HPLIP","Latest_version","0.0.0")
+        os.unlink(HPLIP_Ver_file)
+
+    return HPLIP_latest_ver
+
+
+def get_hplip_version_from_hplipopensource():
+    HPLIP_latest_ver="0.0.0"
+    pat = re.compile(r"""The current version of the HPLIP solution is version (\d{1,}\.\d{1,}\.\d{1,}[a-z]{0,})\. \(.*""")
+    sts, HPLIP_Ver_file = utils.download_from_network(HPLIP_WEB_SITE)
+    if sts == 0:
+        HPLIP_latest_ver = parse_HPLIP_version(HPLIP_Ver_file, pat)
+        os.unlink(HPLIP_Ver_file)
+
+    return HPLIP_latest_ver
+
+
+def get_latest_hplip_version():
+    HPLIP_latest_ver = get_hplip_version_from_sourceforge()
+
+    if HPLIP_latest_ver == "0.0.0":     ## if failed to connect the sourceforge site, then check HPLIP site.
+        HPLIP_latest_ver = get_hplip_version_from_hplipopensource()
+                           
+    return HPLIP_latest_ver
+
+
+def digital_signature_fail_confirmation(msg):
+    log.error(log.bold(msg))
+    ok,choice = tui.enter_choice("Do you want continue without Digital Signature verification (y=yes, n=no*):", ['y','n'],'n')
+    if not ok or choice == 'n':
+       return False
+    else:
+        return True
+
+
+def download_hplip_installer(path_to_download, hplip_version):
+    url="%s/%s/hplip-%s.run" %(HPLIP_PACKAGE_SITE, hplip_version, hplip_version)
+    hplip_package = "%s/hplip-%s.run" %(path_to_download, hplip_version)
+
+    log.info("Downloading hplip-%s.run file..... Please wait. "%hplip_version )
+    sts,download_file = utils.download_from_network(url, hplip_package, True)
+    log.info("")
+
+    if not os.path.exists(hplip_package):
+        log.error("Failed to download %s file."%hplip_package)
+        return '',''
+
+    log.info("Downloading hplip-%s.run.asc file..... Please wait. "%hplip_version )
+    hplip_digsig =  hplip_package+".asc"
+    url = url +".asc"
+    sts,download_file = utils.download_from_network(url, hplip_digsig)
+    log.info("")
+
+    if not os.path.exists(hplip_digsig):
+        log.error("Failed to download %s file."%hplip_package)
+        return hplip_package, ''
+
+    return hplip_package, hplip_digsig
+
+
+###################### Main ###############
+log.set_module(__mod__)
+try:
+    mod = module.Module(__mod__, __title__, __version__, __doc__, USAGE,
+                    (INTERACTIVE_MODE, GUI_MODE),
+                    (UI_TOOLKIT_QT3, UI_TOOLKIT_QT4, UI_TOOLKIT_QT5), True)
+
+    opts, device_uri, printer_name, mode, ui_toolkit, loc = \
+               mod.parseStdOpts('hl:gniup:d:of:sw', ['notify','check','help', 'help-rest', 'help-man', 'help-desc', 'interactive', 'gui', 'lang=','logging=', 'debug'],
+                     handle_device_printer=False)
+
+
+
+except getopt.GetoptError as e:
+    log.error(e.msg)
+    usage()
+
+if os.geteuid() == 0:
+    log.error("%s %s"  %(__mod__, queryString(ERROR_RUNNING_AS_ROOT)))
+    clean_exit(1)
+
+if os.getenv("HPLIP_DEBUG"):
+    log.set_level('debug')
+
+for o, a in opts:
+    if o in ('-h', '--help'):
+        usage()
+
+    elif o == '--help-rest':
+        usage('rest')
+
+    elif o == '--help-man':
+        usage('man')
+
+    elif o in ('-q', '--lang'):
+        language = a.lower()
+
+    elif o == '--help-desc':
+        print(__doc__, end=' ')
+        clean_exit(0,False)
+
+    elif o in ('-l', '--logging'):
+        log_level = a.lower().strip()
+        if not log.set_level(log_level):
+            usage()
+
+    elif o in ('-g', '--debug'):
+        log.set_level('debug')
+
+    elif o == '-n':
+        mode = NON_INTERACTIVE_MODE
+        log.info("NON_INTERACTIVE mode is not yet supported.")
+        usage()
+        clean_exit(0,False)
+
+    elif o == '-p':
+        EXISTING_PACKAGE_PATH=a
+
+    elif o == '-d':
+        PATH_TO_DOWNLOAD_INSTALLER=a
+
+    elif o == '-o':
+        FORCE_INSTALL = True
+
+    elif o in ('-u', '--gui'):
+        log.info("GUI is not yet supported.")
+        usage()
+        clean_exit(0, False)
+    elif o == '--check':
+        CHECKING_ONLY = True
+    elif o == '--notify':
+        NOTIFY = True
+    elif o == '-s':
+        IS_QUIET_MODE = True
+    elif o == '-f':
+        log.info("Option from file is not yet supported")
+        usage()
+        clean_exit(0, False)
+    elif o == '-w':
+        DONOT_CLOSE_TERMINAL = True
+
+if not NOTIFY and not CHECKING_ONLY and not IS_QUIET_MODE:
+    mod.quiet= False
+    mod.showTitle()
+
+if NOTIFY or CHECKING_ONLY:
+    mod.lockInstance('check',True)
+else:
+    mod.lockInstance('upgrade',True)
+
+log_file = os.path.normpath('%s/hp-upgrade.log'%prop.user_dir)
+
+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)
+
+
+log.debug("Upgrade log saved in: %s" % log.bold(log_file))
+log.debug("")
+try:
+    change_spinner_state(False)
+    core =  CoreInstall(MODE_CHECK)
+    if not utils.check_network_connection():
+        log.error("Either Internet is not working or Wget is not installed.")
+        clean_exit(1)
+
+    installed_version=sys_conf.get("hplip","version","0.0.0")
+    log.debug("HPLIP previous installed version =%s." %installed_version)
+
+    HPLIP_latest_ver = get_latest_hplip_version()
+
+    if HPLIP_latest_ver == "0.0.0":
+        log.error("Failed to get latest version of HPLIP.")
+        clean_exit(1)
+
+    user_conf.set('upgrade','latest_available_version',HPLIP_latest_ver)
+    if CHECKING_ONLY is True:
+        log.debug("Available HPLIP version =%s."%HPLIP_latest_ver)
+
+    elif NOTIFY is True:
+        if not utils.Is_HPLIP_older_version(installed_version, HPLIP_latest_ver):
+            log.debug("Latest version of HPLIP is already installed.")
+
+        else:
+            msg = "Latest version of HPLIP-%s is available."%HPLIP_latest_ver
+            if core.is_auto_installer_support():
+                distro_type= 1
+            else:
+                distro_type= 2
+
+            if ui_toolkit == 'qt3':
+                if not utils.canEnterGUIMode():
+                    log.error("%s requires GUI support. Is Qt3 Installed?.. Exiting." % __mod__)
+                    clean_exit(1)
+
+                try:
+                    from qt import *
+                    from ui.upgradeform import UpgradeForm
+                except ImportError:
+                    log.error("Unable to load Qt3 support. Is it installed? ")
+                    clean_exit(1)
+
+                # create the main application object
+                app = QApplication(sys.argv)
+                QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
+                dialog = UpgradeForm(None, "",0,0,distro_type, msg)
+                dialog.show()
+
+                log.debug("Starting GUI loop...")
+                app.exec_loop()
+
+            else: #qt4
+                if not utils.canEnterGUIMode4():
+                    log.error("%s requires GUI support . Is Qt4 installed?.. Exiting." % __mod__)
+                    clean_exit(1)
+
+                try:
+                    from PyQt4.QtGui import QApplication, QMessageBox
+                    from ui4.upgradedialog import UpgradeDialog
+                except ImportError:
+                    log.error("Unable to load Qt4 support. Is it installed?")
+                    clean_exit(1)
+
+                app = QApplication(sys.argv)
+                dialog = UpgradeDialog(None, distro_type, msg)
+
+                dialog.show()
+                log.debug("Starting GUI loop...")
+                app.exec_()
+
+    else:
+        if FORCE_INSTALL is False:
+            if utils.Is_HPLIP_older_version(installed_version, HPLIP_latest_ver):
+                if IS_QUIET_MODE:
+                    log.info("Newer version of HPLIP-%s is available."%HPLIP_latest_ver)
+                ok,choice = tui.enter_choice("Press 'y' to continue to upgrade HPLIP-%s (y=yes*, n=no):"%HPLIP_latest_ver, ['y','n'],'y')
+                if not ok or choice == 'n':
+                    log.info("Recommended to install latest version of HPLIP-%s"%HPLIP_latest_ver)
+                    clean_exit(0, False)
+            else:
+                log.info("Latest version of HPLIP is already installed.")
+                clean_exit(0,False)
+
+        # check distro information.
+        if not core.is_auto_installer_support():
+            log.info("Please install HPLIP manually as mentioned in 'http://hplipopensource.com/hplip-web/install/manual/index.html' site")
+            clean_exit(0)
+
+        if not services.close_running_hp_processes():
+            clean_exit(1)
+
+        if EXISTING_PACKAGE_PATH:
+            downloaded_file = "%s/hplip-%s.run"%(EXISTING_PACKAGE_PATH, HPLIP_latest_ver)
+            digsig_file = "%s/hplip-%s.run.asc"%(EXISTING_PACKAGE_PATH, HPLIP_latest_ver)
+            PATH_TO_DOWNLOAD_INSTALLER = EXISTING_PACKAGE_PATH
+        else:
+            log.debug("\n Calling download_hplip_installer(...) \n")
+            log.debug("\n System Time : %s \n"%datetime.datetime.now().time().isoformat())
+
+            if not os.path.exists(PATH_TO_DOWNLOAD_INSTALLER):
+                log.error(log.bold("No such file or directory%s"%PATH_TO_DOWNLOAD_INSTALLER))
+                download_path = input(log.bold("Please specify the path to download. Press 'q' to quit:"))
+                if download_path == 'q':
+                    log.info("User selected to quit.")
+                    clean_exit(1)            
+                elif not os.path.exists(download_path):
+                    log.error(log.bold("Specified path does not exist. Exiting...%s\n"%download_path)) 
+                    clean_exit(1)
+                elif not os.access(download_path, os.R_OK | os.W_OK):
+                    log.error(log.bold("Specified path do not have enough permissions Exiting...%s\n"%download_path)) 
+                    clean_exit(1)          
+                else:
+                    PATH_TO_DOWNLOAD_INSTALLER = download_path
+            downloaded_file, digsig_file = download_hplip_installer(PATH_TO_DOWNLOAD_INSTALLER, HPLIP_latest_ver)
+
+
+        gpg_obj = validation.GPG_Verification()
+        digsig_sts, error_str = gpg_obj.validate(downloaded_file, digsig_file)
+
+        if digsig_sts != ERROR_SUCCESS:
+            if digsig_sts in  (ERROR_UNABLE_TO_RECV_KEYS, ERROR_DIGITAL_SIGN_NOT_FOUND, ERROR_DIGITAL_SIGN_BAD):
+                if not digital_signature_fail_confirmation(error_str):
+                    clean_exit(1)
+            else:
+                log.error(error_str)
+                clean_exit(1)
+
+
+        CURRENT_WORKING_DIR = os.getcwd()
+        os.chdir(PATH_TO_DOWNLOAD_INSTALLER)
+
+        # Installing hplip run.
+        cmd = "sh %s" %(downloaded_file)
+        log.debug("Upgrading  %s" % downloaded_file)
+
+        sts = os_utils.execute(cmd)
+        os.chdir(CURRENT_WORKING_DIR)
+
+        if sts == 0:
+            log.info(log.bold("Upgrade is Completed."))
+        else:
+            log.info(log.bold("Upgrade Failed or Skipped. status: %s"%sts))
+
+    change_spinner_state(True)
+    mod.unlockInstance()
+    hold_terminal()
+
+except KeyboardInterrupt:
+    if CURRENT_WORKING_DIR:
+        os.chdir(CURRENT_WORKING_DIR)
+
+    if not IS_QUIET_MODE:
+        log.error("User exit")
+
+    clean_exit(1)
+

Property changes on: upgrade.py
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property