-
Notifications
You must be signed in to change notification settings - Fork 0
/
quickemu-launch
executable file
·22 lines (22 loc) · 982 Bytes
/
quickemu-launch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
(( $(id -u) == 0 )) && { echo "Cannot run this script as root. Exiting."; exit; }
export PATH=$PATH:~/.local/bin/quickemu
command -v quickemu > /dev/null || { echo Quickemu is not installed. Install quickemu through your package manager or run quickemu-create.; exit; }
mkdir ~/Documents/VMs 2> /dev/null && echo Created VMs folder at /home/$(whoami)/Documents/VMs.
IFS=$'\n' VMs=( $(ls ~/Documents/VMs) )
cd ~/Documents/VMs
[ -z $VMs ] && { echo No VMs found. Run quickemu-create to create one.; exit; }
echo Available VMs:
for i in "${!VMs[@]}"; do
echo "$((i+1)). ${VMs[$i]}"
done
read -p 'Select a VM: ' selection
if ((selection < 1)) || ((selection > ${#VMs[@]})); then
echo "Invalid selection. Exiting."
exit
fi
echo -e '\n\nAvailable parameters:\n'
quickemu --help | tail -n +6 | head -n -1
read -p 'Enter any additional parameters you would like to pass: ' args
cd ~/Documents/VMs/"${VMs[$selection-1]}"
eval "quickemu --vm \"$(ls | grep .conf)\" $args"