def confirm(selected_build): from lib import progress with open(os.path.join(__dir__, constants.NOTIFY_FILE), 'w') as f: f.write(str(selected_build)) if __addon__.getSetting('confirm_reboot') == 'true': if xbmcgui.Dialog().yesno("Confirm reboot", " ", "Reboot now to install build {}?" .format(selected_build)): xbmc.restart() else: notify(selected_build) else: if progress.restart_countdown("Build {} is ready to install.".format(selected_build)): xbmc.restart() else: notify(selected_build)
__addon__ = xbmcaddon.Addon(constants.__scriptid__) __icon__ = __addon__.getAddonInfo('icon') __dir__ = xbmc.translatePath(__addon__.getAddonInfo('profile')) init = not sys.argv[0] if init: rpi_config_backup_file = os.path.join(__dir__, constants.RPI_CONFIG_FILE) if os.path.exists(rpi_config_backup_file): utils.log("Re-enabling overclocking") utils.mount_readwrite() xbmcvfs.copy(rpi_config_backup_file, constants.RPI_CONFIG_PATH) utils.mount_readonly() xbmcvfs.delete(rpi_config_backup_file) if restart_countdown("Ready to reboot to re-enable overclocking."): utils.log("Restarting") xbmc.restart() sys.exit() else: utils.log("Restart cancelled") update_extlinux_file = os.path.join(__dir__, constants.UPDATE_EXTLINUX) if os.path.exists(update_extlinux_file): utils.log("Updating extlinux") utils.mount_readwrite() utils.update_extlinux() utils.mount_readonly() os.remove(update_extlinux_file) try: