增加安装未知来源包策略获取

This commit is contained in:
luoxueyi 2022-10-21 17:26:39 +08:00
parent 5097059cc1
commit 02c87f73ba
5 changed files with 27 additions and 16 deletions

View File

@ -114,9 +114,9 @@ class Sqlite3Server(object):
self.connect_database()
self.cursor.execute(
"insert into installed (appname, version, time, description, icon, statue, keyword, errorcode) values(?,"
"?,?,?,?,?,?,?)",
(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]))
"?,?,?,?,?,?,?)", (args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]))
self.connect.commit()
logging.info("Database: Insert (%s=%s) To installed Complete ...", args[0], args[1])
self.disconnect_database()
# 写入数据到display表中
@ -141,6 +141,7 @@ class Sqlite3Server(object):
"insert into tid_search (key, tid) values(?,?)",
(args[0], args[1]))
self.connect.commit()
logging.info("Database: Insert (%s=%s) To tid_search Complete ...", args[0], args[1])
self.disconnect_database()
# 搜索tid_search表获取tid值
@ -158,39 +159,40 @@ class Sqlite3Server(object):
except Exception as e:
logging.error("Insert error: %s.", str(e))
self.disconnect_database()
logging.info(_("Database: Select data Complete..."))
logging.info("Database: Select tid_search data Complete...")
self.disconnect_database()
return retval
# 读出display表中数据
def select_from_display(self, *args, **kwargs):
self.connect_database()
try:
self.connect_database()
sql = "select "+args[0]+" from display"
self.cursor.execute(sql)
self.connect.commit()
retval = str(self.cursor.fetchone()[0])
self.disconnect_database()
return retval
except Exception as e:
logging.error("select error: %s.", str(e))
self.disconnect_database()
return "Error"
logging.info("Database: Search display Complete (%s=%s) ...", args[0], args[1])
self.disconnect_database()
return retval
# 写入updateinfos表中
def insert_into_updateinfo(self, *args, **kwargs):
self.connect_database()
try:
self.connect_database()
self.cursor.execute(
"insert into updateinfos (appname, version, description, date, status, keyword, errorcode, appname_cn, status_cn, changelog) values(?,"
"?,?,?,?,?,?,?,?,?)",
(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]))
self.connect.commit()
self.disconnect_database()
except Exception as e:
logging.error("Insert error: %s.", str(e))
self.disconnect_database()
logging.info(_("Database: Insert To Complete..."))
logging.info(_("Database: Insert To updateinfos Complete..."))
self.disconnect_database()
# 接收更新列表与信息,生成数据并插入数据库中
def insert_info(self, mode, pkg_list=[], pkg_group=[], adjust_pkg=[], success = False, error_string = '', error_desc = ''):
@ -485,8 +487,8 @@ class Sqlite3Server(object):
# logging.error("Check update error: %s", str(e))
def _system_version_config(self):
self.connect_database()
try:
self.connect_database()
sql = "select init_version from display where id=1"
self.cursor.execute(sql)
_is_init_verison = self.cursor.fetchone()[0]
@ -497,10 +499,10 @@ class Sqlite3Server(object):
sql = "update display set init_version = 'no'"
self.cursor.execute(sql)
self.connect.commit()
self.disconnect_database()
except Exception as e:
logging.error(str(e))
self.disconnect_database()
self.disconnect_database()
def _refresh_system_version(self, update_version='', os_version = '', pseudo_version = False):
try:

View File

@ -428,9 +428,9 @@ class UpdateManager():
logging.error(str(e))
# 进行本地deb包安装的操作
# _check_local_dep : 是否查询本地依赖
# _auto_satisfy : 是否通过网络下载依赖
def start_deb_install(self, deb_path = "", _check_local_dep = False, _auto_satisfy = False, source = '', sender=None):
# _check_local_dep : 是否查询本地依赖
# _auto_satisfy : 是否通过网络下载依赖
header = ''
desc = ''
absolute_path, debname = os.path.split(deb_path)

View File

@ -2758,3 +2758,6 @@ msgstr "自动更新"
msgid "Please check the system time and synchronize the system time before updating."
msgstr "请检查系统时间,同步系统时间后再进行更新。"
msgid "The package is unsigned, refuses to install."
msgstr "软件包未签名,拒绝安装。"

View File

@ -2691,3 +2691,6 @@ msgstr "自動更新"
msgid "Please check the system time and synchronize the system time before updating."
msgstr "請檢查系統時間,同步系統時間后再進行更新。"
msgid "The package is unsigned, refuses to install."
msgstr "軟體包未簽名,拒絕安裝。"

View File

@ -2723,3 +2723,6 @@ msgstr "自動更新"
msgid "Please check the system time and synchronize the system time before updating."
msgstr "請檢查系統時間,同步系統時間后再進行更新。"
msgid "The package is unsigned, refuses to install."
msgstr "軟體包未簽名,拒絕安裝。"