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