mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-04-29 12:49:49 +08:00
修改tmp路径以兼容termux
This commit is contained in:
parent
df5d08cd68
commit
9296914ed5
@ -15,6 +15,8 @@ import PyQt5.QtGui as QtGui
|
||||
import PyQt5.QtCore as QtCore
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
||||
TMPDIR = os.getenv("TMPDIR")
|
||||
|
||||
# 获取用户主目录
|
||||
def get_home():
|
||||
return os.path.expanduser('~')
|
||||
@ -208,9 +210,9 @@ class SaveLogReport():
|
||||
traceback.print_exc()
|
||||
os.system(f"'{programPath}/wrestool' '{binPath}' -x -t 14 > '/tmp/wine-runner-log-icon.png'")
|
||||
# 如果提取成功
|
||||
if os.path.exists("/tmp/wine-runner-log-icon.png"):
|
||||
if os.path.exists(TMPDIR + "/tmp/wine-runner-log-icon.png"):
|
||||
# 转换成 base64 编码
|
||||
self.binIcon = "data:image/jpg;base64," + FileToBase64("/tmp/wine-runner-log-icon.png")
|
||||
self.binIcon = "data:image/jpg;base64," + FileToBase64(TMPDIR + "/tmp/wine-runner-log-icon.png")
|
||||
self.binIconPath = "/tmp/wine-runner-log-icon.png"
|
||||
else:
|
||||
self.binIcon = "Not Found"
|
||||
@ -317,9 +319,9 @@ class SaveLogReport():
|
||||
messagebox.exec_()
|
||||
|
||||
def To7z(self, savePath):
|
||||
os.system("rm -rfv /tmp/wine-runner-log")
|
||||
os.system("mkdir -v /tmp/wine-runner-log")
|
||||
self.ToHtml("/tmp/wine-runner-log/index.html", toZip=True)
|
||||
os.system("rm -rfv $TMPDIR/tmp/wine-runner-log")
|
||||
os.system("mkdir -v $TMPDIR/tmp/wine-runner-log")
|
||||
self.ToHtml(TMPDIR + "/tmp/wine-runner-log/index.html", toZip=True)
|
||||
if os.path.exists(self.binIconPath):
|
||||
shutil.copy(self.binIconPath, f"/tmp/wine-runner-log/{os.path.basename(self.binIconPath)}")
|
||||
lists = ["wine-runner-log-icon.png", "index.html"]
|
||||
@ -332,7 +334,7 @@ class SaveLogReport():
|
||||
else:
|
||||
lists.append(name)
|
||||
shutil.copy(i, f"/tmp/wine-runner-log/{name}")
|
||||
os.system(f"7z a '{savePath}' /tmp/wine-runner-log")
|
||||
os.system(f"7z a '{savePath}' $TMPDIR/tmp/wine-runner-log")
|
||||
|
||||
|
||||
def ToHtml(self, savePath, toZip=False):
|
||||
|
14
StartVM.sh
14
StartVM.sh
@ -12,7 +12,7 @@ CURRENT_DIR=$(cd $(dirname $0); pwd)
|
||||
VBoxManage showvminfo Windows
|
||||
if [[ 0 == $? ]]; then
|
||||
# 检测到虚拟机存在,启动虚拟机
|
||||
VBoxManage startvm Windows > /tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1
|
||||
VBoxManage startvm Windows > $TMPDIR/tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1
|
||||
exit
|
||||
fi
|
||||
# 检查是否有 QEMU
|
||||
@ -73,7 +73,7 @@ if [[ $? == 0 ]] && [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then
|
||||
-m ${use}G -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI \
|
||||
-device AC97 -device ES1370 -device intel-hda -device hda-duplex \
|
||||
--boot 'splash=VM/boot.jpg,menu=on,splash-time=2000' \
|
||||
> /tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all
|
||||
> $TMPDIR/tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all
|
||||
exit
|
||||
fi
|
||||
# 判断系统版本以选择 Qemu
|
||||
@ -102,7 +102,7 @@ if [[ $? == 0 ]] && [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then
|
||||
-m ${use}G -display vnc=:5 -display gtk -usb -nic model=rtl8139 $qemuUEFI \
|
||||
-device AC97 -device ES1370 -device intel-hda -device hda-duplex \
|
||||
--boot 'splash=VM/boot.jpg,menu=on,splash-time=2000' \
|
||||
> /tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all
|
||||
> $TMPDIR/tmp/windows-virtual-machine-installer-for-wine-runner-run.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all
|
||||
exit
|
||||
fi
|
||||
cat ~/.config/deepin-wine-runner/QEMU-ARCH | grep armhf
|
||||
@ -128,7 +128,7 @@ if [[ $? == 0 ]] && [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then
|
||||
-device usb-kbd,id=keyboard,bus=xhci.0,port=2 \
|
||||
-device AC97 -device ES1370 -device intel-hda -device hda-duplex \
|
||||
--boot 'splash=VM/boot.jpg,menu=on,splash-time=2000' \
|
||||
> /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all
|
||||
> $TMPDIR/tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all
|
||||
exit
|
||||
fi
|
||||
$qemuMore qemu-system-arm --hda "$HOME/Qemu/Windows/Windows.qcow2" \
|
||||
@ -140,7 +140,7 @@ if [[ $? == 0 ]] && [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then
|
||||
-device usb-kbd,id=keyboard,bus=xhci.0,port=2 \
|
||||
-device AC97 -device ES1370 -device intel-hda -device hda-duplex \
|
||||
--boot 'splash=VM/boot.jpg,menu=on,splash-time=2000' \
|
||||
> /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all
|
||||
> $TMPDIR/tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all
|
||||
exit
|
||||
fi
|
||||
cat ~/.config/deepin-wine-runner/QEMU-ARCH | grep aarch64
|
||||
@ -167,7 +167,7 @@ if [[ $? == 0 ]] && [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then
|
||||
-device usb-kbd,id=keyboard,bus=xhci.0,port=2 \
|
||||
-device AC97 -device ES1370 -device intel-hda -device hda-duplex \
|
||||
--boot 'splash=VM/boot.jpg,menu=on,splash-time=2000' \
|
||||
> /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all
|
||||
> $TMPDIR/tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all
|
||||
exit
|
||||
fi
|
||||
$qemuMore qemu-system-aarch64 --hda "$HOME/Qemu/Windows/Windows.qcow2" \
|
||||
@ -180,7 +180,7 @@ if [[ $? == 0 ]] && [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then
|
||||
-device usb-kbd,id=keyboard,bus=xhci.0,port=2 \
|
||||
-device AC97 -device ES1370 -device intel-hda -device hda-duplex \
|
||||
--boot 'splash=VM/boot.jpg,menu=on,splash-time=2000' \
|
||||
> /tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all
|
||||
> $TMPDIR/tmp/windows-virtual-machine-installer-for-wine-runner-install.log 2>&1 # 最新的 qemu 已经移除参数 -soundhw all
|
||||
exit
|
||||
fi
|
||||
|
||||
|
@ -6,15 +6,15 @@ echo ' # # #"""" #"""" #"# '
|
||||
echo ' "mmm" "#mm" "#mm" # "m '
|
||||
echo
|
||||
echo
|
||||
cd /tmp
|
||||
cd $TMPDIR/tmp
|
||||
echo 提示:
|
||||
echo Geek Uninstaller 官网访问较慢,所以请耐心等待
|
||||
aria2c -x 16 -s 16 https://geekuninstaller.com/geek.zip
|
||||
unzip geek.zip
|
||||
cd `dirname $0`
|
||||
cp -rv /tmp/geek.exe ./
|
||||
cp -rv $TMPDIR/tmp/geek.exe ./
|
||||
if [[ $? == 0 ]];then
|
||||
exit
|
||||
fi
|
||||
echo "拷贝失败,申请使用 sudo 拷贝"
|
||||
sudo cp -rv /tmp/geek.exe ./
|
||||
sudo cp -rv $TMPDIR/tmp/geek.exe ./
|
@ -1,5 +1,6 @@
|
||||
#!/data/data/com.termux/files/usr/bin/bash
|
||||
CURRENT_DIR=$(cd $(dirname $0); pwd)
|
||||
CURRENT_DIR=$(dirname $(readlink -f "$0"))
|
||||
|
||||
if [[ $DISPLAY == "" ]] && [[ $WAYLAND_DISPLAY == "" ]]; then
|
||||
# 自动配置 NoVNC
|
||||
export DISPLAY=:5
|
||||
|
108
mainwindow.py
108
mainwindow.py
@ -62,6 +62,8 @@ if sys.version_info[0] < 3:
|
||||
if sys.version_info[1] < 6:
|
||||
PythonLower()
|
||||
|
||||
TMPDIR = os.getenv("TMPDIR")
|
||||
|
||||
###################
|
||||
# 程序所需事件
|
||||
###################
|
||||
@ -1273,9 +1275,9 @@ class UpdateWindow():
|
||||
UpdateWindow.update.show()
|
||||
|
||||
def Update():
|
||||
if os.path.exists("/tmp/spark-deepin-wine-runner/update"):
|
||||
shutil.rmtree("/tmp/spark-deepin-wine-runner/update")
|
||||
os.makedirs("/tmp/spark-deepin-wine-runner/update")
|
||||
if os.path.exists(TMPDIR + "/tmp/spark-deepin-wine-runner/update"):
|
||||
shutil.rmtree(TMPDIR + "/tmp/spark-deepin-wine-runner/update")
|
||||
os.makedirs(TMPDIR + "/tmp/spark-deepin-wine-runner/update")
|
||||
unPackageNew = False
|
||||
isArch = False
|
||||
isFedora = False
|
||||
@ -1291,69 +1293,69 @@ class UpdateWindow():
|
||||
print(UpdateWindow.data["Url"])
|
||||
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(TMPDIR + "/tmp/spark-deepin-wine-runner/update.sh", f"""#!/bin/bash
|
||||
echo 删除多余的安装包
|
||||
rm -rfv /tmp/spark-deepin-wine-runner/update/*
|
||||
rm -rfv $TMPDIR/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]}
|
||||
wget -P $TMPDIR/tmp/spark-deepin-wine-runner/update {UpdateWindow.data["Url"][0]}
|
||||
echo 安装安装包
|
||||
cd /tmp/spark-deepin-wine-runner/update
|
||||
cd $TMPDIR/tmp/spark-deepin-wine-runner/update
|
||||
7z x *.deb
|
||||
7z x data.tar
|
||||
cp opt/apps/deepin-wine-runner/* "{programPath}" -rv
|
||||
notify-send -i "{iconPath}" "更新完毕!"
|
||||
zenity --info --text=\"更新完毕!\" --ellipsize
|
||||
""")
|
||||
OpenTerminal("bash /tmp/spark-deepin-wine-runner/update.sh")
|
||||
OpenTerminal("bash $TMPDIR/tmp/spark-deepin-wine-runner/update.sh")
|
||||
return
|
||||
else:
|
||||
if isArch:
|
||||
# 使用 pacman 安装更新
|
||||
write_txt("/tmp/spark-deepin-wine-runner/update.sh", f"""#!/bin/bash
|
||||
write_txt(TMPDIR + "/tmp/spark-deepin-wine-runner/update.sh", f"""#!/bin/bash
|
||||
echo 删除多余的安装包
|
||||
rm -rfv /tmp/spark-deepin-wine-runner/update/*
|
||||
rm -rfv $TMPDIR/tmp/spark-deepin-wine-runner/update/*
|
||||
echo 关闭“Wine 运行器”
|
||||
python3 "{programPath}/updatekiller.py"
|
||||
echo 下载安装包
|
||||
wget -P /tmp/spark-deepin-wine-runner/update {UpdateWindow.data["Url-pkg"][0]}
|
||||
wget -P $TMPDIR/tmp/spark-deepin-wine-runner/update {UpdateWindow.data["Url-pkg"][0]}
|
||||
echo 安装安装包
|
||||
pacman -U /tmp/spark-deepin-wine-runner/update/* --noconfirm
|
||||
pacman -U $TMPDIR/tmp/spark-deepin-wine-runner/update/* --noconfirm
|
||||
notify-send -i "{iconPath}" "更新完毕!"
|
||||
zenity --info --text=\"更新完毕!\" --ellipsize
|
||||
""")
|
||||
elif isFedora:
|
||||
# 使用 yum 安装更新
|
||||
write_txt("/tmp/spark-deepin-wine-runner/update.sh", f"""#!/bin/bash
|
||||
write_txt(TMPDIR + "/tmp/spark-deepin-wine-runner/update.sh", f"""#!/bin/bash
|
||||
echo 删除多余的安装包
|
||||
rm -rfv /tmp/spark-deepin-wine-runner/update/*
|
||||
rm -rfv $TMPDIR/tmp/spark-deepin-wine-runner/update/*
|
||||
echo 关闭“Wine 运行器”
|
||||
python3 "{programPath}/updatekiller.py"
|
||||
echo 下载安装包
|
||||
wget -O /tmp/spark-deepin-wine-runner/update/spark-deepin-wine-runner.rpm {UpdateWindow.data["Url-rpm"][0]}
|
||||
wget -O $TMPDIR/tmp/spark-deepin-wine-runner/update/spark-deepin-wine-runner.rpm {UpdateWindow.data["Url-rpm"][0]}
|
||||
echo 安装安装包
|
||||
yum reinstall /tmp/spark-deepin-wine-runner/update/spark-deepin-wine-runner.rpm -y
|
||||
yum reinstall $TMPDIR/tmp/spark-deepin-wine-runner/update/spark-deepin-wine-runner.rpm -y
|
||||
notify-send -i "{iconPath}" "更新完毕!"
|
||||
zenity --info --text=\"更新完毕!\" --ellipsize
|
||||
""")
|
||||
else:
|
||||
# 使用 deb 安装更新
|
||||
write_txt("/tmp/spark-deepin-wine-runner/update.sh", f"""#!/bin/bash
|
||||
write_txt(TMPDIR + "/tmp/spark-deepin-wine-runner/update.sh", f"""#!/bin/bash
|
||||
echo 删除多余的安装包
|
||||
rm -rfv /tmp/spark-deepin-wine-runner/update/*
|
||||
rm -rfv $TMPDIR/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]}
|
||||
wget -P $TMPDIR/tmp/spark-deepin-wine-runner/update {UpdateWindow.data["Url"][0]}
|
||||
echo 安装安装包
|
||||
dpkg -i /tmp/spark-deepin-wine-runner/update/*
|
||||
dpkg -i $TMPDIR/tmp/spark-deepin-wine-runner/update/*
|
||||
echo 修复依赖关系
|
||||
apt install -f -y
|
||||
notify-send -i "{iconPath}" "更新完毕!"
|
||||
zenity --info --text=\"更新完毕!\" --ellipsize
|
||||
""")
|
||||
OpenTerminal("pkexec bash /tmp/spark-deepin-wine-runner/update.sh")
|
||||
OpenTerminal("pkexec bash $TMPDIR/tmp/spark-deepin-wine-runner/update.sh")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(None, "出现错误,无法继续更新", traceback.format_exc())
|
||||
@ -1472,29 +1474,29 @@ class GetDllFromWindowsISO:
|
||||
# 显示所有内容
|
||||
# 下面内容需要分类讨论
|
||||
if GetDllFromWindowsISO.arch == 0:
|
||||
for i in os.listdir("/tmp/wine-runner-getdll/i386"):
|
||||
for i in os.listdir(TMPDIR + "/tmp/wine-runner-getdll/i386"):
|
||||
if i[-3:] == "dl_":
|
||||
findList.append(i[:-1] + "l")
|
||||
elif GetDllFromWindowsISO.arch == 32:
|
||||
for i in os.listdir("/tmp/wine-runner-getdll-wim/Windows/SysWOW64"):
|
||||
for i in os.listdir(TMPDIR + "/tmp/wine-runner-getdll-wim/Windows/SysWOW64"):
|
||||
if i[-3:] == "dll":
|
||||
findList.append(i[:-1] + "l")
|
||||
elif GetDllFromWindowsISO.arch == 64:
|
||||
for i in os.listdir("/tmp/wine-runner-getdll-wim/Windows/System32"):
|
||||
for i in os.listdir(TMPDIR + "/tmp/wine-runner-getdll-wim/Windows/System32"):
|
||||
if i[-3:] == "dll":
|
||||
findList.append(i[:-1] + "l")
|
||||
GetDllFromWindowsISO.dllListModel.setStringList(findList)
|
||||
return
|
||||
if GetDllFromWindowsISO.arch == 0:
|
||||
for i in os.listdir("/tmp/wine-runner-getdll/i386"):
|
||||
for i in os.listdir(TMPDIR + "/tmp/wine-runner-getdll/i386"):
|
||||
if found in i[:-1] + "l":
|
||||
findList.append(i[:-1] + "l")
|
||||
elif GetDllFromWindowsISO.arch == 32:
|
||||
for i in os.listdir("/tmp/wine-runner-getdll-wim/Windows/SysWOW64"):
|
||||
for i in os.listdir(TMPDIR + "/tmp/wine-runner-getdll-wim/Windows/SysWOW64"):
|
||||
if found in i[:-1] + "l":
|
||||
findList.append(i[:-1] + "l")
|
||||
elif GetDllFromWindowsISO.arch == 64:
|
||||
for i in os.listdir("/tmp/wine-runner-getdll-wim/Windows/System32"):
|
||||
for i in os.listdir(TMPDIR + "/tmp/wine-runner-getdll-wim/Windows/System32"):
|
||||
if found in i[:-1] + "l":
|
||||
findList.append(i[:-1] + "l")
|
||||
if len(isoPath) == 0:
|
||||
@ -1513,27 +1515,27 @@ class GetDllFromWindowsISO:
|
||||
if not os.path.exists(GetDllFromWindowsISO.isoPath.currentText()):
|
||||
QtWidgets.QMessageBox.critical(GetDllFromWindowsISO.message, transla.trans("错误"), transla.trans("您选择的 ISO 镜像文件不存在"))
|
||||
return
|
||||
if os.path.exists("/tmp/wine-runner-getdll"):
|
||||
if os.path.exists(TMPDIR + "/tmp/wine-runner-getdll"):
|
||||
try:
|
||||
os.rmdir("/tmp/wine-runner-getdll")
|
||||
os.system("rm -rf /tmp/wine-runner-getdll-wim")
|
||||
os.rmdir(TMPDIR + "/tmp/wine-runner-getdll")
|
||||
os.system("rm -rf $TMPDIR/tmp/wine-runner-getdll-wim")
|
||||
except:
|
||||
# 如果无法删除可能是挂载了文件
|
||||
os.system("wimunmount /tmp/wine-runner-getdll-wim")
|
||||
os.system("pkexec umount /tmp/wine-runner-getdll")
|
||||
os.system("wimunmount $TMPDIR/tmp/wine-runner-getdll-wim")
|
||||
os.system("pkexec umount $TMPDIR/tmp/wine-runner-getdll")
|
||||
|
||||
try:
|
||||
os.rmdir("/tmp/wine-runner-getdll")
|
||||
os.rmdir("/tmp/wine-runner-getdll-wim")
|
||||
os.rmdir(TMPDIR + "/tmp/wine-runner-getdll")
|
||||
os.rmdir(TMPDIR + "/tmp/wine-runner-getdll-wim")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(GetDllFromWindowsISO.message, "错误", traceback.format_exc())
|
||||
return
|
||||
os.makedirs("/tmp/wine-runner-getdll")
|
||||
os.system(f"pkexec mount '{GetDllFromWindowsISO.isoPath.currentText()}' /tmp/wine-runner-getdll")
|
||||
os.makedirs(TMPDIR + "/tmp/wine-runner-getdll")
|
||||
os.system(f"pkexec mount '{GetDllFromWindowsISO.isoPath.currentText()}' $TMPDIR/tmp/wine-runner-getdll")
|
||||
findList = []
|
||||
# 判断是新版的 Windows ISO(Windows Vista 及以上版本)
|
||||
if os.path.exists("/tmp/wine-runner-getdll/sources/install.wim"):
|
||||
if os.path.exists(TMPDIR + "/tmp/wine-runner-getdll/sources/install.wim"):
|
||||
# 如果没有安装 wimtools 的话
|
||||
if os.system("which wimmount") != 0:
|
||||
QtWidgets.QMessageBox.critical(GetDllFromWindowsISO.message, "错误", f"镜像内容读取/挂载失败,因为没有安装 wimtools 以至无法读取")
|
||||
@ -1544,14 +1546,14 @@ class GetDllFromWindowsISO:
|
||||
choose = QtWidgets.QInputDialog.getInt(GetDllFromWindowsISO.message, "提示", "请输入 Index")
|
||||
if not choose[1]:
|
||||
return
|
||||
os.makedirs("/tmp/wine-runner-getdll-wim")
|
||||
os.system(f"wimmount /tmp/wine-runner-getdll/sources/install.wim {choose[0]} /tmp/wine-runner-getdll-wim")
|
||||
if os.path.exists("/tmp/wine-runner-getdll-wim/Windows/SysWOW64"):
|
||||
os.makedirs(TMPDIR + "/tmp/wine-runner-getdll-wim")
|
||||
os.system(f"wimmount $TMPDIR/tmp/wine-runner-getdll/sources/install.wim {choose[0]} $TMPDIR/tmp/wine-runner-getdll-wim")
|
||||
if os.path.exists(TMPDIR + "/tmp/wine-runner-getdll-wim/Windows/SysWOW64"):
|
||||
# 如果是 64 位镜像
|
||||
if QtWidgets.QInputDialog.getItem(GetDllFromWindowsISO.message, "选择位数", "选择位数(如果没有选择,默认为 64 位)", ["32", "64"], 1, False) == "32":
|
||||
# 64 位镜像的 32 位是存在 SysWOW64 的
|
||||
try:
|
||||
for i in os.listdir("/tmp/wine-runner-getdll-wim/Windows/SysWOW64"):
|
||||
for i in os.listdir(TMPDIR + "/tmp/wine-runner-getdll-wim/Windows/SysWOW64"):
|
||||
if i[-3:] == "dll":
|
||||
findList.append(i[:-1] + "l")
|
||||
GetDllFromWindowsISO.dllListModel.setStringList(findList)
|
||||
@ -1570,7 +1572,7 @@ class GetDllFromWindowsISO:
|
||||
QtWidgets.QMessageBox.critical(GetDllFromWindowsISO.message, "错误", f"镜像内容读取/挂载失败,报错如下:\n{traceback.format_exc()}")
|
||||
return
|
||||
try:
|
||||
for i in os.listdir("/tmp/wine-runner-getdll-wim/Windows/System32"):
|
||||
for i in os.listdir(TMPDIR + "/tmp/wine-runner-getdll-wim/Windows/System32"):
|
||||
if i[-3:] == "dll":
|
||||
findList.append(i[:-1] + "l")
|
||||
GetDllFromWindowsISO.arch = 64
|
||||
@ -1581,7 +1583,7 @@ class GetDllFromWindowsISO:
|
||||
GetDllFromWindowsISO.dllListModel.setStringList(findList)
|
||||
else:
|
||||
try:
|
||||
for i in os.listdir("/tmp/wine-runner-getdll/i386"):
|
||||
for i in os.listdir(TMPDIR + "/tmp/wine-runner-getdll/i386"):
|
||||
if i[-3:] == "dl_":
|
||||
findList.append(i[:-1] + "l")
|
||||
GetDllFromWindowsISO.arch = 0
|
||||
@ -1601,11 +1603,11 @@ class GetDllFromWindowsISO:
|
||||
#GetDllFromWindowsISO.isoPath['value'] = isoPath
|
||||
|
||||
def UmountDisk():
|
||||
os.system("wimunmount /tmp/wine-runner-getdll-wim")
|
||||
os.system("pkexec umount /tmp/wine-runner-getdll")
|
||||
os.system("wimunmount $TMPDIR/tmp/wine-runner-getdll-wim")
|
||||
os.system("pkexec umount $TMPDIR/tmp/wine-runner-getdll")
|
||||
try:
|
||||
shutil.rmtree("/tmp/wine-runner-getdll")
|
||||
os.system("rm -rf /tmp/wine-runner-getdll-wim")
|
||||
shutil.rmtree(TMPDIR + "/tmp/wine-runner-getdll")
|
||||
os.system("rm -rf $TMPDIR/tmp/wine-runner-getdll-wim")
|
||||
except:
|
||||
traceback.print_exc()
|
||||
QtWidgets.QMessageBox.critical(GetDllFromWindowsISO.message, QtCore.QCoreApplication.translate("U", "错误"), f"关闭/卸载镜像失败,报错如下:\n{traceback.format_exc()}")
|
||||
@ -1623,11 +1625,11 @@ class GetDllFromWindowsISO:
|
||||
try:
|
||||
# 要分类讨论
|
||||
if GetDllFromWindowsISO.arch == 0:
|
||||
shutil.copy(f"/tmp/wine-runner-getdll/i386/{choose[:-1]}_", f"{GetDllFromWindowsISO.wineBottonPath}/drive_c/windows/system32/{choose}")
|
||||
shutil.copy(TMPDIR + f"/tmp/wine-runner-getdll/i386/{choose[:-1]}_", f"{GetDllFromWindowsISO.wineBottonPath}/drive_c/windows/system32/{choose}")
|
||||
elif GetDllFromWindowsISO.arch == 32:
|
||||
shutil.copy(f"/tmp/wine-runner-getdll-wim/Windows/SysWOW64/{choose[:-1]}l", f"{GetDllFromWindowsISO.wineBottonPath}/drive_c/windows/system32/{choose}")
|
||||
shutil.copy(TMPDIR + f"/tmp/wine-runner-getdll-wim/Windows/SysWOW64/{choose[:-1]}l", f"{GetDllFromWindowsISO.wineBottonPath}/drive_c/windows/system32/{choose}")
|
||||
elif GetDllFromWindowsISO.arch == 64:
|
||||
shutil.copy(f"/tmp/wine-runner-getdll-wim/Windows/System32/{choose[:-1]}l", f"{GetDllFromWindowsISO.wineBottonPath}/drive_c/windows/system32/{choose}")
|
||||
shutil.copy(TMPDIR + f"/tmp/wine-runner-getdll-wim/Windows/System32/{choose[:-1]}l", f"{GetDllFromWindowsISO.wineBottonPath}/drive_c/windows/system32/{choose}")
|
||||
# 选择原装或优于内建
|
||||
if QtWidgets.QInputDialog.getItem(GetDllFromWindowsISO.message, "选择", "选择模式", ["原装先于内建", "原装"], 0, False) == "原装先于内建":
|
||||
# 原装先于内建
|
||||
@ -2593,13 +2595,13 @@ for i in iconListUnBuild:
|
||||
print(iconList)
|
||||
# Qemu Lock
|
||||
try:
|
||||
if os.path.exists("/tmp/deepin-wine-runner-lock.txt"):
|
||||
if os.path.exists(TMPDIR + "/tmp/deepin-wine-runner-lock.txt"):
|
||||
print("lock")
|
||||
with open(f"/tmp/deepin-wine-runner-lock.txt", "r") as file:
|
||||
with open(TMPDIR + f"/tmp/deepin-wine-runner-lock.txt", "r") as file:
|
||||
setting["QemuUnMountHome"] = bool(int(file.read()))
|
||||
else:
|
||||
print("unlock")
|
||||
with open(f"/tmp/deepin-wine-runner-lock.txt", "w") as file:
|
||||
with open(TMPDIR + f"/tmp/deepin-wine-runner-lock.txt", "w") as file:
|
||||
# = bool(int(file.read()))
|
||||
file.write(str(int(setting["QemuUnMountHome"])))
|
||||
except:
|
||||
|
@ -3,7 +3,7 @@ import sys
|
||||
import os
|
||||
import atexit
|
||||
|
||||
PIDFILE = '/tmp/deepin-wine-runner.pid'
|
||||
PIDFILE = os.getenv() + '/tmp/deepin-wine-runner.pid'
|
||||
|
||||
#程序结束时清理pid
|
||||
@atexit.register
|
||||
|
Loading…
x
Reference in New Issue
Block a user