代码拉取完成,页面将自动刷新
同步操作将从 gfdgd xi/Wine 运行器 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/env python3
import os
import sys
import getpass
import PyQt5.QtWidgets as QtWidgets
if __name__ == "__main__":
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
homePath = os.getenv("HOME")
if len(sys.argv) <= 1:
print("参数不足")
sys.exit(1)
app = QtWidgets.QApplication(sys.argv)
# 判断是否已下载镜像
if not os.path.exists(f"{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}"):
QtWidgets.QMessageBox.information(None, "提示", "此镜像未下载解压,无法继续")
exit()
commandList = ""
userName = getpass.getuser()
for i in sys.argv[3:]:
commandList += f"'{i}' "
if commandList.replace(" ", "") == "":
commandList = "bash"
# 需要先取消挂载其它目录以防止冲突
path = f"{homePath}/.deepin-wine-runner-ubuntu-images"
for i in os.listdir(path):
archPath = f"{path}/{i}"
if os.path.isdir(archPath):
for k in os.listdir(archPath):
bottlePath = f"{archPath}/{k}"
if os.path.isdir(bottlePath):
if f"{i}/{k}" == sys.argv[1]:
continue
if os.path.ismount(f"{bottlePath}/dev"):
os.system(f"pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY bash '{programPath}/UnMount.sh' '{bottlePath}' ")
os.system("touch /tmp/deepin-wine-runner-qemu-lock")
# 判断是否挂载
if not os.path.ismount(f"{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}/dev"):
print("文件暂未挂载,开始挂载")
if int(sys.argv[2]):
sys.exit(os.system(f"pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY bash '{programPath}/MountWithoutHome.sh' '{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}' '{userName}' {commandList}"))
else:
sys.exit(os.system(f"pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY bash '{programPath}/Mount.sh' '{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}' '{userName}' {commandList}"))
sys.exit(os.system(f"pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY chroot '--userspec={userName}:{userName}' '{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}/' env 'HOME=/home/{userName}' {commandList}"))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。