增加判断是否需要注销以及重启
This commit is contained in:
parent
ba170cd6ff
commit
fed594d378
|
@ -275,8 +275,6 @@ class UpdateManager():
|
|||
upgrade_list = self.update_list.local_upgrade_data.upgrade_groups + self.update_list.local_upgrade_data.single_pkgs
|
||||
#发送更新升级列表完成的标志
|
||||
self.dbusController.DistUpdateDetectFinished(_success,upgrade_list,header,desc)
|
||||
#检查安装完成之后需要重启吗
|
||||
self.is_reboot_required()
|
||||
#清空cache
|
||||
if self.cache != None and self.cache.get_changes():
|
||||
self.cache.clear()
|
||||
|
@ -435,16 +433,6 @@ class UpdateManager():
|
|||
|
||||
return _success,header,desc
|
||||
|
||||
def is_reboot_required(self):
|
||||
"""If a reboot is required to get all changes into effect."""
|
||||
return os.path.exists(os.path.join(apt_pkg.config.find_dir("Dir"),
|
||||
"var/run/reboot-required"))
|
||||
|
||||
def is_logout_required(self):
|
||||
"""If a reboot is required to get all changes into effect."""
|
||||
return os.path.exists(os.path.join(apt_pkg.config.find_dir("Dir"),
|
||||
"var/run/logout-required"))
|
||||
|
||||
def _check_cache_broken(self,cache):
|
||||
with cache.actiongroup():
|
||||
if cache.get_changes():
|
||||
|
|
|
@ -558,3 +558,8 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
@dbus.service.signal(UPDATER_DBUS_INTERFACE, signature='sa{sv}')
|
||||
def KumSnapSignal(self, type_msg, msg):
|
||||
logging.info(COLORLOG_PREFIX + "Emitting" + COLORLOG_SUFFIX +" KumSnapSignal type_msg = %s,msg = %s",type_msg,str(msg))
|
||||
|
||||
#重启和注销请求信号
|
||||
@dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='s')
|
||||
def RebootLogoutRequired(self,required_status=''):
|
||||
logging.info(COLORLOG_PREFIX + "Emitting"+ COLORLOG_SUFFIX + " RebootLogoutRequired required_status = %s",required_status)
|
|
@ -8,6 +8,7 @@ import os
|
|||
from gettext import gettext as _
|
||||
|
||||
import apt
|
||||
import apt_pkg
|
||||
from SystemUpdater.Core.utils import (
|
||||
unLockedEnableShutdown,
|
||||
check_free_space,
|
||||
|
@ -437,6 +438,12 @@ class InstallBackend():
|
|||
self.cache.clear()
|
||||
|
||||
self.window_main.dbusController.UpdateInstallFinished(success,upgrade_content,error_string,error_desc)
|
||||
|
||||
#更新完成之后检查是否需要重启
|
||||
if self.is_reboot_required() == True:
|
||||
self.window_main.dbusController.RebootLogoutRequired("reboot")
|
||||
elif self.is_logout_required() == True:
|
||||
self.window_main.dbusController.RebootLogoutRequired("logout")
|
||||
|
||||
elif action == self.ACTION_UPDATE:
|
||||
if success == False and 'The following signatures' in self.trans_error_details:
|
||||
|
@ -541,6 +548,17 @@ class InstallBackend():
|
|||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
|
||||
|
||||
def is_reboot_required(self):
|
||||
"""If a reboot is required to get all changes into effect."""
|
||||
return os.path.exists(os.path.join(apt_pkg.config.find_dir("Dir"),
|
||||
"var/run/reboot-required"))
|
||||
|
||||
def is_logout_required(self):
|
||||
"""If a logout is required to get all changes into effect."""
|
||||
return os.path.exists(os.path.join(apt_pkg.config.find_dir("Dir"),
|
||||
"var/run/logout-required"))
|
||||
|
||||
# try aptdaemon
|
||||
if os.path.exists("/usr/sbin/aptd") \
|
||||
and "UPDATE_MANAGER_FORCE_BACKEND_SYNAPTIC" not in os.environ:
|
||||
|
|
|
@ -200,7 +200,7 @@
|
|||
| FixBrokenStatusChanged | iiisss | 修复依赖的状态信号 |
|
||||
| PurgePackagesFinished | iss | 卸载完成信号 |
|
||||
| PurgePkgStatusChanged | bss | 卸载进度信息以及状态信息 |
|
||||
| | | |
|
||||
| RebootLogoutRequired | s | 请求重启或者注销的信号 |
|
||||
| | | |
|
||||
|
||||
|
||||
|
@ -373,7 +373,24 @@
|
|||
InstalldebFinished success = False , error_string = 下载软件包文件失败 , error_desc = 检查您的网络连接。
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#### RebootLogoutRequired
|
||||
|
||||
- `介绍:`请求重启和注销的信号
|
||||
|
||||
- `出参`: `s:` "reboot" 表示重启 "logout"表示注销
|
||||
|
||||
- `示例:`
|
||||
|
||||
```sh
|
||||
Emitting RebootLogoutRequired required_status = reboot
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue