1.9.0基础

This commit is contained in:
2022-08-08 15:49:59 +08:00
parent 19cd835b00
commit 70195a794a
50 changed files with 1106 additions and 141 deletions

View File

@@ -3,7 +3,7 @@
###########################################################################################
# 作者gfdgd xi、为什么您不喜欢熊出没和阿布呢
# 版本1.8.0
# 更新时间2022年08月01
# 更新时间2022年08月06
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
# 基于 Python3 构建
###########################################################################################
@@ -22,11 +22,27 @@ if "--help" in sys.argv:
if len(sys.argv) <= 3 or sys.argv[1] == "" or sys.argv[2] == "" or sys.argv[3] == "":
print("您未指定需要安装 gecko 或者 mono 的容器和使用的 wine无法继续")
print("参数:")
print("XXX 参数一 参数二 参数三")
print("参数一为需要安装的容器参数二为需要使用的wine参数三为安装gecko或monogecko/mono个参数位置不能颠倒")
print("XXX 参数一 参数二 参数三 参数四(可略)")
print("参数一为需要安装的容器参数二为需要使用的wine参数三为安装gecko或monogecko/mono参数四为是否缓存(可略),四个参数位置不能颠倒")
sys.exit()
# 获取最新版本的版本号
programVersionList = pyquery.PyQuery(url=f"http://mirrors.ustc.edu.cn/wine/wine/wine-{sys.argv[3]}/")
os.system(f"toilet '{sys.argv[3]}'")
homePath = os.path.expanduser('~')
try:
# 获取最新版本的版本号
programVersionList = pyquery.PyQuery(url=f"http://mirrors.ustc.edu.cn/wine/wine/wine-{sys.argv[3]}/")
except:
print("无法连接下载服务器,将使用本地缓存")
if not os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi") or not os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt"):
print("无本地缓存数据,无法进行、结束")
input("按回车键退出")
exit()
file = open(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt", "r")
version = file.read().replace("\n", "")
print("安装版本:", version)
os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"")
input("安装结束,按回车键退出")
exit()
programVersion = programVersionList("a:last-child").attr.href
# 获取最新版本安装包的URL
programUrl = pyquery.PyQuery(url=f"http://mirrors.ustc.edu.cn/wine/wine/wine-{sys.argv[3]}/{programVersion}")
@@ -42,10 +58,41 @@ if programDownloadUrl == "":
print("无法获取链接,无法继续")
sys.exit()
print(f"当前选择的程序获取路径:{programDownloadUrl}")
if not os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}"):
os.makedirs(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}")
if len(sys.argv) <= 4:
choice = True
else:
choice = (sys.argv[3] == "1")
if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi") and os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt") and choice:
print("版本号校验")
file = open(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt", "r")
version = file.read().replace("\n", "")
if version == programVersion.replace("\n", ""):
print("缓存版本:", version.replace("/", ""))
print("已经缓存,使用本地版本")
file.close()
os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"")
input("安装结束,按回车键退出")
exit()
file = open(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt", "w+")
print("开始下载")
os.system("rm -rf /tmp/winegeckomonoinstall")
os.system(f"rm -rf \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"")
os.system("mkdir -p /tmp/winegeckomonoinstall")
os.system(f"aria2c -x 16 -s 16 -d /tmp/winegeckomonoinstall -o install.msi \"{programDownloadUrl}\"")
os.system(f"aria2c -x 16 -s 16 -d \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}\" -o install.msi \"{programDownloadUrl}\"")
print("开始安装")
os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i /tmp/winegeckomonoinstall/install.msi")
os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"")
try:
if sys.argv[4] == "1":
print("写入缓存")
file.write(programVersion)
file.close()
else:
print("删除临时文件")
os.system(f"rm -rf \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}\"")
except:
print("写入缓存")
file.write(programVersion)
file.close()
input("安装结束,按回车键退出")