Compare commits

...

2 Commits

Author SHA1 Message Date
a3e2f8b5ed
feat: fedora39 2024-03-10 21:33:10 +01:00
b0ffbb9c0c
feat: add create/download_isos to run.sh 2024-03-10 21:32:43 +01:00
10 changed files with 51 additions and 53 deletions

View File

@ -1,15 +0,0 @@
#!/bin/bash -e
cd "$(dirname "$0")"
. ../lib.sh
if ! [ -f android.iso ]; then
ask_yn "android.iso not found, download?" \
&& bash ./download_isos.sh \
|| exit 1
fi
qemu-img create -f qcow2 hda.qcow2 10G
qemu "$@" \
-drive file=android.iso,media=cdrom,readonly=on
#-device usb-host,vendorid=0xffff,productid=0xffff

View File

@ -1,5 +0,0 @@
#!/bin/bash -e
android='https://sourceforge.net/projects/android-x86/files/latest/download'
curl -LC- -o android.iso "$android"

View File

@ -2,10 +2,14 @@
cd "$(dirname "$0")" cd "$(dirname "$0")"
. ../lib.sh . ../lib.sh
ISO=(
[android]='https://sourceforge.net/projects/android-x86/files/latest/download'
)
if ! [ -f hda.qcow2 ]; then if ! [ -f hda.qcow2 ]; then
ask_yn "hda.qcow2 not found, create?" \ ask_yn 'hda not found, create?' || exit 1
&& bash ./create.sh \ qemu-img create -f qcow2 hda.qcow2 10G
|| exit 1 download_isos
fi fi
qemu "$@" \ qemu "$@" \

View File

@ -10,7 +10,7 @@ if ! [ -f hda.qcow2 ]; then
|| exit 1 || exit 1
fi fi
echo -e 'User: \e[1m\e[31march:arch\e[0m' echo "User: ${BOLD}${RED}arch:arch${NORMAL}"
read -rp 'Continue? ' read -rp 'Continue? '
qemu "$@" \ qemu "$@" \

View File

@ -10,7 +10,7 @@ if ! [ -f hda.qcow2 ]; then
|| exit 1 || exit 1
fi fi
echo -e 'User: \e[1m\e[31mroot:\e[0m' echo "User: ${BOLD}${RED}root:${NORMAL}"
read -rp 'Continue? ' read -rp 'Continue? '
qemu "$@" \ qemu "$@" \

16
fedora39/run.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash -e
cd "$(dirname "$0")"
. ../lib.sh
ISO=(
[fedora39.iso]='https://download.fedoraproject.org/pub/fedora/linux/releases/39/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-39-1.5.iso'
)
if ! [ -f hda.qcow2 ]; then
ask_yn 'hda not found, create?' || exit 1
qemu-img create -f qcow2 hda.qcow2 20G
download_isos
fi
qemu "$@" \
#-device usb-host,vendorid=0xffff,productid=0xffff

18
lib.sh
View File

@ -3,6 +3,10 @@ DIR="$(dirname "${BASH_SOURCE[0]}")"
BRIDGE=virbr0 BRIDGE=virbr0
NORMAL=$'\e[0m'
BOLD=$'\e[1m'
RED=$'\e[31m'
function ask_yn() { function ask_yn() {
local ans local ans
@ -14,6 +18,19 @@ function ask_yn() {
esac esac
} }
declare -A ISO
declare -a OPTS
function download_isos() {
for iso in "${!ISO[@]}"; do
if ! [ -f "$iso" ] && ask_yn "download $iso?"; then
curl -LC- -o "$iso" "${ISO[$iso]}"
fi
if [ -f "$iso" ]; then
OPTS+=(-drive "file=$iso,media=cdrom,readonly=on")
fi
done
}
function _getmaxram() { function _getmaxram() {
local ram; ram="$(free -g | awk '/^Mem:/{print $2 - 2}')" local ram; ram="$(free -g | awk '/^Mem:/{print $2 - 2}')"
@ -52,6 +69,7 @@ function qemu() {
-device qemu-xhci \ -device qemu-xhci \
-object memory-backend-ram,id=mem,size=2G,share=on \ -object memory-backend-ram,id=mem,size=2G,share=on \
-numa node,memdev=mem \ -numa node,memdev=mem \
"${OPTS[@]}" \
"$@" "$@"
) )
} }

View File

@ -1,16 +0,0 @@
#!/bin/bash -e
cd "$(dirname "$0")"
. ../lib.sh
if ! [ -f win2k22.iso ] || ! [ -f virtio.iso ]; then
ask_yn "win2k22.iso and/or virtio.iso not found, download?" \
&& bash ./download_isos.sh \
|| exit 1
fi
qemu-img create -f qcow2 hda.qcow2 40G
qemu "$@" \
-drive file=win2k22.iso,media=cdrom,readonly=on \
-drive file=virtio.iso,media=cdrom,readonly=on \
#-device usb-host,vendorid=0xffff,productid=0xffff

View File

@ -1,8 +0,0 @@
#!/bin/bash -e
win2k22='https://go.microsoft.com/fwlink/p/?LinkID=2195280'
virtio='https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso'
curl -LC- \
-o win2k22.iso "$win2k22" \
-o virtio.iso "$virtio"

View File

@ -2,12 +2,16 @@
cd "$(dirname "$0")" cd "$(dirname "$0")"
. ../lib.sh . ../lib.sh
ISO=(
[win2k22]='https://go.microsoft.com/fwlink/p/?LinkID=2195280'
[virtio]='https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso'
)
if ! [ -f hda.qcow2 ]; then if ! [ -f hda.qcow2 ]; then
ask_yn "hda.qcow2 not found, create?" \ ask_yn 'hda not found, create?' || exit 1
&& bash ./create.sh \ qemu-img create -f qcow2 hda.qcow2 40G
|| exit 1 download_isos
fi fi
qemu "$@" \ qemu "$@" \
-drive file=virtio.iso,media=cdrom,readonly=on \
#-device usb-host,vendorid=0xffff,productid=0xffff #-device usb-host,vendorid=0xffff,productid=0xffff