Merge branch 'backend_dev' of gitlab2.kylin.com:kylin-desktop/update-manager-group/kylin-system-updater into backend_dev

This commit is contained in:
luoxueyi 2021-12-09 17:44:42 +08:00
commit 424e798534
2 changed files with 11 additions and 3 deletions

View File

@ -32,6 +32,7 @@ import apt
import apt_pkg
apt_pkg.init_config()
import shutil
import locale
import logging
import re
@ -738,7 +739,7 @@ def LockedPreventShutdown():
return False
if not os.path.exists(FILELOCK_PATH):
logging.error("File(%s) is not exists and will be create",FILELOCK_PATH)
logging.info("File(%s) is not exists and will be create",FILELOCK_PATH)
os.makedirs(FILELOCK_PATH)
try:
@ -763,6 +764,14 @@ def unLockedEnableShutdown():
logging.info("Shutdown Has been unlocked...")
pidfile.close()
pidfile = None
# Fix 修复权限问题 当普通用户无法使用 所以直接删除目录
if os.path.exists(FILELOCK_PATH):
shutil.rmtree(FILELOCK_PATH)
logging.info('Emptying the lockPath(%s) is complete...',FILELOCK_PATH)
else:
logging.info("Emptying the lockPath(%s) is Failed...",FILELOCK_PATH)
return True
except Exception as e:
logging.error("unlock failed." + str(e))

View File

@ -394,8 +394,6 @@ class UpdateManager():
"var/run/reboot-required"))
def _check_cache_broken(self,cache):
logging.info("Check: System Apt Cache for Broken...")
with cache.actiongroup():
if cache.get_changes():
cache.clear()
@ -406,6 +404,7 @@ class UpdateManager():
#获取那些依赖关系不满足导致的问题
logging.info(get_broken_details(cache))
else:
logging.info("Check: System Apt Cache for Broken Successfully...")
return
try: