def _versionchecklinux(packages): if platform.dist()[0].lower() in ["ubuntu", "debian", "linuxmint"]: handler = False result = False try: # try aptdeamon first from lib.aptdeamonhandler import AptdeamonHandler handler = AptdeamonHandler() except: # fallback to shell # since we need the user password, ask to check for new version first from lib.shellhandlerapt import ShellHandlerApt sudo = True handler = ShellHandlerApt(sudo) if dialog_yesno(32015): pass elif dialog_yesno(32009, 32010): log("disabling addon by user request") __addon__.setSetting("versioncheck_enable", "false") return if handler: if handler.check_upgrade_available(packages[0]): if _upgrademessage(32012, True): if __addon__.getSetting("upgrade_system") == "false": result = handler.upgrade_package(packages[0]) else: result = handler.upgrade_system() if result: from lib.common import message_upgrade_success, message_restart message_upgrade_success() message_restart() else: log("Error during upgrade") else: log("Error: no handler found") else: log("Unsupported platform %s" % platform.dist()[0]) sys.exit(0)
def _versionchecklinux(packages): if platform.dist()[0].lower() in ['ubuntu', 'debian', 'linuxmint']: handler = False result = False try: # try aptdaemon first from lib.aptdaemonhandler import AptdaemonHandler handler = AptdaemonHandler() except: # fallback to shell # since we need the user password, ask to check for new version first from lib.shellhandlerapt import ShellHandlerApt sudo = True handler = ShellHandlerApt(sudo) if dialog_yesno(32015): pass elif dialog_yesno(32009, 32010): log("disabling addon by user request") ADDON.setSetting("versioncheck_enable", 'false') return if handler: if handler.check_upgrade_available(packages[0]): if _upgrademessage(32012, oldversion, True): if ADDON.getSetting("upgrade_system") == "false": result = handler.upgrade_package(packages[0]) else: result = handler.upgrade_system() if result: from lib.common import message_upgrade_success, message_restart message_upgrade_success() message_restart() else: log("Error during upgrade") else: log("Error: no handler found") else: log("Unsupported platform %s" % platform.dist()[0]) sys.exit(0)