调用提示
This commit is contained in:
parent
02c87f73ba
commit
21740cbd77
|
@ -759,8 +759,30 @@ def deb_verify(deb_path, _isinstall = False):
|
|||
return 3
|
||||
|
||||
def PolicyKit_Authority(details = '', sender = None):
|
||||
_allow_kylinsign = False
|
||||
_verify_kylinsign = False
|
||||
try:
|
||||
#获取未知来源应用安装策略Unknown sources apply installation policies
|
||||
inst_policies_path = "/etc/dpkg/dpkg.cfg"
|
||||
if os.path.isfile(inst_policies_path):
|
||||
with open(inst_policies_path, "r") as f:
|
||||
lines = f.readlines()
|
||||
for line in lines:
|
||||
if "allow-kylinsign" in line:
|
||||
_allow_kylinsign = True
|
||||
if "verify-kylinsign" in line:
|
||||
_verify_kylinsign = True
|
||||
if _allow_kylinsign == True and _verify_kylinsign == False: #策略: 阻止
|
||||
logging.debug("unknown sources apply installation policies: deter")
|
||||
return False,_("The package is unsigned, refuses to install.")
|
||||
elif _allow_kylinsign == True and _verify_kylinsign == True: #策略: 警告
|
||||
logging.debug("unknown sources apply installation policies: warning")
|
||||
elif _allow_kylinsign == False and _verify_kylinsign == False: #策略: 关闭
|
||||
logging.debug("unknown sources apply installation policies: close")
|
||||
else:
|
||||
logging.warning("Unknown sources apply installation policies get failed.")
|
||||
|
||||
#用户鉴权
|
||||
details = {'polkit.message':details}
|
||||
cancel_id = ''
|
||||
action = "cn.kylinos.KylinSystemUpdater.action"
|
||||
|
|
Loading…
Reference in New Issue