增加进度文件
This commit is contained in:
parent
40509aed04
commit
834b696af7
|
@ -875,6 +875,20 @@ def InhibitShutdownLock(preshutdown_handler):
|
|||
# return
|
||||
logging.debug("Waiting for signal to start operation ")
|
||||
|
||||
# 写入进度文件
|
||||
def WriteProgressLog(progress):
|
||||
progress_log = "/var/run/unattended-upgrades.progress"
|
||||
try:
|
||||
if not os.path.exists("/var/run/"):
|
||||
os.makedirs("/var/run/")
|
||||
with open(progress_log, "w") as f:
|
||||
per=str(int(float(progress)))
|
||||
f.write("%s"%per)
|
||||
except Exception as e:
|
||||
logging.error(e)
|
||||
return False
|
||||
return True
|
||||
|
||||
# 关机信号回调函数
|
||||
def prepare_for_shutdown_handler():
|
||||
""" Handle PrepareForShutdown() """
|
||||
|
|
|
@ -21,7 +21,7 @@ import dbus,time
|
|||
from gi.repository import GLib
|
||||
import os
|
||||
from importlib import reload
|
||||
from SystemUpdater.Core.utils import unLockedEnableShutdown
|
||||
from SystemUpdater.Core.utils import unLockedEnableShutdown, WriteProgressLog
|
||||
|
||||
# 超时检测 秒单位
|
||||
UPDATER_IDLE_CHECK_INTERVAL = 5
|
||||
|
@ -169,6 +169,7 @@ class InstallBackendAptdaemon(InstallBackend):
|
|||
"""Commit a list of package adds and removes"""
|
||||
try:
|
||||
reinstall = downgrade = []
|
||||
model = 9
|
||||
trans = yield self.client.commit_packages(
|
||||
pkgs_install, reinstall, pkgs_remove, purge = pkgs_purge, upgrade = pkgs_upgrade,
|
||||
downgrade = downgrade,download = model, defer=True)
|
||||
|
@ -370,7 +371,8 @@ class InstallBackendAptdaemon(InstallBackend):
|
|||
|
||||
self.window_main.dbusController.UpdateDloadAndInstStaChanged(upgrade_content,progress,status,details)
|
||||
elif action == self.ACTION_INSTALLONLY:
|
||||
|
||||
# 写入进度至状态文件
|
||||
WriteProgressLog(progress)
|
||||
self.window_main.dbusController.UpdateDloadAndInstStaChanged(upgrade_content,progress,status,details)
|
||||
|
||||
elif action == self.ACTION_DOWNLOADONLY:
|
||||
|
|
Loading…
Reference in New Issue