部署方式切换为运行时部署的方式,以及增加Plymouth关机安装界面
This commit is contained in:
parent
f7eb82d010
commit
975ea7b496
|
@ -2,6 +2,7 @@
|
|||
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
|
||||
import os
|
||||
import json
|
||||
import subprocess
|
||||
import dbus,time,sys
|
||||
import logging
|
||||
from .Core.errors import *
|
||||
|
@ -16,7 +17,6 @@ from .UpdateManagerDbus import UpdateManagerDbusController,UPDATER_DBUS_INTERFAC
|
|||
from SystemUpdater.Core.UpdaterConfigParser import UpgradeConfig
|
||||
from .Core.MyCache import MyCache
|
||||
from .UpdatesAvailable import UpdatesAvailable
|
||||
import subprocess
|
||||
|
||||
OUTPUT_JSON_PATH = '/var/cache/kylin-system-updater/json/'
|
||||
SYSTEM_UPDATE_GROUPS = "kylin-update-desktop-system"
|
||||
|
@ -129,9 +129,9 @@ class UpdateManager():
|
|||
groups_base_info = {}
|
||||
output_json = {}
|
||||
try:
|
||||
if not os.path.exists(OUTPUT_JSON_PATH):
|
||||
os.makedirs(OUTPUT_JSON_PATH)
|
||||
logging.info('making the ConfigPath(%s) is complete...',OUTPUT_JSON_PATH)
|
||||
if not os.path.exists(output_path):
|
||||
os.makedirs(output_path)
|
||||
logging.info('making the ConfigPath(%s) is complete...',output_path)
|
||||
|
||||
output_config_name = output_path + SYSTEM_UPDATE_GROUPS + '.json'
|
||||
|
||||
|
|
|
@ -31,11 +31,9 @@ class BackendBaseOstree(GObject.GObject):
|
|||
self._async_progress = None
|
||||
self.error_code = ''
|
||||
self.exit = None
|
||||
|
||||
if sysroot_path:
|
||||
sysroot_path = Gio.File.new_for_path(sysroot_path)
|
||||
self.test_mode = True
|
||||
|
||||
|
||||
self.sysroot = OSTree.Sysroot.new(sysroot_path)
|
||||
self.sysroot.set_mount_namespace_in_use()
|
||||
self.sysroot.initialize()
|
||||
|
@ -271,16 +269,24 @@ class DeployBackend(BackendBaseOstree):
|
|||
origin_refspec = origin_remote+":"+refs
|
||||
self.origin.set_string("origin","refspec",origin_refspec)
|
||||
|
||||
self._start_plymouth_splash()
|
||||
self._check_plymouth_state()
|
||||
|
||||
self._message_to_plymouth(_("The system is installing updates. Please do not turn off your computer. "))
|
||||
self._progress_to_plymouth(10)
|
||||
|
||||
#执行清理任何先前部分失败留下的数据。
|
||||
ret = sysroot.prepare_cleanup(None)
|
||||
|
||||
self._progress_to_plymouth(60)
|
||||
|
||||
# 最终完成阶段在关机的时候
|
||||
logging.info("start deploy available_refs:%s new_revision:%s...",refs,new_revision)
|
||||
if self.test_mode:
|
||||
ret,new_deployment = sysroot.deploy_tree(self.osname,new_revision,self.origin,self.merge_deployment,None,None)
|
||||
sysroot.simple_write_deployment(self.osname,new_deployment,self.merge_deployment,0,None)
|
||||
else:
|
||||
ret,new_deployment = sysroot.stage_tree(self.osname,new_revision,self.origin,self.merge_deployment,None,None)
|
||||
ret,new_deployment = sysroot.deploy_tree(self.osname,new_revision,self.origin,self.merge_deployment,None,None)
|
||||
sysroot.simple_write_deployment(self.osname,new_deployment,self.merge_deployment,0,None)
|
||||
|
||||
self._progress_to_plymouth(90)
|
||||
# ret,new_deployment = sysroot.stage_tree(self.osname,new_revision,self.origin,self.merge_deployment,None,None)
|
||||
|
||||
# 健全性检查
|
||||
# rootfs_path = sysroot.get_deployment_dirpath(new_deployment)
|
||||
|
@ -349,7 +355,8 @@ class RollbackBackend(BackendBaseOstree):
|
|||
logging.info("start reollback checksum:%s...",rollback_csum)
|
||||
ret = sysroot.write_deployments(new_deployments,None)
|
||||
|
||||
refspec = new_deployments.get_string("origin","refspec")
|
||||
origin = new_deployments.get_origin()
|
||||
refspec = origin.get_string("origin","refspec")
|
||||
ret,origin_remote,origin_ref = OSTree.parse_refspec(refspec)
|
||||
|
||||
trans.available_refs = origin_ref
|
||||
|
|
Loading…
Reference in New Issue