mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-01-13 01:58:27 +08:00
支持从QEMU开启
This commit is contained in:
parent
a1d61c2b65
commit
b7c3ebf024
@ -16,5 +16,6 @@ fi
|
|||||||
aria2c -x 16 -s 16 -c $url -d /tmp -o $fileName
|
aria2c -x 16 -s 16 -c $url -d /tmp -o $fileName
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo dpkg -i /tmp/$fileName
|
sudo dpkg -i /tmp/$fileName
|
||||||
|
sudo apt install qemu-user qemu-user-static binfmt-support -y
|
||||||
echo 安装完成,按回车键退出
|
echo 安装完成,按回车键退出
|
||||||
read
|
read
|
@ -15,6 +15,7 @@ if [[ -f /tmp/$fileName ]]; then
|
|||||||
fi
|
fi
|
||||||
aria2c -x 16 -s 16 -c $url -d /tmp -o $fileName
|
aria2c -x 16 -s 16 -c $url -d /tmp -o $fileName
|
||||||
sudo apt update
|
sudo apt update
|
||||||
|
sudo apt install qemu-user qemu-user-static binfmt-support -y
|
||||||
sudo dpkg -i /tmp/$fileName
|
sudo dpkg -i /tmp/$fileName
|
||||||
echo 安装完成,按回车键退出
|
echo 安装完成,按回车键退出
|
||||||
read
|
read
|
@ -15,6 +15,7 @@ if [[ -f /tmp/$fileName ]]; then
|
|||||||
fi
|
fi
|
||||||
aria2c -x 16 -s 16 -c $url -d /tmp -o $fileName
|
aria2c -x 16 -s 16 -c $url -d /tmp -o $fileName
|
||||||
sudo apt update
|
sudo apt update
|
||||||
|
sudo apt install qemu-user qemu-user-static binfmt-support -y
|
||||||
sudo dpkg -i /tmp/$fileName
|
sudo dpkg -i /tmp/$fileName
|
||||||
echo 安装完成,按回车键退出
|
echo 安装完成,按回车键退出
|
||||||
read
|
read
|
@ -15,6 +15,7 @@ if [[ -f /tmp/$fileName ]]; then
|
|||||||
fi
|
fi
|
||||||
aria2c -x 16 -s 16 -c $url -d /tmp -o $fileName
|
aria2c -x 16 -s 16 -c $url -d /tmp -o $fileName
|
||||||
sudo apt update
|
sudo apt update
|
||||||
|
sudo apt install qemu-user qemu-user-static binfmt-support -y
|
||||||
sudo dpkg -i /tmp/$fileName
|
sudo dpkg -i /tmp/$fileName
|
||||||
echo 安装完成,按回车键退出
|
echo 安装完成,按回车键退出
|
||||||
read
|
read
|
@ -15,6 +15,7 @@ if [[ -f /tmp/$fileName ]]; then
|
|||||||
fi
|
fi
|
||||||
aria2c -x 16 -s 16 -c $url -d /tmp -o $fileName
|
aria2c -x 16 -s 16 -c $url -d /tmp -o $fileName
|
||||||
sudo apt update
|
sudo apt update
|
||||||
|
sudo apt install qemu-user qemu-user-static binfmt-support -y
|
||||||
sudo dpkg -i /tmp/$fileName
|
sudo dpkg -i /tmp/$fileName
|
||||||
echo 安装完成,按回车键退出
|
echo 安装完成,按回车键退出
|
||||||
read
|
read
|
@ -15,6 +15,7 @@ if [[ -f /tmp/$fileName ]]; then
|
|||||||
fi
|
fi
|
||||||
aria2c -x 16 -s 16 -c $url -d /tmp -o $fileName
|
aria2c -x 16 -s 16 -c $url -d /tmp -o $fileName
|
||||||
sudo apt update
|
sudo apt update
|
||||||
|
sudo apt install qemu-user qemu-user-static binfmt-support -y
|
||||||
sudo dpkg -i /tmp/$fileName
|
sudo dpkg -i /tmp/$fileName
|
||||||
echo 安装完成,按回车键退出
|
echo 安装完成,按回车键退出
|
||||||
read
|
read
|
21
StartVM.sh
21
StartVM.sh
@ -8,13 +8,30 @@
|
|||||||
# 基于 Python3 的 tkinter 构建
|
# 基于 Python3 的 tkinter 构建
|
||||||
###########################################################################################
|
###########################################################################################
|
||||||
VBoxManage showvminfo Windows
|
VBoxManage showvminfo Windows
|
||||||
if test 0 == $?; then
|
if [[ 0 == $? ]]; then
|
||||||
# 检测到虚拟机存在,启动虚拟机
|
# 检测到虚拟机存在,启动虚拟机
|
||||||
VBoxManage startvm Windows
|
VBoxManage startvm Windows
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
# 检查是否有 QEMU
|
||||||
|
if [[ -f "$HOME/Qemu/Windows/Windows.qcow2" ]]; then
|
||||||
|
# 查看逻辑CPU的个数
|
||||||
|
CpuCount=`cat /proc/cpuinfo| grep "processor"| wc -l`
|
||||||
|
|
||||||
|
# 总内存大小GB
|
||||||
|
MemTotal=`awk '($1 == "MemTotal:"){printf "%.2f\n",$2/1024/1024}' /proc/meminfo`
|
||||||
|
use=$(echo "scale=4; $MemTotal / 3" | bc)
|
||||||
|
if [[ `arch` != "x86_64" ]]; then
|
||||||
|
echo X86 架构,使用 kvm 加速
|
||||||
|
kvm --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount -m ${use}G
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
echo 非 X86 架构,不使用 kvm 加速
|
||||||
|
qemu-system-x86_64 --hda "$HOME/Qemu/Windows/Windows.qcow2" -soundhw all -smp $CpuCount -m ${use}G
|
||||||
|
exit
|
||||||
|
fi
|
||||||
zenity --question --no-wrap --text="检查到您未创建所指定的虚拟机,是否创建虚拟机并继续?\n如果不创建将无法使用"
|
zenity --question --no-wrap --text="检查到您未创建所指定的虚拟机,是否创建虚拟机并继续?\n如果不创建将无法使用"
|
||||||
if test 1 == $?; then
|
if [[ 1 == $? ]]; then
|
||||||
# 用户不想创建虚拟机,结束
|
# 用户不想创建虚拟机,结束
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -221,7 +221,6 @@ DIST = /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_pre.prf \
|
|||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf \
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf \
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \
|
||||||
.qmake.stash \
|
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf \
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf \
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \
|
||||||
@ -414,7 +413,6 @@ Makefile: VirtualMachine.pro /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qma
|
|||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf \
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf \
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf \
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf \
|
||||||
.qmake.stash \
|
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf \
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf \
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf \
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf \
|
||||||
@ -587,7 +585,6 @@ Makefile: VirtualMachine.pro /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qma
|
|||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf:
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/qt_config.prf:
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf:
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++/qmake.conf:
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf:
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/spec_post.prf:
|
||||||
.qmake.stash:
|
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf:
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/exclusive_builds.prf:
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf:
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/toolchain.prf:
|
||||||
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf:
|
/usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/default_pre.prf:
|
||||||
|
14
VM/VirtualMachine
Normal file
14
VM/VirtualMachine
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||||
|
arch = subprocess.getoutput("arch").replace(" ", "").replace("\n", "")
|
||||||
|
if os.path.exists(f"{programPath}/VirtualMachine-{arch}"):
|
||||||
|
os.system(f"{programPath}/VirtualMachine-{arch}")
|
||||||
|
exit()
|
||||||
|
# 只能使用 Qemu User 运行程序
|
||||||
|
if os.path.exists("/usr/lib/x86_64-linux-gnu/") and not os.system("which qemu-x86_64"):
|
||||||
|
os.system(f"qemu-x86_64 '{programPath}/VirtualMachine-x86_64'")
|
||||||
|
exit()
|
||||||
|
print("未安装环境,立即安装!")
|
||||||
|
os.system(f"python3 '{programPath}/../RunCommandWithTerminal.py' '{programPath}/../InstallRuntime/amd64.sh'")
|
Loading…
Reference in New Issue
Block a user