This repository has been archived by the owner on Nov 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config-creator.sh
executable file
·83 lines (62 loc) · 1.91 KB
/
config-creator.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
function start()
{
echo "Name:"
read name
echo "Boot image:"
read boot_image
echo "Disk space: (<number><GMK>, default: 40G)"
read disk_size
echo "RAM: (<number><GMK>, default: 1G)"
read ram
echo "Cores: (default: 2)"
read cores
echo "Threads: (default: 2)"
read threads
echo "QEMU display: (gtk/sdl/spice-app, default: sdl)"
read display
echo "Accelerated graphics: (on/off, default: on)"
read accelerated_graphics
echo "CPU model: (default: max)"
read cpu
echo "Nested virtualization: (on/off, default: off)"
read nested_virtualization
echo "OS optimization: (linux/windows/macos, default: linux)"
read optimize_system
echo "Firmware: (efi/legacy, default: efi)"
read firmware
echo "Secure Boot: (on/off, default: off)"
read secure_boot
echo "Snapshot: (on/off, default: off)"
read snapshot
echo "Disk cache: (none/unsafe/writethrough/directsync/writeback, default: none)"
read cache
echo "Disk format: (qcow2/raw/vhd/vdi/vmdk, default: qcow2)"
read disk_format
file="${name}.conf"
addOptionSafe ${file} "boot_image" ${boot_image}
addOptionSafe ${file} "disk_size" ${disk_size}
addOptionSafe ${file} "ram" ${ram}
addOptionSafe ${file} "cores" ${cores}
addOptionSafe ${file} "threads" ${threads}
addOptionSafe ${file} "display" ${display}
addOptionSafe ${file} "accelerated_graphics" ${accelerated_graphics}
addOptionSafe ${file} "cpu" ${cpu}
addOptionSafe ${file} "nested_virtualization" ${nested_virtualization}
addOptionSafe ${file} "optimize_system" ${optimize_system}
addOptionSafe ${file} "firmware" ${firmware}
addOptionSafe ${file} "secure_boot" ${secure_boot}
addOptionSafe ${file} "snapshot" ${snapshot}
addOptionSafe ${file} "cache" ${cache}
addOptionSafe ${file} "disk_format" ${disk_format}
}
function addOptionSafe()
{
file="$1"
option="$2"
value="$3"
if [ ! -z "${value}" -a "${value}" != " " ]; then
echo "${option}=${value}" >> "${file}"
fi
}
start