Merge branch 'backend_dev' of gitlab2.kylin.com:kylin-desktop/update-manager-group/kylin-system-updater into backend_dev
This commit is contained in:
commit
40509aed04
|
@ -41,13 +41,19 @@ class UpgradeConfig(SafeConfigParser):
|
|||
def reReadConfigFiles(self):
|
||||
self.read(self.config_files)
|
||||
|
||||
def setValue(self, section, option, value=None,is_write = False):
|
||||
def setValue(self, section, option, value=None,is_write = True):
|
||||
if option != 'upgradelist':
|
||||
logging.info("setValue section:%s option:%s value:%s",section, option, value)
|
||||
logging.info("SetValue Section:%s Option:%s Value:%s",section, option, value)
|
||||
|
||||
try:
|
||||
self.set(section, option,value)
|
||||
except KeyError:
|
||||
logging.error("Error: setValue section:%s option:%s value:%s",section, option, value)
|
||||
return False
|
||||
if is_write == True:
|
||||
with open(self.config_files[0], 'w+') as configfile:
|
||||
self.write(configfile)
|
||||
return True
|
||||
|
||||
def getWithDefault(self, section, option, default):
|
||||
try:
|
||||
|
|
|
@ -23,7 +23,6 @@ from .Core.loop import mainloop
|
|||
from .Core.DataAcquisition import UpdateMsgCollector
|
||||
|
||||
from gettext import gettext as _
|
||||
from SystemUpdater.backend import DownloadBackend as downb
|
||||
from SystemUpdater.Core.UpdaterConfigParser import UpgradeConfig
|
||||
from SystemUpdater.Core.utils import get_broken_details,get_lis_from_cache,KillProcessUU
|
||||
from SystemUpdater.Core.DpkgInstallProgress import LogInstallProgress
|
||||
|
@ -31,6 +30,7 @@ from SystemUpdater.Core.DpkgInstallProgress import LogInstallProgress
|
|||
class UpdateManager():
|
||||
SELF_PKG_NAME = 'kylin-system-updater'
|
||||
GROUPS_PKG_NAME = 'kylin-update-desktop-config'
|
||||
APTD_PKG_NAME = "aptdaemon"
|
||||
INSTALL_ALONE_PROGRESS = "alone"
|
||||
RUN_UNATTENDED_UPGRADE = '/var/run/unattended-upgrades.pid'
|
||||
RETRY_LIMIT_NUM = 1
|
||||
|
@ -69,11 +69,21 @@ class UpdateManager():
|
|||
self.is_disc_source = False
|
||||
|
||||
#是否开启关机后安装或者重启安装模式
|
||||
self.later_install = self.configs.getWithDefault("InstallModel", "laterinstall", False)
|
||||
if self.later_install == True:
|
||||
if self.shutdown_install_model() == True:
|
||||
self.upgrade_partial = []
|
||||
logging.info("Check: Now install model use to laterinstall model...")
|
||||
logging.info("Now install model use to shutdown install model...")
|
||||
|
||||
def check_auto_install(self):
|
||||
return self.configs.getWithDefault("InstallModel", "auto_install", False)
|
||||
|
||||
def check_manual_install(self):
|
||||
return self.configs.getWithDefault("InstallModel", "manual_install", False)
|
||||
|
||||
def shutdown_install_model(self):
|
||||
return self.configs.getWithDefault("InstallModel", "shutdown_install", False)
|
||||
|
||||
def reset_manaul_install(self):
|
||||
self.configs.setValue("InstallModel","manual_install",str(False),True)
|
||||
|
||||
#检查是否需要重新启动aptdeamon 目前需要重启的有限速功能
|
||||
def check_restart_aptdeamon(self):
|
||||
|
@ -126,7 +136,7 @@ class UpdateManager():
|
|||
#进行升级的操作
|
||||
def start_install(self,upgrade_mode,not_resolver = False,partial_upgrade_list = []):
|
||||
try:
|
||||
if self.later_install == True and upgrade_mode != InstallBackend.MODE_UPGRADE_SINGLE:
|
||||
if self.shutdown_install_model() == True and upgrade_mode != InstallBackend.MODE_UPGRADE_SINGLE:
|
||||
#部分升级的方式 计算的时候 补上上次更新的内容一起计算
|
||||
if upgrade_mode == InstallBackend.MODE_UPGRADE_PARTIAL:
|
||||
partial_upgrade_list += self.upgrade_partial
|
||||
|
@ -141,6 +151,7 @@ class UpdateManager():
|
|||
resolver_backend.start(upgrade_mode,partial_upgrade_list)
|
||||
else:
|
||||
if not_resolver == True:
|
||||
KillProcessUU(self.RUN_UNATTENDED_UPGRADE)
|
||||
install_backend = get_backend(self, InstallBackend.ACTION_INSTALL)
|
||||
install_backend.start(upgrade_mode,partial_upgrade_list)
|
||||
else:
|
||||
|
@ -149,14 +160,6 @@ class UpdateManager():
|
|||
except Exception as e:
|
||||
logging.error(e)
|
||||
|
||||
#download only
|
||||
def download_backend(self, pkgs):
|
||||
try:
|
||||
download_backend = downb.DownloadBackend(self)
|
||||
download_backend.downloadpkgs(pkgs)
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
|
||||
#download only 2.0
|
||||
def start_download(self, pkgs):
|
||||
try:
|
||||
|
@ -175,15 +178,15 @@ class UpdateManager():
|
|||
desc = ''
|
||||
|
||||
try:
|
||||
self.later_install = self.configs.getWithDefault("InstallModel", "laterinstall", False)
|
||||
if self.later_install == True:
|
||||
self.upgrade_partial = []
|
||||
logging.info("Check: Now install model use to laterinstall model...")
|
||||
|
||||
#每次更新之前 重新读取配置文件 刷新参数
|
||||
self.configs.reReadConfigFiles()
|
||||
self.retry_limit = self.RETRY_LIMIT_NUM
|
||||
|
||||
if self.shutdown_install_model() == True:
|
||||
logging.info("Check: Now install model use to shutdown_install model...")
|
||||
self.upgrade_partial = []
|
||||
self.reset_manaul_install()
|
||||
|
||||
#检查 光盘源
|
||||
if self._check_disc_source() == True:
|
||||
logging.info("Use to CD-Source and Turn off NetworkCheck and CloseFiter...")
|
||||
|
@ -407,6 +410,12 @@ class UpdateManager():
|
|||
if _success == False:
|
||||
return _success,header,desc
|
||||
|
||||
#检查自己是否需要升级更新
|
||||
if self.options.no_check_selfupgrade is False:
|
||||
_success,header,desc = self._check_aptd_upgrade(self.cache)
|
||||
if _success == False:
|
||||
return _success,header,desc
|
||||
|
||||
#检查更新分组配置表
|
||||
_success,header,desc = self._check_group_config(self.cache)
|
||||
if _success == False and self.configs.getWithDefault("ConfigPkgStatus", "mustexistconfigpkg", True) == True:
|
||||
|
@ -425,12 +434,12 @@ class UpdateManager():
|
|||
#2、 安装JSON分组配置文件包 安装完毕会重新调start_available --> here 安装失败就直接退出不会进行下面的操作
|
||||
try:
|
||||
if self.SELF_PKG_NAME in cache:
|
||||
pkg_json = cache[self.SELF_PKG_NAME]
|
||||
self_pkg = cache[self.SELF_PKG_NAME]
|
||||
#是否安装
|
||||
if pkg_json.is_installed and pkg_json.is_upgradable:
|
||||
if self_pkg.is_installed and self_pkg.is_upgradable:
|
||||
logging.info("Check: Self-Updater(%s) start upgrading From %s to %s...",self.SELF_PKG_NAME,\
|
||||
pkg_json.installed.source_version,pkg_json.candidate.source_version)
|
||||
pkg_json.mark_upgrade()
|
||||
self_pkg.installed.source_version,self_pkg.candidate.source_version)
|
||||
self_pkg.mark_upgrade()
|
||||
|
||||
self.start_install(InstallBackend.MODE_UPGRADE_SINGLE,True)
|
||||
#直接退出 进行安装程序
|
||||
|
@ -438,7 +447,7 @@ class UpdateManager():
|
|||
header = self.INSTALL_ALONE_PROGRESS
|
||||
return _success,header,desc
|
||||
else:
|
||||
logging.info("Check: Self-Updater(%s:%s) No need to upgrade...",self.SELF_PKG_NAME,pkg_json.installed.source_version)
|
||||
logging.info("Check: Self-Updater(%s:%s) No need to upgrade...",self.SELF_PKG_NAME,self_pkg.installed.source_version)
|
||||
#直接退出 进行之后的动作
|
||||
_success = True
|
||||
return _success,header,desc
|
||||
|
@ -499,17 +508,43 @@ class UpdateManager():
|
|||
_success = False
|
||||
return _success,header,desc
|
||||
|
||||
#FIXME:
|
||||
#3、 判断目录是JSON配置文件夹是否缺失 缺失后进行修复 卸载重新安装步骤
|
||||
# if not os.path.exists(INPUT_CONFIG_PATH):
|
||||
# logging.info("groups JSON Config Path(%s) Missing and Trying to fix...",INPUT_CONFIG_PATH)
|
||||
# #将软件包卸载 之后进行重新安装here --> purge --> start_available 进行判断是否安装未安装重新安装
|
||||
# # self.start_install_alone(pkgs_purge = [self.GROUPS_PKG_NAME])
|
||||
# #直接退出
|
||||
# _success = False
|
||||
# header = self.INSTALL_ALONE_PROGRESS
|
||||
# return _success,header,desc
|
||||
return _success,header,desc
|
||||
|
||||
def _check_aptd_upgrade(self,cache):
|
||||
_success = True
|
||||
header = ''
|
||||
desc = ''
|
||||
#2、 安装JSON分组配置文件包 安装完毕会重新调start_available --> here 安装失败就直接退出不会进行下面的操作
|
||||
try:
|
||||
if self.APTD_PKG_NAME in cache:
|
||||
self_pkg = cache[self.APTD_PKG_NAME]
|
||||
#是否安装
|
||||
if self_pkg.is_installed and self_pkg.is_upgradable:
|
||||
logging.info("Check: Aptdaemon(%s) start upgrading From %s to %s...",self.APTD_PKG_NAME,\
|
||||
self_pkg.installed.source_version,self_pkg.candidate.source_version)
|
||||
self_pkg.mark_upgrade()
|
||||
|
||||
self.start_install(InstallBackend.MODE_UPGRADE_SINGLE,True)
|
||||
#直接退出 进行安装程序
|
||||
_success = False
|
||||
header = self.INSTALL_ALONE_PROGRESS
|
||||
return _success,header,desc
|
||||
else:
|
||||
logging.info("Check: Aptdaemon(%s:%s) No need to upgrade...",self.APTD_PKG_NAME,self_pkg.installed.source_version)
|
||||
#直接退出 进行之后的动作
|
||||
_success = True
|
||||
return _success,header,desc
|
||||
else:
|
||||
#没有在cache中就认为不需要升级
|
||||
logging.error("Check: Aptdaemon(%s) The upgrade package is not in Cache...",self.APTD_PKG_NAME)
|
||||
#直接退出 进行之后的动作
|
||||
_success = True
|
||||
return _success,header,desc
|
||||
|
||||
#FIXME: 错误处理未做 报告到控制面板
|
||||
except Exception as e:
|
||||
logging.error(e)
|
||||
_success = True
|
||||
return _success,header,desc
|
||||
|
||||
def _check_system_broken(self,cache):
|
||||
|
|
|
@ -221,6 +221,59 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
mainloop.quit()
|
||||
logging.debug("Exit")
|
||||
|
||||
#检查是否需要安装或者重启安装的请求
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,out_signature='i')
|
||||
def Test(self):
|
||||
try:
|
||||
self.parent.start_install_later()
|
||||
return 0
|
||||
except Exception:
|
||||
return -1
|
||||
|
||||
#检查是否需要安装或者重启安装的请求
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,out_signature='i')
|
||||
def CheckInstallRequired(self):
|
||||
try:
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+' CheckInstallRequired ...')
|
||||
if self.shutdown_install_model() == True:
|
||||
if self.parent.check_manual_install() == True:
|
||||
logging.info("Now need to shutdown install in manual install model...")
|
||||
return 1
|
||||
elif self.parent.check_auto_install() == True:
|
||||
logging.info("Now need to shutdown install in auto install model...")
|
||||
return 2
|
||||
else:
|
||||
return 0
|
||||
else:
|
||||
logging.info("No need to shutdown install in the normal model...")
|
||||
return 0
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
return 0
|
||||
|
||||
#set config value
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='sss',out_signature='b')
|
||||
def SetConfigValue(self,section, option, value):
|
||||
try:
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+' SetConfigValue ...')
|
||||
if self.parent.configs.setValue(str(section), str(option),str(value)) == True:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
#get config value
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='ss',out_signature='bs')
|
||||
def GetConfigValue(self,section, option):
|
||||
try:
|
||||
value = str(self.parent.configs.get(str(section), str(option)))
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+" GetConfigValue section:%s option:%s value:%s ...",section,option,value)
|
||||
return True,value
|
||||
except Exception:
|
||||
logging.error("Error: GetConfigValue section:%s option:%s value:%s",section, option)
|
||||
return False,''
|
||||
|
||||
#Remove all downloaded files.
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,out_signature='b')
|
||||
def Clean(self):
|
||||
|
|
|
@ -1,140 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import os
|
||||
import apt
|
||||
import logging
|
||||
import apt_pkg
|
||||
from defer import inline_callbacks
|
||||
from apt.progress.base import AcquireProgress
|
||||
from gettext import gettext as _
|
||||
|
||||
#python-apt download only
|
||||
class FetchProgress(AcquireProgress):
|
||||
def __init__(self, downdeamon) -> None:
|
||||
super().__init__()
|
||||
self.downd = downdeamon
|
||||
self.dbusDeamon = downdeamon.window_main.dbusController
|
||||
self.kargs = {"desc":"", "err_text":"","status":"", "type":""}
|
||||
self.time = 0
|
||||
|
||||
|
||||
def pulse(self, owner):
|
||||
progress = int((self.current_bytes / self.total_bytes) * 100)
|
||||
total_size = self.total_bytes
|
||||
pkgname = ''
|
||||
tmplist = []
|
||||
current_cps =0
|
||||
if owner.workers[0].current_item != None:
|
||||
pkgname=str(owner.workers[0].current_item.shortdesc)
|
||||
for i in owner.items:
|
||||
allpkgs=os.path.basename(i.destfile)
|
||||
allpkgs = allpkgs.split("_")[0]
|
||||
tmplist.append(allpkgs)
|
||||
current_items = tmplist.index(pkgname)
|
||||
else:
|
||||
current_items = 0
|
||||
current_cps = self.calculatcps()
|
||||
if current_cps == None:
|
||||
current_cps = 0
|
||||
self.dbusDeamon.UpdateDownloadInfo(\
|
||||
current_items, len(owner.items), \
|
||||
self.current_bytes, owner.total_needed, \
|
||||
current_cps)
|
||||
return
|
||||
|
||||
def stop(self):
|
||||
logging.info("fetch progess finished")
|
||||
finish_status = False
|
||||
if self.current_items == self.total_items:
|
||||
finish_status = True
|
||||
else:
|
||||
finish_status = False
|
||||
error_string = "Download " + self.kargs['desc'] + self.kargs['type']
|
||||
error_desc = self.kargs['err_text']
|
||||
self.dbusDeamon.UpdateInstallFinished(finish_status, self.downd.pkglists, error_string, error_desc)
|
||||
return
|
||||
|
||||
def fail(self, acquireitemdesc):
|
||||
desc = acquireitemdesc.shortdesc
|
||||
err_text = acquireitemdesc.owner.error_text
|
||||
status = acquireitemdesc.owner.status
|
||||
type = ""
|
||||
if status == apt_pkg.AcquireItem.STAT_AUTH_ERROR:
|
||||
type = "authentication error"
|
||||
elif status == apt_pkg.AcquireItem.STAT_ERROR:
|
||||
type = "fetch error"
|
||||
elif status == apt_pkg.AcquireItem.STAT_TRANSIENT_NETWORK_ERROR:
|
||||
type = "network error"
|
||||
elif status == apt_pkg.AcquireItem.STAT_IDLE:
|
||||
type = "to be fetched"
|
||||
elif status == apt_pkg.AcquireItem.STAT_FETCHING:
|
||||
type = "fetching"
|
||||
elif status == apt_pkg.AcquireItem.STAT_DONE:
|
||||
type = "finished"
|
||||
else:
|
||||
type = "normal"
|
||||
self.kargs = {"desc":desc, \
|
||||
"err_text":err_text, \
|
||||
"status":status, \
|
||||
"type":type}
|
||||
# self.deamon.DownloadErrorSignal(desc, type, err_text)
|
||||
return
|
||||
|
||||
def start(self):
|
||||
# type: () -> None
|
||||
"""Invoked when the Acquire process starts running."""
|
||||
# Reset all our values.
|
||||
self.current_bytes = 0.0
|
||||
self.current_cps = 0.0
|
||||
self.current_items = 0
|
||||
self.elapsed_time = 0
|
||||
self.fetched_bytes = 0.0
|
||||
self.last_bytes = 0.0
|
||||
self.total_bytes = 0.0
|
||||
self.total_items = 0
|
||||
logging.info("start download ...")
|
||||
|
||||
def calculatcps(self):
|
||||
import datetime
|
||||
if self.time == 0:
|
||||
self.time = datetime.datetime.now()
|
||||
self.currentbyte = self.current_bytes
|
||||
return 0
|
||||
else:
|
||||
time = datetime.datetime.now()
|
||||
if self.current_bytes == self.currentbyte:
|
||||
cps = 0
|
||||
else:
|
||||
cps = (self.current_bytes-self.currentbyte) / (time-self.time).microseconds * 1000000
|
||||
# print((time-self.time).microseconds)
|
||||
# print(self.current_bytes-self.currentbyte)
|
||||
self.currentbyte = self.current_bytes
|
||||
self.time = time
|
||||
return cps
|
||||
|
||||
class DownloadBackend():
|
||||
def __init__(self, window_main):
|
||||
self.window_main = window_main
|
||||
self.pkglists = []
|
||||
|
||||
def downloadpkgs(self, pkgs = []):
|
||||
logging.info("Pkgs: %s", pkgs)
|
||||
self.pkglists = pkgs
|
||||
apt_pkg.init()
|
||||
cache = apt_pkg.Cache()
|
||||
depcache = apt_pkg.DepCache(cache)
|
||||
packagerecords = apt_pkg.PackageRecords(cache)
|
||||
pm = apt_pkg.PackageManager(depcache)
|
||||
sourcelist = apt_pkg.SourceList()
|
||||
sourcelist.read_main_list()
|
||||
try:
|
||||
for pkgname in pkgs:
|
||||
pkg = cache[pkgname]
|
||||
depcache.mark_install(pkg)
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
return False
|
||||
fetcher = apt_pkg.Acquire(FetchProgress(self))
|
||||
pm.get_archives(fetcher, sourcelist, packagerecords)
|
||||
ret = fetcher.run()
|
||||
|
|
@ -131,9 +131,7 @@ class InstallBackend():
|
|||
self.commit(self.action,pkgs_install, pkgs_upgrade, pkgs_remove)
|
||||
elif self.action == self.ACTION_DOWNLOADONLY:
|
||||
#将需要升级的软件包写入配置文件中进行保存
|
||||
self.window_main.configs.setListValue("InstallModel","pkgs_install",pkgs_install)
|
||||
self.window_main.configs.setListValue("InstallModel","pkgs_upgrade",pkgs_upgrade)
|
||||
self.window_main.configs.setListValue("InstallModel","pkgs_remove",pkgs_remove)
|
||||
self._update_to_config(pkgs_install,pkgs_upgrade,pkgs_remove)
|
||||
self.commit(self.action,pkgs_install, pkgs_upgrade, pkgs_remove)
|
||||
except Exception as e:
|
||||
logging.error(e)
|
||||
|
@ -464,6 +462,9 @@ class InstallBackend():
|
|||
self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.SELF_PKG_NAME],error_string,error_desc)
|
||||
#升级本身完成后 退出 有systemd 来进行重启服务
|
||||
self.window_main.dbusController.Quit(None)
|
||||
elif self.window_main.APTD_PKG_NAME in self.cache and self.cache[self.window_main.APTD_PKG_NAME] in self.cache.get_changes():
|
||||
#升级本身完成后 直接重启aptd
|
||||
self.window_main.dbusController.make_aptdeamon_restart()
|
||||
else:
|
||||
#只有安装配置文件包 才会走到此处
|
||||
self.window_main.start_available()
|
||||
|
@ -523,14 +524,14 @@ class InstallBackend():
|
|||
self.window_main.only_update_cache()
|
||||
|
||||
elif action == self.ACTION_INSTALLONLY:
|
||||
self.window_main.configs.setValue("SystemStatus","isabnormalreboot",str(False),True)
|
||||
self.window_main.configs.setValue("SystemStatus","isabnormalreboot",str(False))
|
||||
if success == True:
|
||||
#记录这个过程中是否关机
|
||||
self.window_main.configs.setValue("InstallModel","needlaterinstall",str(False),True)
|
||||
#当升级完成时 将手动和自动安装的标志位全部清空
|
||||
self.window_main.configs.setValue("InstallModel","manual_install",str(False))
|
||||
self.window_main.configs.setValue("InstallModel","auto_install",str(False))
|
||||
|
||||
#安装完成之后清空下载列表
|
||||
self.window_main.configs.setListValue("InstallModel","pkgs_install",[])
|
||||
self.window_main.configs.setListValue("InstallModel","pkgs_upgrade",[])
|
||||
self.window_main.configs.setListValue("InstallModel","pkgs_remove",[])
|
||||
self._update_to_config([],[],[])
|
||||
|
||||
upgrade_content = self.now_upgrade.upgrade_groups + self.now_upgrade.single_pkgs
|
||||
self.window_main.dbusController.UpdateInstallFinished(success,upgrade_content,error_string,error_desc)
|
||||
|
@ -538,15 +539,6 @@ class InstallBackend():
|
|||
elif action == self.ACTION_DOWNLOADONLY:
|
||||
upgrade_content = self.now_upgrade.upgrade_groups + self.now_upgrade.single_pkgs
|
||||
|
||||
if success == True and self.now_upgrade.upgrade_mode == self.MODE_UPGRADE_PARTIAL:
|
||||
self.window_main.upgrade_partial += upgrade_content
|
||||
|
||||
#如果下载成功 就标志需要 安装重启
|
||||
if success == True:
|
||||
self.window_main.configs.setValue("InstallModel","needlaterinstall",str(True),True)
|
||||
else:
|
||||
self.window_main.configs.setValue("InstallModel","needlaterinstall",str(False),True)
|
||||
|
||||
if self.is_version_upgrade == True and self.is_need_retry == True and success == False:
|
||||
#增加重试次数的限制
|
||||
if self.window_main.retry_limit != 0:
|
||||
|
@ -555,6 +547,15 @@ class InstallBackend():
|
|||
self.window_main.retry_limit = self.window_main.retry_limit - 1
|
||||
return
|
||||
|
||||
if success == True and self.now_upgrade.upgrade_mode == self.MODE_UPGRADE_PARTIAL:
|
||||
self.window_main.upgrade_partial += upgrade_content
|
||||
|
||||
#如果下载成功 就标志需要 安装重启
|
||||
if success == True:
|
||||
self.window_main.configs.setValue("InstallModel","manual_install",str(True),True)
|
||||
else:
|
||||
self.window_main.configs.setValue("InstallModel","manual_install",str(False),True)
|
||||
|
||||
self.window_main.dbusController.UpdateDownloadFinished(success,upgrade_content,error_string,error_desc)
|
||||
|
||||
elif action == self.ACTION_UPDATE:
|
||||
|
@ -595,6 +596,12 @@ class InstallBackend():
|
|||
error_desc = ''
|
||||
self.window_main.dbusController.InstalldebFinished(success,error_string,error_desc)
|
||||
|
||||
|
||||
def _update_to_config(self,pkgs_install,pkgs_upgrade,pkgs_remove):
|
||||
self.window_main.configs.setListValue("InstallModel","pkgs_install",pkgs_install)
|
||||
self.window_main.configs.setListValue("InstallModel","pkgs_upgrade",pkgs_upgrade)
|
||||
self.window_main.configs.setListValue("InstallModel","pkgs_remove",pkgs_remove)
|
||||
|
||||
#将安装完成的插入数据库 安装失败的计算那些包安装失败了 分类插入数据库中
|
||||
#将安装失败的数据进行返回
|
||||
def _make_insert_info(self,success,is_cancelled,_now_upgrade,error_string,error_desc):
|
||||
|
|
|
@ -9,8 +9,9 @@ isclosefilter = False
|
|||
mustexistconfigpkg = True
|
||||
|
||||
[InstallModel]
|
||||
laterinstall = True
|
||||
needlaterinstall = False
|
||||
shutdown_install = True
|
||||
manual_install = False
|
||||
auto_install = False
|
||||
pkgs_install =
|
||||
pkgs_upgrade =
|
||||
pkgs_remove =
|
|
@ -219,6 +219,51 @@
|
|||
|
||||
|
||||
|
||||
#### SetConfigValue
|
||||
|
||||
- `简介:`设置配置文件的值 配置文件的目录`/var/lib/kylin-system-updater/system-updater.conf`
|
||||
|
||||
- `入参:` `section`, `option`,` value` 不管布尔、列表的数据类型都转化成字符串类型来写入
|
||||
|
||||
- 例如传入"InstallModel","shutdowninstall","False"
|
||||
|
||||
```
|
||||
[InstallModel]
|
||||
shutdowninstall = True
|
||||
pkgs_install =
|
||||
pkgs_upgrade =
|
||||
pkgs_remove =
|
||||
```
|
||||
|
||||
- `出参:`True :设置值成功 False: 设置失败
|
||||
|
||||
#### GetConfigValue
|
||||
|
||||
- `简介:`获取配置文件的值 配置文件的目录`/var/lib/kylin-system-updater/system-updater.conf`
|
||||
|
||||
- `入参:` `section`,` option` 例如传入"InstallModel","shutdowninstall"
|
||||
|
||||
- `出参:` `bool:`True :设置值成功 False: 设置失败 `Value:`值都以字符串类型来返回
|
||||
|
||||
```
|
||||
[InstallModel]
|
||||
shutdowninstall = True
|
||||
pkgs_install =
|
||||
pkgs_upgrade =
|
||||
pkgs_remove =
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### CheckInstallRequired
|
||||
|
||||
- `简介:`检查当前系统是否需要关机安装或者重启安装
|
||||
- `入参:` 无
|
||||
- `出参:` `int:` 类型返回值 表示当前系统是否需要安装 返回值数值含义如下。简要为0时不需要安装,不为零时需要进行提示安装
|
||||
- `1` 手动更新请求当前系统在关机时进行安装软件包
|
||||
- `2` 自动更新请求当前系统在关机时进行安装软件包
|
||||
- `0` 当前系统不需要进行安装
|
||||
|
||||
|
||||
|
||||
### Signal列表
|
||||
|
@ -238,7 +283,7 @@
|
|||
| PurgePackagesFinished | iss | 卸载完成信号 |
|
||||
| PurgePkgStatusChanged | bss | 卸载进度信息以及状态信息 |
|
||||
| RebootLogoutRequired | s | 请求重启或者注销的信号 |
|
||||
| | | |
|
||||
| UpdateInstallFinished | b,as,s,s | 下载完成的信号 |
|
||||
|
||||
|
||||
|
||||
|
@ -319,6 +364,25 @@
|
|||
|
||||
|
||||
|
||||
#### UpdateDownloadFinished
|
||||
|
||||
- `介绍:` 下载完成的信号
|
||||
|
||||
- `出参`: `b:`下载是否成功,`as:`可升级的组列表,`s:`产生错误的结果,`s:`产生错误的原因
|
||||
|
||||
- `示例:`
|
||||
|
||||
```sh
|
||||
pdateInstallFinished success = True , upgrade_group = ['tree'], error_string = 系统升级完成。 , error_desc =
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#### FixBrokenStatusChanged
|
||||
|
||||
- `介绍:` 修复依赖过程中的状态反馈信号
|
||||
|
|
|
@ -9,7 +9,7 @@ date >> updaterlog/base-info
|
|||
dpkg -l | grep kylin-system-updater >> updaterlog/base-info
|
||||
dpkg -l | grep ukui-control-center >> updaterlog/base-info
|
||||
dpkg -l | grep kylin-update-manager >> updaterlog/base-info
|
||||
dpkg -l | grep aptdaemon >> updaterlog/base-info
|
||||
dpkg -l | grep apt-p2p >> updaterlog/base-info
|
||||
echo $1 >> updaterlog/base-info
|
||||
echo "记录BUG产生时间(系统当前时间)以及升级相关的版本信息:"
|
||||
cat updaterlog/base-info
|
||||
|
@ -29,6 +29,9 @@ cp /var/log/dpkg.log updaterlog
|
|||
#收集aptdamon的日志
|
||||
cp /var/log/syslog updaterlog
|
||||
|
||||
#收集aptdamon的日志
|
||||
cp /var/log/apt-p2p.log updaterlog
|
||||
|
||||
outputName="$(date +%m-%d,%H:%M:%S)-updaterLog.tar.gz"
|
||||
|
||||
#将所有的日志进行打包
|
||||
|
|
Loading…
Reference in New Issue