Skip to content

Commit e162ba1

Browse files
authored
Initial release
0 parents  commit e162ba1

File tree

11 files changed

+1127
-0
lines changed

11 files changed

+1127
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## Qemu command generator
2+
3+
An app for generate commands for QEMU, for boot from your CD and HDA and also for generate commands for create you virtual disks
4+
5+
## Want to help me?
6+
7+
Pull Requests are appreciated :)
8+
9+
## Wich OSes are compatible?
10+
11+
Windows, macOS and Linux
12+
I'm also planning to make an alternative version, so I'm planning to make a SwiftUI version for macOS, a C# version for Windows (I will use ChatGPT beacuse I don't know C#) and a Python version for Linux and other OSes

img.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>QEMU Command Generator</title>
7+
<link rel="stylesheet" href="styles.css">
8+
<link rel="shortcut icon" href="logo.png" type="image/x-icon">
9+
</head>
10+
<body>
11+
<h1>QEMU Command Generator</h1>
12+
<p>Choose settings for your disk</p>
13+
<br><br>
14+
<label for="name">Name: </label>
15+
<input type="text" name="name" id="name" value="disk">
16+
<br><br>
17+
<label for="disk">Disk File Format: </label>
18+
<select name="disk" id="disk">
19+
<option value="qcow2">qcow2</option>
20+
<option value="qed">qed</option>
21+
<option value="raw">raw</option>
22+
<option value="vdi">vdi</option>
23+
<option value="vmdk">vmdk</option>
24+
<option value="vhdx">vhdx</option>
25+
<option value="vhd">vhd</option>
26+
</select>
27+
<br><br>
28+
<label for="size">Disk Size (in GB): </label>
29+
<input type="number" name="size" id="size" value="10" placeholder="Size (e.g., 10G)">
30+
<br><br>
31+
<input type="text" name="command" id="command" value="" readonly size="50">
32+
<button id="Copy" onclick="copyCommand()">Copy</button>
33+
<br>
34+
<br>
35+
<button id="Generate" onclick="writeCommand()">Generate Command</button>
36+
<br><br>
37+
<a href="index.html">QEMU Command Generator</a>
38+
<script src="img.js"></script>
39+
</body>
40+
</html>

img.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
function copyCommand() {
2+
const command = document.getElementById("command").value;
3+
navigator.clipboard.writeText(command).then(() => {
4+
alert("Command copied to clipboard!");
5+
}).catch(err => {
6+
console.error("Failed to copy command: ", err);
7+
});
8+
}
9+
10+
function writeCommand() {
11+
var name = document.getElementById("name").value;
12+
var disk = document.getElementById("disk").value;
13+
var size = document.getElementById("size").value;
14+
15+
// Ensure size ends with 'G' if not already specified
16+
if (!size.toUpperCase().endsWith('G')) {
17+
size = `${size}G`;
18+
}
19+
20+
var command = `qemu-img create -f ${disk} ${name}.${disk} ${size}`;
21+
document.getElementById("command").value = command;
22+
}

index.html

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>QEMU Command Generator</title>
7+
<link rel="stylesheet" href="styles.css">
8+
<link rel="shortcut icon" href="logo.png" type="image/x-icon">
9+
</head>
10+
<body>
11+
<h1>QEMU Command Generator</h1>
12+
<p>Choose settings for your vm</p>
13+
<label for="arch">Architecture: </label>
14+
<select name="arch" id="arch">
15+
<option value="i386">i386</option>
16+
<option value="x86_64">x86_64</option>
17+
<option value="arm">arm</option>
18+
<option value="aarch64">aarch64</option>
19+
<option value="ppc">ppc</option>
20+
<option value="ppc64">ppc64</option>
21+
</select>
22+
<br><br>
23+
<label for="ram">Memory: </label>
24+
<input type="number" name="ram" id="ram" value="1024">
25+
<br><br>
26+
<label for="disk">HDA file location</label>
27+
<input type="text" name="disk" id="disk" value="disk.qcow2">
28+
<br><br>
29+
<label for="cd">CD/DVD file location</label>
30+
<input type="text" name="cd" id="cd" value="cd.iso">
31+
<br><br>
32+
<label for="boot">Boot from: </label>
33+
<select name="boot" id="boot">
34+
<option value="menu">Menu</option>
35+
<option value="CD">CD/DVD</option>
36+
<option value="Disk">HDA</option>
37+
</select>
38+
<br><br>
39+
<input type="text" name="command" id="command" value="" readonly size="50">
40+
<button id="Copy" onclick="copyCommand()">Copy</button>
41+
<br>
42+
<br>
43+
<button id="Generate" onclick="writeCommand()">Generate Command</button>
44+
<script src="script.js"></script>
45+
<a href="img.html">Disk Command Generator</a>
46+
</body>
47+
</html>

logo.png

15.7 KB
Loading

main.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
const { app, BrowserWindow } = require('electron');
2+
const path = require('path');
3+
4+
function createWindow() {
5+
const win = new BrowserWindow({
6+
width: 800,
7+
height: 600,
8+
webPreferences: {
9+
preload: path.join(__dirname, 'preload.js'),
10+
nodeIntegration: true,
11+
},
12+
icon: path.join(__dirname, 'logo.png') // Set the icon here
13+
});
14+
15+
win.loadFile('index.html');
16+
}
17+
18+
app.whenReady().then(() => {
19+
createWindow();
20+
21+
app.on('activate', () => {
22+
if (BrowserWindow.getAllWindows().length === 0) {
23+
createWindow();
24+
}
25+
});
26+
});
27+
28+
app.on('window-all-closed', () => {
29+
if (process.platform !== 'darwin') {
30+
app.quit();
31+
}
32+
});

0 commit comments

Comments
 (0)