mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-12-13 10:32:03 +08:00
Qemu Run And Chroot Unmount
This commit is contained in:
13
QemuRun.py
13
QemuRun.py
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import getpass
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
||||
if __name__ == "__main__":
|
||||
@@ -12,13 +13,15 @@ if __name__ == "__main__":
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
# 判断是否已下载镜像
|
||||
if not os.path.exists(f"{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}"):
|
||||
if QtWidgets.QMessageBox.information(None, "提示", "此镜像未下载解压,无法继续"):
|
||||
pass
|
||||
QtWidgets.QMessageBox.information(None, "提示", "此镜像未下载解压,无法继续")
|
||||
exit()
|
||||
commandList = ""
|
||||
userName = getpass.getuser()
|
||||
for i in sys.argv[2:]:
|
||||
commandList += f"'{i}'"
|
||||
commandList += f"'{i}' "
|
||||
# 判断是否挂载
|
||||
if not os.path.ismount(f"{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}/proc"):
|
||||
print("文件暂未挂载,开始挂载")
|
||||
sys.exit(os.system(f"pkexec '{programPath}/Mount.sh' '{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}/proc' {commandList}"))
|
||||
sys.exit(os.system(f"pkexec chroot '{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}/proc' {commandList}"))
|
||||
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}"))
|
||||
#print(f"pkexec chroot '{homePath}/.deepin-wine-runner-ubuntu-images/{sys.argv[1]}/' {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 DISPLAY=:0.0 {commandList}"))
|
||||
Reference in New Issue
Block a user