非覆盖类配置文件的参数项
This commit is contained in:
parent
1a82de8a4b
commit
6cbcc5c5bd
|
@ -31,7 +31,7 @@ class Sqlite3Server(object):
|
|||
self._system_version_config()
|
||||
|
||||
#发送日志
|
||||
self.upload_upgrade_log = self.window_main.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False)
|
||||
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:
|
||||
|
|
|
@ -52,8 +52,9 @@ class UpgradeConfig(SafeConfigParser):
|
|||
logging.error("Error: setValue section:%s option:%s value:%s",section, option, value)
|
||||
logging.error(str(e))
|
||||
return False
|
||||
ddd = self.config_files[-1]
|
||||
if is_write == True:
|
||||
with open(self.config_files[0], 'w+') as configfile:
|
||||
with open(self.config_files[-1], 'w+') as configfile:
|
||||
self.write(configfile)
|
||||
return True
|
||||
|
||||
|
@ -91,7 +92,7 @@ class UpgradeConfig(SafeConfigParser):
|
|||
logging.error(str(e))
|
||||
return
|
||||
if is_write == True:
|
||||
with open(self.config_files[0], 'w+') as configfile:
|
||||
with open(self.config_files[-1], 'w+') as configfile:
|
||||
self.write(configfile)
|
||||
|
||||
def getListFromFile(self, section, option):
|
||||
|
|
|
@ -53,7 +53,9 @@ class UpdateManager():
|
|||
self.dbusController = self._setup_dbus()
|
||||
|
||||
#配置文件
|
||||
self.configs = UpgradeConfig("/var/lib/kylin-system-updater/")
|
||||
self.configs_uncover = UpgradeConfig("/var/lib/kylin-system-updater/",defaults_dir="system-updater-defaults.conf")
|
||||
self.configs_cover = UpgradeConfig("system-updater-coverable.conf")
|
||||
|
||||
self.uuconfigs = UpgradeConfig(datadir = "/var/lib/unattended-upgrades/", name = "unattended-upgrades-policy.conf")
|
||||
|
||||
#数据采集器
|
||||
|
@ -254,8 +256,8 @@ class UpdateManager():
|
|||
self.update_list = UpdateList(self)
|
||||
|
||||
#1、 检查出现安装过程异常重启 出现的话 进行异常修复
|
||||
if self.configs.getWithDefault("SystemStatus", "abnormal_reboot", False) == True:
|
||||
self.configs.setValue("SystemStatus","abnormal_reboot",str(False),True)
|
||||
if self.configs_uncover.getWithDefault("SystemStatus", "abnormal_reboot", False) == True:
|
||||
self.configs_uncover.setValue("SystemStatus","abnormal_reboot",str(False),True)
|
||||
logging.warning("start fix Abnormal Reboot broken pkgs...")
|
||||
self.start_fix_broken()
|
||||
return
|
||||
|
@ -1038,20 +1040,20 @@ class UpdateInstallMode():
|
|||
"PrepareForShutdown", prepare_for_shutdown_handler)
|
||||
|
||||
def auto_install(self):
|
||||
return self.parent.configs.getWithDefault("InstallMode", "auto_install", False)
|
||||
return self.parent.configs_uncover.getWithDefault("InstallMode", "auto_install", False)
|
||||
|
||||
def manual_install(self):
|
||||
return self.parent.configs.getWithDefault("InstallMode", "manual_install", False)
|
||||
return self.parent.configs_uncover.getWithDefault("InstallMode", "manual_install", False)
|
||||
|
||||
def shutdown_mode(self):
|
||||
return self.parent.configs.getWithDefault("InstallMode", "shutdown_install", False)
|
||||
return self.parent.configs_uncover.getWithDefault("InstallMode", "shutdown_install", False)
|
||||
|
||||
def set_shutdown_install(self,status=False):
|
||||
self.parent.configs.setValue("InstallMode","manual_install",str(status))
|
||||
self.parent.configs_uncover.setValue("InstallMode","manual_install",str(status))
|
||||
|
||||
def reset_shutdown_mode(self):
|
||||
self.tmp_content = []
|
||||
self.parent.configs.setValue("InstallMode","manual_install",str(False))
|
||||
self.parent.configs_uncover.setValue("InstallMode","manual_install",str(False))
|
||||
|
||||
#释放锁 更新完成时重新那锁
|
||||
if self.inhibit_lock != None:
|
||||
|
@ -1059,8 +1061,8 @@ class UpdateInstallMode():
|
|||
self.inhibit_lock = None
|
||||
|
||||
def install_finished(self):
|
||||
self.parent.configs.setValue("InstallMode","manual_install",str(False))
|
||||
self.parent.configs.setValue("InstallMode","auto_install",str(False))
|
||||
self.parent.configs_uncover.setValue("InstallMode","manual_install",str(False))
|
||||
self.parent.configs_uncover.setValue("InstallMode","auto_install",str(False))
|
||||
|
||||
self._prompt_in_boot()
|
||||
|
||||
|
|
|
@ -1005,11 +1005,11 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
"""Helper to set a property on the properties D-Bus interface."""
|
||||
if iface == UPDATER_DBUS_INTERFACE:
|
||||
if name == "ShutdownInstall":
|
||||
self.parent.configs.setValue("InstallMode","shutdown_install",str(bool(value)))
|
||||
self.parent.configs_uncover.setValue("InstallMode","shutdown_install",str(bool(value)))
|
||||
elif name == "P2pBootstrap":
|
||||
self.parent.apt_p2p_config.set_bootstrap(str(value))
|
||||
elif name == "UploadUpgradeLog":
|
||||
self.parent.configs.setValue("SystemStatus","upload_upgrade_log",str(bool(value)))
|
||||
self.parent.configs_uncover.setValue("SystemStatus","upload_upgrade_log",str(bool(value)))
|
||||
else:
|
||||
raise dbus.exceptions.DBusException("Unknown or read only "
|
||||
"property: %s" % name)
|
||||
|
@ -1022,12 +1022,12 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
if iface == UPDATER_DBUS_INTERFACE:
|
||||
return {
|
||||
"ShutdownInstall": dbus.Boolean(
|
||||
self.parent.configs.getWithDefault("InstallMode", "shutdown_install", False)),
|
||||
self.parent.configs_uncover.getWithDefault("InstallMode", "shutdown_install", False)),
|
||||
|
||||
"P2pBootstrap": dbus.String(self.parent.apt_p2p_config.get_bootstrap()),
|
||||
|
||||
"UploadUpgradeLog": dbus.Boolean(
|
||||
self.parent.configs.getWithDefault("SystemStatus", "upload_upgrade_log", False))
|
||||
self.parent.configs_uncover.getWithDefault("SystemStatus", "upload_upgrade_log", False))
|
||||
}
|
||||
else:
|
||||
return {}
|
|
@ -710,11 +710,11 @@ class InstallBackend():
|
|||
self.window_main.dbusController.UpdateInstallFinished(success,self.now_upgrade.upgrade_content,error_string,error_desc)
|
||||
|
||||
def _start_install_lock(self):
|
||||
self.window_main.configs.setValue("SystemStatus","abnormal_reboot",str(True))
|
||||
self.window_main.configs_uncover.setValue("SystemStatus","abnormal_reboot",str(True))
|
||||
self.window_main.inhibit_shutdown.lock()
|
||||
|
||||
def _release_install_lock(self):
|
||||
self.window_main.configs.setValue("SystemStatus","abnormal_reboot",str(False))
|
||||
self.window_main.configs_uncover.setValue("SystemStatus","abnormal_reboot",str(False))
|
||||
self.window_main.inhibit_shutdown.unlock()
|
||||
|
||||
def _message_to_plymouth(self,message):
|
||||
|
|
2
backend/data/system-updater.conf → backend/data/system-updater-coverable.conf
Normal file → Executable file
2
backend/data/system-updater.conf → backend/data/system-updater-coverable.conf
Normal file → Executable file
|
@ -1,6 +1,4 @@
|
|||
[SystemStatus]
|
||||
abnormal_reboot = False
|
||||
close_source_filter = False
|
||||
upload_upgrade_log = False
|
||||
priority_upgrade_restart = True
|
||||
|
|
@ -1,13 +1,6 @@
|
|||
[AutoUpgrade]
|
||||
upgradelist =
|
||||
|
||||
[SystemStatus]
|
||||
abnormal_reboot = False
|
||||
close_source_filter = False
|
||||
|
||||
[ConfigPkgStatus]
|
||||
check_resover_remove = False
|
||||
check_frontend_pkg = True
|
||||
upload_upgrade_log = False
|
||||
|
||||
[InstallMode]
|
||||
shutdown_install = False
|
||||
|
|
|
@ -93,7 +93,7 @@ if __name__ == "__main__":
|
|||
# app.check_frontend_pkg()
|
||||
|
||||
#当出现安装过程中异常的重启时 开机直接进行修复操作
|
||||
if app.configs.getWithDefault("SystemStatus", "abnormal_reboot", False) == True:
|
||||
if app.configs_uncover.getWithDefault("SystemStatus", "abnormal_reboot", False) == True:
|
||||
app.start_update()
|
||||
|
||||
app.run()
|
Loading…
Reference in New Issue