对所有操作软件包的操作都枷锁
This commit is contained in:
parent
c65620d466
commit
1f3aa755a5
|
@ -329,10 +329,7 @@ class InstallBackendAptdaemon(InstallBackend):
|
|||
if progress > 51 and progress < 90 and self.on_install_stage == False:
|
||||
logging.info("The process is now in the installtion phase")
|
||||
self.on_install_stage = True
|
||||
LockedPreventShutdown()
|
||||
|
||||
#进度安装阶段标志位,使用鉴别是否出现安装过程中强制关闭 之后进行修复使用得
|
||||
self.window_main.configs.setValue("SystemStatus","abnormal_reboot",str(True),True)
|
||||
self._start_install_lock()
|
||||
|
||||
#只处理从下载切换到安装时出现的网络问题
|
||||
#当网络波动时下载某些软件包失败时属于异常状态进行重试时 不发送后续进度 等待重试正常是 进行下载安装
|
||||
|
|
|
@ -12,7 +12,7 @@ import apt_pkg
|
|||
import json
|
||||
from SystemUpdater.Core.utils import (
|
||||
unLockedEnableShutdown,
|
||||
get_broken_details
|
||||
LockedPreventShutdown
|
||||
)
|
||||
from SystemUpdater.Core.DataAcquisition import get_east_8_time
|
||||
from apt import Cache
|
||||
|
@ -184,8 +184,7 @@ class InstallBackend():
|
|||
self.now_upgrade,pkgs_install,pkgs_upgrade,pkgs_remove = self._config_to_upgrade()
|
||||
logging.info("ACTION_INSTALL_SHUTDOWN install:%d , upgrade:%d remove:%d",len(pkgs_install),len(pkgs_upgrade),len(pkgs_remove))
|
||||
|
||||
#进度安装阶段标志位,使用鉴别是否出现安装过程中强制关闭 之后进行修复使用得
|
||||
self.window_main.configs.setValue("SystemStatus","abnormal_reboot",str(True),True)
|
||||
# self._start_install_lock()
|
||||
self.commit(self.action,pkgs_install, pkgs_upgrade, pkgs_remove)
|
||||
|
||||
#计算依赖解决方案
|
||||
|
@ -275,6 +274,7 @@ class InstallBackend():
|
|||
# self._action_done(self.action,False,False,header,desc)
|
||||
# return
|
||||
# else:
|
||||
self._start_install_lock()
|
||||
self.purge_packages(partial_upgrade_list)
|
||||
|
||||
#清空所有下载的文件
|
||||
|
@ -290,13 +290,13 @@ class InstallBackend():
|
|||
except UpdateProgressExit as excep:
|
||||
pass
|
||||
except Exception as e:
|
||||
logging.error(e)
|
||||
|
||||
logging.error(e)
|
||||
|
||||
def start_alone(self,partial_upgrade_list = [],_is_install = False):
|
||||
# 安装本地deb包的接口
|
||||
if self.action == self.ACTION_INSTALL_DEB:
|
||||
try:
|
||||
self._start_install_lock()
|
||||
self.install_deb(install_path = partial_upgrade_list, install_force = _is_install)
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
|
@ -532,10 +532,7 @@ class InstallBackend():
|
|||
|
||||
#升级完成后走的分支
|
||||
if action == self.ACTION_INSTALL:
|
||||
#记录这个过程中是否关机
|
||||
self.window_main.configs.setValue("SystemStatus","abnormal_reboot",str(False),True)
|
||||
#解锁 禁止关机
|
||||
unLockedEnableShutdown()
|
||||
self._release_install_lock()
|
||||
self._send_error_code(error_code)
|
||||
|
||||
#单包安装模式 单独处理 目前 更新配置包和升级本身使用
|
||||
|
@ -614,7 +611,7 @@ class InstallBackend():
|
|||
self.window_main.refresh_cache()
|
||||
|
||||
elif action == self.ACTION_INSTALL_SHUTDOWN:
|
||||
self.window_main.configs.setValue("SystemStatus","abnormal_reboot",str(False))
|
||||
# self._release_install_lock()
|
||||
#插入数据库
|
||||
self.window_main.sqlite3_server.insert_info(self.ACTION_INSTALL,self.now_upgrade.single_pkgs,\
|
||||
self.now_upgrade.upgrade_groups,[],success,error_string,error_desc)
|
||||
|
@ -718,15 +715,18 @@ class InstallBackend():
|
|||
logging.warning("fix incomplete install failed.")
|
||||
|
||||
elif action == self.ACTION_REMOVE_PACKAGES:
|
||||
self._release_install_lock()
|
||||
self.window_main.dbusController.PurgePackagesFinished(success,error_string,error_desc)
|
||||
|
||||
elif action == self.ACTION_INSTALL_DEB:
|
||||
self._release_install_lock()
|
||||
#FIXME: '\r\n: \r\n\r\n'就认为是验证失败
|
||||
if success == False and '\r\n: \r\n\r\n' in self.aptd_base.error_details:
|
||||
error_string = _("Package validation failed and installation was rejected.")
|
||||
error_desc = ''
|
||||
self.window_main.dbusController.InstalldebFinished(success,error_string,error_desc)
|
||||
elif action == self.ACTION_BACKGROUND_UPGRADE:
|
||||
self._release_install_lock()
|
||||
UpdateMsg = {}
|
||||
if success:
|
||||
status = 'Success'
|
||||
|
@ -746,6 +746,14 @@ 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))
|
||||
LockedPreventShutdown()
|
||||
|
||||
def _release_install_lock(self):
|
||||
self.window_main.configs.setValue("SystemStatus","abnormal_reboot",str(False))
|
||||
unLockedEnableShutdown()
|
||||
|
||||
def _message_to_plymouth(self,message):
|
||||
subprocess.call(["/bin/plymouth", "message", "--text", message])
|
||||
|
||||
|
|
Loading…
Reference in New Issue