Skip to content

Commit 36b9b72

Browse files
committed
Added final features to EmuGUI 0.5
1 parent 03eae07 commit 36b9b72

21 files changed

+362
-107
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
- An update checker has been added
66
- ARM-based VMs can now run with standard VGA
77
- You can now select between several USB controllers.
8+
- This script can now be run on Linux.
9+
- TESTED.md has been updated.
10+
- Installation and building instructions for Linux have been added to README.md.
11+
- If you start a virtual machine, there is now a message at the bottom of the window which could be helpful when debugging.
12+
- There is now a window which warns you if your VM uses the depreciated USB checkbox.
813

914
# EmuGUI v0.4.2
1015

README.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ code in Copilot.
3030
![Logo of the GiveUpGitHub campaign](https://sfconservancy.org/img/GiveUpGitHub.png)
3131

3232
## System requirements
33-
OS: Windows 8.1, Windows Server 2012 R2 or later (x64)
33+
OS: Windows 8.1, Windows Server 2012 R2 or later (x64); Ubuntu 20.04, Debian 10, openSUSE Leap 15.3, openSUSE Tumbleweed, Fedora 35, RHEL 7, Arch Linux or distributions based on those (x64)
3434

3535
Python: 3.6 or newer
3636

@@ -50,14 +50,38 @@ HDD: 2 GB¹
5050
- QEMU
5151
- Python Magic
5252

53-
## Installation
53+
## Installation (Windows)
5454

5555
1. Get QEMU at https://qemu.weilnetz.de/w64/ and install it
5656
2. Get EmuGUI and extract it
5757
3. Run main.exe in the EmuGUI directory.
5858
4. Set the QEMU paths at the Settings/QEMU tab.
5959
5. Create a new virtual machine and start it.
6060

61+
## Installation (Linux)
62+
63+
1. Open your terminal and type in one of the commands to update your system, depending on your distro:
64+
- Arch: `sudo pacman -Syu`
65+
- Debian/Ubuntu: `sudo apt-get update && sudo apt-get upgrade`
66+
- Fedora/RHEL 8: `sudo dnf upgrade --refresh` or `sudo dnf update`
67+
- Gentoo: `sudo emaint -a sync && sudo emerge --ask --verbose --update --deep --newuse @world`
68+
- RHEL 7: `sudo yum update`
69+
- SUSE and openSUSE Leap: `sudo zypper patch && sudo zypper up`
70+
- openSUSE Tumbleweed: `sudo zypper patch && sudo zypper dup`
71+
72+
2. Open your terminal and type in one of the commands to install QEMU, depending on your distribution:
73+
- Arch: `sudo pacman -S qemu`
74+
- Debian/Ubuntu: `sudo apt-get install qemu`
75+
- Fedora: `sudo dnf install @virtualization`
76+
- Gentoo: `sudo emerge --ask app-emulation/qemu`
77+
- RHEL: `sudo yum install qemu-kvm`
78+
- (open-)SUSE: `sudo zypper install qemu`
79+
80+
3. Get EmuGUI from this website and extract it.
81+
4. Run main in the EmuGUI directory.
82+
5. Set the QEMU paths at the Settings/QEMU tab (either `/usr/bin/qemu-system-*` or just `qemu-system-*`).
83+
6. Create a new virtual machine and start it.
84+
6185
## Updating EmuGUI
6286

6387
1. Close out of EmuGUI before updating.
@@ -103,6 +127,21 @@ HDD: 2 GB¹
103127
14. Run the executable in the dist folder. If your antivirus puts it into quarantine, don't worry as this should be a false positive and restore it.
104128
15. If it works, have fun! If not, try to start again from number 9.
105129

130+
## Building on Linux
131+
132+
1. Install Python 3. You can either compile the source code or get it from your distribution's repositories.
133+
2. Install QEMU using one of the commands listed on Installation (Linux).
134+
3. Install Git using the install command of your distribution.
135+
4. Install Visual Studio Code. You can get it from https://code.visualstudio.com/download
136+
5. Open a terminal and type: `git clone https://github.com/Tech-FZ/EmuGUI.git` or `git clone https://codeberg.org/lucien-rowan/EmuGUI.git`
137+
6. Open Visual Studio Code in that folder.
138+
7. Open a terminal WITHIN VS Code and type: `python3 -m pip install --upgrade pip PyInstaller PyQt6 PyQt6-tools PySide6 python-magic`. You can try getting a VENV working but I personally have problems with using Python virtual environments on Linux.
139+
8. After this is done, run the main.py script.
140+
9. To compile the program for users who don't have Python installed, type: `PyInstaller --onefile main.py` (for those who can get a VENV to work) or `python3 -m PyInstaller --onefile main.py`
141+
10. After that is finished, copy the code into the dist folder PyInstaller created.
142+
11. Run the executable in the dist folder. If your antivirus puts it into quarantine, don't worry as this should be a false positive and restore it.
143+
12. If it works, have fun! If not, try to start again from number 7.
144+
106145
## Documentation
107146

108147
A documentation of EmuGUI can be found at: https://tech-fz.github.io/EmuGUI-doc/
294 Bytes
Binary file not shown.
294 Bytes
Binary file not shown.
405 Bytes
Binary file not shown.
Binary file not shown.

dialogExecution/editVirtualMachine.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,8 @@ def finishCreation(self):
464464
WHERE name = "qemu-img"
465465
"""
466466

467+
vhd_cmd = ""
468+
467469
try:
468470
cursor.execute(get_qemu_img_bin)
469471
connection.commit()
@@ -482,16 +484,29 @@ def finishCreation(self):
482484

483485
print(vhd_size_in_b)
484486

487+
if platform.system() == "Windows":
488+
vhd_cmd = f"{qemu_binary} create -f {self.comboBox_8.currentText()} \"{vhd}\" {str(vhd_size_in_b)}"
489+
490+
else:
491+
vhd_cmd = f"{qemu_binary} create -f {self.comboBox_8.currentText()} {vhd} {str(vhd_size_in_b)}"
492+
485493
if vhdAction.startswith("overwrite"):
486-
subprocess.Popen(f"{qemu_binary} create -f {self.comboBox_8.currentText()} \"{vhd}\" {str(vhd_size_in_b)}")
494+
subprocess.Popen(vhd_cmd)
487495

488496
print("The query was executed and the virtual disk created successfully.")
489497

490498
except sqlite3.Error as e:
491499
print(f"The SQLite module encountered an error: {e}.")
492500

493501
except:
494-
print(f"The query was executed successfully, but the virtual disk couldn't be created.")
502+
print(f"The query was executed successfully, but the virtual disk couldn't be created. Trying to use subprocess.run")
503+
504+
try:
505+
vhd_cmd_split = vhd_cmd.split(" ")
506+
subprocess.run(vhd_cmd_split)
507+
508+
except:
509+
print("The virtual disk could not be created. Please check if the path and the QEMU settings are correct.")
495510

496511
if self.comboBox_11.currentText() == "none":
497512
networkAdapter = "none"

dialogExecution/newVirtualMachine.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ def finishCreation(self):
241241
WHERE name = "qemu-img"
242242
"""
243243

244+
vhd_cmd = ""
245+
244246
try:
245247
cursor.execute(get_qemu_img_bin)
246248
connection.commit()
@@ -259,16 +261,29 @@ def finishCreation(self):
259261

260262
print(vhd_size_in_b)
261263

264+
if platform.system() == "Windows":
265+
vhd_cmd = f"{qemu_binary} create -f {self.comboBox_8.currentText()} \"{vhd}\" {str(vhd_size_in_b)}"
266+
267+
else:
268+
vhd_cmd = f"{qemu_binary} create -f {self.comboBox_8.currentText()} {vhd} {str(vhd_size_in_b)}"
269+
262270
if vhdAction.startswith("overwrite"):
263-
subprocess.Popen(f"{qemu_binary} create -f {self.comboBox_8.currentText()} \"{vhd}\" {str(vhd_size_in_b)}")
271+
subprocess.Popen(vhd_cmd)
264272

265273
print("The query was executed and the virtual disk created successfully.")
266274

267275
except sqlite3.Error as e:
268276
print(f"The SQLite module encountered an error: {e}.")
269277

270278
except:
271-
print(f"The query was executed successfully, but the virtual disk couldn't be created.")
279+
print(f"The query was executed successfully, but the virtual disk couldn't be created. Trying to use subprocess.run")
280+
281+
try:
282+
vhd_cmd_split = vhd_cmd.split(" ")
283+
subprocess.run(vhd_cmd_split)
284+
285+
except:
286+
print("The virtual disk could not be created. Please check if the path and the QEMU settings are correct.")
272287

273288
if self.comboBox_11.currentText() == "none":
274289
networkAdapter = "none"

dialogExecution/startVirtualMachine.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ def start_virtual_machine(self):
116116
print(bootfrom)
117117
print(dateTimeForVM)
118118

119+
qemu_cmd = ""
120+
119121
try:
120122
if self.vmSpecs[1] == "i386":
121123
cursor.execute(qemu_i386_bin)
@@ -160,13 +162,26 @@ def start_virtual_machine(self):
160162
print(result)
161163

162164
qemu_to_execute = result[0][0]
163-
qemu_cmd = f"{qemu_to_execute} -m {self.vmSpecs[4]} -rtc base=\"{dateTimeForVM}\",clock=vm -smp {self.vmSpecs[17]}"
165+
166+
if platform.system() == "Windows":
167+
qemu_cmd = f"{qemu_to_execute} -m {self.vmSpecs[4]} -rtc base=\"{dateTimeForVM}\",clock=vm -smp {self.vmSpecs[17]}"
168+
169+
else:
170+
qemu_cmd = f"{qemu_to_execute} -m {self.vmSpecs[4]} -rtc base={dateTimeForVM},clock=vm -smp {self.vmSpecs[17]}"
164171

165172
if magic.from_file(self.vmSpecs[5]) == "block special":
166-
qemu_cmd = qemu_cmd + f" -drive format=raw,file=\"{self.vmSpecs[5]}\""
173+
if platform.system() == "Windows":
174+
qemu_cmd = qemu_cmd + f" -drive format=raw,file=\"{self.vmSpecs[5]}\""
175+
176+
else:
177+
qemu_cmd = qemu_cmd + f" -drive format=raw,file={self.vmSpecs[5]}"
167178

168179
else:
169-
qemu_cmd = qemu_cmd + f" -hda \"{self.vmSpecs[5]}\""
180+
if platform.system() == "Windows":
181+
qemu_cmd = qemu_cmd + f" -hda \"{self.vmSpecs[5]}\""
182+
183+
else:
184+
qemu_cmd = qemu_cmd + f" -hda {self.vmSpecs[5]}"
170185

171186
if self.vmSpecs[2] != "Let QEMU decide":
172187
qemu_cmd = qemu_cmd + f" -M {self.vmSpecs[2]}"
@@ -381,6 +396,13 @@ def start_virtual_machine(self):
381396
print(f"The SQLite module encountered an error: {e}.")
382397

383398
except:
384-
print("Qemu couldn't be executed. Please check the settings.")
399+
print("Qemu couldn't be executed. Trying subprocess.run")
400+
401+
try:
402+
qemu_cmd_split = qemu_cmd.split(" ")
403+
subprocess.run(qemu_cmd_split)
404+
405+
except:
406+
print("Qemu couldn't be executed. Please check if the settings of your VM and/or the QEMU paths are correct.")
385407

386408
self.close()
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from uiScripts.ui_USBTabletCheckboxDepreciated import Ui_Dialog
2+
from PySide6.QtWidgets import *
3+
import platform
4+
import platformSpecific.windowsSpecific
5+
import platformSpecific.unixSpecific
6+
7+
class UsbTabletDepreciated(QDialog, Ui_Dialog):
8+
def __init__(self, parent = None):
9+
super().__init__(parent)
10+
self.setupUi(self)
11+
self.vmSpecs = self.readTempVmFile()
12+
self.setWindowTitle(f"EmuGUI - {self.vmSpecs[0]} uses a depreciated feature")
13+
self.connectSignalsSlots()
14+
15+
def connectSignalsSlots(self):
16+
self.pushButton.clicked.connect(self.close)
17+
18+
def readTempVmFile(self):
19+
# Searching temporary files
20+
if platform.system() == "Windows":
21+
tempVmDef = platformSpecific.windowsSpecific.windowsTempVmStarterFile()
22+
23+
else:
24+
tempVmDef = platformSpecific.unixSpecific.unixTempVmStarterFile()
25+
26+
vmSpecs = []
27+
28+
with open(tempVmDef, "r+") as tempVmDefFile:
29+
vmSpecsRaw = tempVmDefFile.readlines()
30+
31+
for vmSpec in vmSpecsRaw:
32+
vmSpecNew = vmSpec.replace("\n", "")
33+
vmSpecs.append(vmSpecNew)
34+
35+
return vmSpecs

0 commit comments

Comments
 (0)