调整更新策略

This commit is contained in:
gfdgd xi 2024-02-01 18:35:21 +08:00
parent 71917c5451
commit 5e325a873e

View File

@ -1275,9 +1275,15 @@ class UpdateWindow():
if os.path.exists("/tmp/spark-deepin-wine-runner/update"): if os.path.exists("/tmp/spark-deepin-wine-runner/update"):
shutil.rmtree("/tmp/spark-deepin-wine-runner/update") shutil.rmtree("/tmp/spark-deepin-wine-runner/update")
os.makedirs("/tmp/spark-deepin-wine-runner/update") os.makedirs("/tmp/spark-deepin-wine-runner/update")
unPackageNew = False
isArch = False
if os.path.exists("/etc/arch-release"):
isArch = True
if UpdateWindow.data["Url-pkg"] == None:
unPackageNew = True
try: try:
print(UpdateWindow.data["Url"]) print(UpdateWindow.data["Url"])
if os.path.exists(f"{programPath}/off-line.lock") or programPath != "/opt/apps/deepin-wine-runner": if os.path.exists(f"{programPath}/off-line.lock") or programPath != "/opt/apps/deepin-wine-runner" or unPackageNew:
# 使用解压法更新 # 使用解压法更新
write_txt("/tmp/spark-deepin-wine-runner/update.sh", f"""#!/bin/bash write_txt("/tmp/spark-deepin-wine-runner/update.sh", f"""#!/bin/bash
echo 删除多余的安装包 echo 删除多余的安装包
@ -1296,6 +1302,21 @@ zenity --info --text=\"更新完毕!\" --ellipsize
""") """)
OpenTerminal("bash /tmp/spark-deepin-wine-runner/update.sh") OpenTerminal("bash /tmp/spark-deepin-wine-runner/update.sh")
return return
else:
if isArch:
# 使用 pacman 安装更新
write_txt("/tmp/spark-deepin-wine-runner/update.sh", f"""#!/bin/bash
echo 删除多余的安装包
rm -rfv /tmp/spark-deepin-wine-runner/update/*
echo 关闭Wine 运行器
python3 "{programPath}/updatekiller.py"
echo 下载安装包
wget -P /tmp/spark-deepin-wine-runner/update {UpdateWindow.data["Url"][0]}
echo 安装安装包
pacman -U /tmp/spark-deepin-wine-runner/update/*
notify-send -i "{iconPath}" "更新完毕!"
zenity --info --text=\"更新完毕!\" --ellipsize
""")
else: else:
# 使用 deb 安装更新 # 使用 deb 安装更新
write_txt("/tmp/spark-deepin-wine-runner/update.sh", f"""#!/bin/bash write_txt("/tmp/spark-deepin-wine-runner/update.sh", f"""#!/bin/bash
@ -3458,6 +3479,9 @@ for i in [
x.setDisabled(True) x.setDisabled(True)
# 有些功能是 Arch Linux 不适用的,需要屏蔽 # 有些功能是 Arch Linux 不适用的,需要屏蔽
if os.path.exists("/etc/arch-release"): if os.path.exists("/etc/arch-release"):
if os.path.exists(f"{programPath}/off-line.lock"):
for i in [p1]:
i.setDisabled(True)
for i in [installLat, installWineHQ, installWineHQOrg, for i in [installLat, installWineHQ, installWineHQOrg,
installBox86CN, installBox86, installBox86Own, addWineDebMirrorForDeepin20]: installBox86CN, installBox86, installBox86Own, addWineDebMirrorForDeepin20]:
i.setDisabled(True) i.setDisabled(True)