diff --git a/backend/SystemUpdater/Core/DataAcquisition.py b/backend/SystemUpdater/Core/DataAcquisition.py index 7082707..5c12877 100644 --- a/backend/SystemUpdater/Core/DataAcquisition.py +++ b/backend/SystemUpdater/Core/DataAcquisition.py @@ -104,7 +104,6 @@ class UpdateMsgCollector(): self.upgrade_list = [] self.waitSendList = [] self.cache = None - self.Send_log = False self.updateManager = manager # 转换 & 加密 self.convertor = FormatConvert(self) @@ -189,7 +188,7 @@ class UpdateMsgCollector(): logging.error(e) def Upgrade_Process_Msg(self, action, dict_msg = {}): - if self.Send_log == True: + if self.updateManager.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False) == True: tmp_dict = {} tmp_dict.update(dict_msg) try: @@ -218,10 +217,6 @@ class UpdateMsgCollector(): self.UploadMessage = {} self.PackageInfo = {} self.UpdateInfos = {} - - def _set_Send_log(self, flag): - self.Send_log = flag - class FormatConvert(): def __init__(self, DataCollector): #秘钥 diff --git a/backend/SystemUpdater/Core/Database.py b/backend/SystemUpdater/Core/Database.py index f7cd2e1..382ab72 100644 --- a/backend/SystemUpdater/Core/Database.py +++ b/backend/SystemUpdater/Core/Database.py @@ -30,12 +30,6 @@ class Sqlite3Server(object): self.ucconfigs = UpgradeConfig(datadir = "/etc/kylin-version", name = "kylin-system-version.conf") self._system_version_config() - #发送日志 - self.upload_upgrade_log = self.window_main.configs_uncover.getWithDefault("SystemStatus", "upload_upgrade_log", False) - if self.upload_upgrade_log == False: - logging.warning("Log sending is not enabled, and the server will not receive your update records .") - else: - self.window_main.collector._set_Send_log(self.upload_upgrade_log) # 初始化连接数据库 def init_sqlit(self): @@ -218,7 +212,7 @@ class Sqlite3Server(object): self._refresh_system_version(version) #FIXME: 临时方案 PHP - PHPSeverSend(_send_log = self.upload_upgrade_log, _appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100") + PHPSeverSend(_send_log = self.window_main.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100") elif pkg_list: # 单包更新 # 获取单包数据插入数据库 pkgname = pkg_list.pop(0) @@ -268,7 +262,7 @@ class Sqlite3Server(object): # 软件商店获取中文名 appname_cn = self.get_cn_appname(str(pkgname)) #FIXME: 临时方案 PHP - PHPSeverSend(_send_log = self.upload_upgrade_log, _appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100") + PHPSeverSend(_send_log = self.window_main.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkgname, _appversion=pkgversion, _statue=status, _errorcode="10000100") try: self.insert_into_updateinfo(pkgname, pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn) # FIXME: 发送插入数据库成功的信号local_upgrade_list @@ -321,7 +315,7 @@ class Sqlite3Server(object): self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn) self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr) #FIXME: 临时方案 PHP - PHPSeverSend(_send_log = self.upload_upgrade_log, _appname=pkg.name, _appversion=pkgversion, _statue=status, _errorcode="10000100") + PHPSeverSend(_send_log = self.window_main.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=pkg.name, _appversion=pkgversion, _statue=status, _errorcode="10000100") # insert group deb next for i in pkg_group: # FIXME: 获取组信息 @@ -343,7 +337,7 @@ class Sqlite3Server(object): InstallInfos.update({"errorCode":str(error_string+" "+error_desc)}) self.window_main.collector.Upgrade_Process_Msg("finish-install", InstallInfos.copy()) #FIXME: 临时方案 PHP - PHPSeverSend(_send_log = self.upload_upgrade_log, _appname=i, _appversion=pkgversion, _statue=status, _errorcode="10000100") + PHPSeverSend(_send_log = self.window_main.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False), _appname=i, _appversion=pkgversion, _statue=status, _errorcode="10000100") try: self.insert_into_updateinfo(str(i), pkgversion, pkgdescription, timestr, status, "1", errstr, appname_cn) self.window_main.dbusController.UpdateSqlitSingle(str(i), timestr) diff --git a/backend/SystemUpdater/UpdateManagerDbus.py b/backend/SystemUpdater/UpdateManagerDbus.py index 8c23d1a..4e7420e 100755 --- a/backend/SystemUpdater/UpdateManagerDbus.py +++ b/backend/SystemUpdater/UpdateManagerDbus.py @@ -494,7 +494,7 @@ class UpdateManagerDbusController(dbus.service.Object): self.parent.sqlite3_server.insert_into_display("download_limit","true") self.parent.sqlite3_server.insert_into_display("download_limit_value",str(speed)) #发送信号 - self.DownloadSpeedChanged(str(speed)) + self.ButtonStatusChange("speed" , str(speed)) return True except Exception as e: logging.error(e) @@ -503,11 +503,11 @@ class UpdateManagerDbusController(dbus.service.Object): if os.path.exists("/etc/apt/apt.conf.d/80apt-download"): os.remove("/etc/apt/apt.conf.d/80apt-download") self.parent.sqlite3_server.insert_into_display("download_limit","false") - self.DownloadSpeedChanged("0") + self.ButtonStatusChange("speed", "0") return True else: self.parent.sqlite3_server.insert_into_display("download_limit","false") - self.DownloadSpeedChanged("0") + self.ButtonStatusChange("speed", "0") return True # # dbus接口:获取apt下载速度 @@ -568,11 +568,16 @@ class UpdateManagerDbusController(dbus.service.Object): try: if state: self.parent.uuconfigs.setValue("autoUpgradePolicy", "autoUpgradeState", "on", True) + self.parent.sqlite3_server.insert_into_display("autoupdate_allow", "true") + self.ButtonStatusChange("autoUpgradeStatus", "true") else : self.parent.uuconfigs.setValue("autoUpgradePolicy", "autoUpgradeState", "off", True) # self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadMode", "manual", True) # self.parent.uuconfigs.setValue("autoUpgradePolicy", "installMode", "manual", True) + self.parent.sqlite3_server.insert_into_display("autoupdate_allow", "false") + self.ButtonStatusChange("autoUpgradeStatus", "false") self.ChangeUpgradePolicy() + except Exception as e: logging.error(str(e)) return False @@ -587,6 +592,7 @@ class UpdateManagerDbusController(dbus.service.Object): self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadMode", "timing", True) self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadTime", str(time), True) self.parent.uuconfigs.setValue("autoUpgradePolicy", "installMode", "timing", True) + self.ButtonStatusChange("autoUpgradeTime", str(time)) elif mode == UU_UPGRADE_MODE_BEFORE_SHUTDOWN: self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadMode", "timing", True) self.parent.uuconfigs.setValue("autoUpgradePolicy", "installMode", "bshutdown", True) @@ -884,9 +890,9 @@ class UpdateManagerDbusController(dbus.service.Object): logging.info(COLORLOG_PREFIX + "Emitting"+ COLORLOG_SUFFIX + " RebootLogoutRequired required_status = %s",required_status)\ #限速修改信号 - @dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='s') - def DownloadSpeedChanged(self,limit_value=''): - logging.info(COLORLOG_PREFIX + "Emitting"+ COLORLOG_SUFFIX + " DownloadSpeedChanged limit_value = %s",limit_value) + @dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='ss') + def ButtonStatusChange(self, signal_types = '', value=''): + logging.info(COLORLOG_PREFIX + "Emitting"+ COLORLOG_SUFFIX + " ButtonStatusChange signal_types = %s, value = %s.",signal_types, value) # dbus 信号:用于发送立即更新信号 @dbus.service.signal(UPDATER_DBUS_INTERFACE) diff --git a/backend/SystemUpdater/backend/__init__.py b/backend/SystemUpdater/backend/__init__.py index b8eac50..096c107 100644 --- a/backend/SystemUpdater/backend/__init__.py +++ b/backend/SystemUpdater/backend/__init__.py @@ -652,10 +652,8 @@ class InstallBackend(): #开始生成列表 self.window_main.start_available() else: - self.window_main.dbusController.UpdateDetectFinished(success,[''],\ - get_error_string_from_enum(ERROR_UPDATE_DEFAULT_FAILED),error_string+' '+error_desc) - - self.window_main.sqlite3_server.insert_into_display("check_time",get_east_8_time()) + self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string+','+error_desc,error_desc) + self.window_main.sqlite3_server.insert_into_display("check_time",get_east_8_time()[0:-4]) elif action == self.ACTION_UPDATE and self.action_mode == self.MODE_UPDATE_CACHE: self.window_main.dbusController.UpdateDetectFinished(success,[''],error_string,error_desc) diff --git a/backend/po/zh_CN.po b/backend/po/zh_CN.po index 162c127..a5128aa 100644 --- a/backend/po/zh_CN.po +++ b/backend/po/zh_CN.po @@ -2677,18 +2677,6 @@ msgstr "但是 %s 已经安装" msgid "but %s is to be installed" msgstr "但是将要安装 %s" -#. 验签提权 -#. 验签失败,提权 -#: ../SystemUpdater/UpdateManager.py:230 -msgid "" -"Kylin System Updater requires authentication to install software packages." -msgstr "麒麟更新器安装软件包需要认证" - -#: ../SystemUpdater/UpdateManagerDbus.py:421 -msgid "" -"Kylin System Updater requires authentication to uninstall software packages." -msgstr "麒麟更新器卸载软件包需要认证" - #: ../SystemUpdater/Core/enums.py:763 msgid "Kylin System Updater" msgstr "麒麟更新器" @@ -2717,3 +2705,11 @@ msgstr "卸载软件包需要认证" #: ../SystemUpdater/UpdateManager.py:463 msgid " requires authentication to install software packages." msgstr "安装软件包需要认证" + +#: ../SystemUpdater/Core/utils.py:750 +msgid "Authentication success." +msgstr "认证成功" + +#: ../SystemUpdater/Core/utils.py:753 +msgid "Authentication failure." +msgstr "认证失败" diff --git a/debian/changelog b/debian/changelog index 7e770cd..2cedd45 100644 --- a/debian/changelog +++ b/debian/changelog @@ -58,7 +58,7 @@ kylin-system-updater (2.0.1kord) v101; urgency=medium * BUG: 无 * 需求号: 无 - * 其他改动说明: 增加开机定时下载、关机安装功能 + * 其他改动说明: 增加开机定时下载、关机安装功能,仅合入代码未启用功能 * 其他改动影响域:系统更新 -- luoxueyi Tue, 19 Apr 2022 17:40:34 +0800