first commit

master
fanta 2 years ago
parent dfc1f29479
commit 3923d47be5

38
q

@ -0,0 +1,38 @@
#!/bin/bash
#rocky;8.6;x86_64;http://fanta.56k.es/systems/rocky/8/Rocky-8.6-x86_64-dvd1.iso;20;2048;-enable-kvm
vmsDir="/home/fanta/vms"
function main(){
downloadSysList
downloadSysIsos
}
function downloadSysList(){
mkdir -p $vmsDir
wget -q "http://fanta.56k.es/q/systems.lst" -O $vmsDir/.systems.lst
}
function downloadSysIsos(){
while read system; do
data=("$(echo "$system" | cut -d ";" -f 1)" "$(echo "$system" | cut -d ";" -f 2)" "$(echo "$system" | cut -d ";" -f 3)" "$(echo "$system" | cut -d ";" -f 4)" "$(echo "$system" | cut -d ";" -f 5)" "$(echo "$system" | cut -d ";" -f 6)" "$(echo "$system" | cut -d ";" -f 7)" "$(echo "$system" | cut -d ";" -f 8)")
isoName="${data[0]}-${data[1]}-${data[2]}.iso"
url="${data[3]}"
sizeDisc="${data[4]}"
sizeRam="${data[5]}"
extra="${data[6]}"
echo "[+] Downloading $isoName"
mkdir -p $vmsDir/${data[0]}-${data[1]}-${data[2]}
wget -q $url -O $vmsDir/${data[0]}-${data[1]}-${data[2]}/$isoName
echo " Create img [$sizeDisc] $vmsDir/${data[0]}-${data[1]}-${data[2]}/${data[0]}-${data[1]}-${data[2]}.qcow2"
qemu-img create -q -f qcow2 "$vmsDir/${data[0]}-${data[1]}-${data[2]}/${data[0]}-${data[1]}-${data[2]}.qcow2" $sizeDisc
echo " Create script $vmsDir/${data[0]}-${data[1]}-${data[2]}/${data[0]}-${data[1]}-${data[2]}.sh"
echo "#!/bin/bash" > "$vmsDir/${data[0]}-${data[1]}-${data[2]}/${data[0]}-${data[1]}-${data[2]}.sh"
echo "qemu-system-${data[2]} $extra -m $sizeRam -cdrom $vmsDir/${data[0]}-${data[1]}-${data[2]}/$isoName -hda $vmsDir/${data[0]}-${data[1]}-${data[2]}/${data[0]}-${data[1]}-${data[2]}.qcow2" >> "$vmsDir/${data[0]}-${data[1]}-${data[2]}/${data[0]}-${data[1]}-${data[2]}.sh"
echo " Create start script"
echo "#!/bin/bash" > "$vmsDir/${data[0]}-${data[1]}-${data[2]}/start.sh"
echo "qemu-system-${data[2]} $extra -m $sizeRam -hda $vmsDir/${data[0]}-${data[1]}-${data[2]}/${data[0]}-${data[1]}-${data[2]}.qcow2" > "$vmsDir/${data[0]}-${data[1]}-${data[2]}/start.sh"
done < $vmsDir/.systems.lst
}
main
Loading…
Cancel
Save