virtual-machines: improvement to structure, usability, readability, versioning, and adding Gobo, Kali, and Kubuntu configs

master
an 2019-08-18 10:42:36 -04:00
parent d3008431be
commit d2c9aaf175
15 changed files with 80 additions and 67 deletions

View File

@ -1,14 +1,7 @@
#!/usr/bin/env fish #!/usr/bin/env fish
function vm-qemu -d "Frontend to QEMU" function vm-qemu -d "Frontend to QEMU"
set cfg $argv[1] $_agw_dir_rc/virtual-machines/qemu-setup $argv
set -e argv[1]
env \
_vm_img="/mnt/s/vm/$cfg/image" \
_vm_media="/mnt/s/osmedia" \
_vm_setup="$_agw_dir_rc/virtual-machines/qemu-setup" \
_vm_args="$argv" \
$_agw_dir_rc/virtual-machines/$cfg
end end
complete -c vm-qemu -xa "(ls $_agw_dir_rc/virtual-machines)" complete -c vm-qemu -xa "(ls $_agw_dir_rc/virtual-machines)"

View File

@ -1,8 +1,7 @@
#!/usr/bin/env fish #!/usr/bin/env fish
set _arch x86_64 set _arch x86_64
set _install "$_vm_media/Linux/Alpine/standard-3.10.1-x86_64.iso" set _ver 3.10.1
set _install "$_vm_media/Linux/Alpine/standard-_ver_-x86_64.iso"
set _mem 2048 set _mem 2048
source $_vm_setup set _vga qxl
## EOF

View File

@ -1,8 +1,6 @@
#!/usr/bin/env fish #!/usr/bin/env fish
set _arch x86_64 set _arch x86_64
set _install "$_vm_media/Linux/Arch/2018.08.01-x86_64.iso" set _ver 2018.08.01
set _install "$_vm_media/Linux/Arch/_ver_-x86_64.iso"
set _mem 2048 set _mem 2048
source $_vm_setup
## EOF

View File

@ -1,8 +1,6 @@
#!/usr/bin/env fish #!/usr/bin/env fish
set _arch x86_64 set _arch x86_64
set _install "$_vm_media/Linux/CRUX/3.5.iso" set _ver 3.5
set _install "$_vm_media/Linux/CRUX/_ver_.iso"
set _mem 2048 set _mem 2048
source $_vm_setup
## EOF

View File

@ -1,8 +1,6 @@
#!/usr/bin/env fish #!/usr/bin/env fish
set _arch x86_64 set _arch x86_64
set _install "$_vm_media/Linux/CentOS/7-x86_64-DVD-1810.iso" set _ver 7-1810
set _install "$_vm_media/Linux/CentOS/_ver_-x86_64-DVD.iso"
set _mem 2048 set _mem 2048
source $_vm_setup
## EOF

View File

@ -1,8 +1,6 @@
#!/usr/bin/env fish #!/usr/bin/env fish
set _arch x86_64 set _arch x86_64
set _install "$_vm_media/Linux/Fedora/Workstation-Live-x86_64-30-1.2.iso" set _ver 30-1.2
set _install "$_vm_media/Linux/Fedora/Workstation-Live-x86_64-_ver_.iso"
set _mem 2048 set _mem 2048
source $_vm_setup
## EOF

6
virtual-machines/Gobo Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env fish
set _arch x86_64
set _ver 016.01
set _install "$_vm_media/Linux/Gobo/_ver_-x86_64.iso"
set _mem 2048

6
virtual-machines/Kali Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env fish
set _arch x86_64
set _ver 2019.2
set _install "$_vm_media/Linux/Kali/kde-_ver_-amd64.iso"
set _mem 2048

7
virtual-machines/Kubuntu Normal file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env fish
set _arch x86_64
set _ver 19.04
set _install "$_vm_media/Linux/Kubuntu/_ver_-desktop-amd64.iso"
set _mem 8192
set _vga qxl

View File

@ -1,8 +1,6 @@
#!/usr/bin/env fish #!/usr/bin/env fish
set _arch x86_64 set _arch x86_64
set _install "$_vm_media/BSD/NetBSD/NetBSD-8.1-amd64.iso" set _ver 8.1
set _install "$_vm_media/BSD/NetBSD/NetBSD-_ver_-amd64.iso"
set _mem 4096 set _mem 4096
source $_vm_setup
## EOF

View File

@ -1,8 +1,6 @@
#!/usr/bin/env fish #!/usr/bin/env fish
set _arch x86_64 set _arch x86_64
set _install "$_vm_media/Linux/Void/live-x86_64-musl-20181111.iso" set _ver 20181111
set _install "$_vm_media/Linux/Void/live-x86_64-musl-_ver_.iso"
set _mem 2048 set _mem 2048
source $_vm_setup
## EOF

View File

@ -8,6 +8,3 @@ set _soundhw ac97
set _args \ set _args \
--net nic,model=rtl8139 \ --net nic,model=rtl8139 \
--net user --net user
source $_vm_setup
## EOF

View File

@ -9,6 +9,3 @@ set _soundhw sb16
set _args \ set _args \
--net nic,model=rtl8139 \ --net nic,model=rtl8139 \
--net user --net user
source $_vm_setup
## EOF

6
virtual-machines/elementaryOS Executable file → Normal file
View File

@ -1,8 +1,6 @@
#!/usr/bin/env fish #!/usr/bin/env fish
set _arch x86_64 set _arch x86_64
set _install "$_vm_media/Linux/elementaryOS/5.0-stable.20181016.iso" set _ver 5.0.20181016
set _install "$_vm_media/Linux/elementaryOS/_ver_.iso"
set _mem 4096 set _mem 4096
source $_vm_setup
## EOF

64
virtual-machines/qemu-setup Normal file → Executable file
View File

@ -1,53 +1,75 @@
#!/usr/bin/env fish #!/usr/bin/env fish
for opt in $_vm_args # Args
switch "$opt" argparse \
case "" --name "vm-qemu" \
case -i --install --min-args 1 \
set _use_install 1 --max-args 1 \
case \* 'V/version=' \
echo "error: unknown option $opt" 'i/install' \
exit 1 -- \
end $argv
end or exit 1
set vga vmware set cfg $argv
set soundhw hda
set boot_order c
# Config
set _vm_media "/mnt/s/osmedia"
source $_agw_dir_rc/virtual-machines/$cfg
# Video
test "$_vga" test "$_vga"
and set vga $_vga and set vga $_vga
or set vga vmware
test "$_soundhw"
and set soundhw $_soundhw
set _args \ set _args \
--display sdl,gl=on \ --display sdl,gl=on \
$_args $_args
if test $_arch = "i386" || test $_arch = "x86_64" # Sound
test "$_soundhw"
and set soundhw $_soundhw
or set soundhw hda
# Machine
if test "$_arch" = "i386" || test "$_arch" = "x86_64"
set _args \ set _args \
--machine accel=kvm \ --machine accel=kvm \
--usb \ --usb \
$_args $_args
end end
if test $_use_install # Versioning
test "$_flag_version"
and set ver $_flag_version
or set ver $_ver
# Disk Media
set image "/mnt/s/vm/$cfg/image$ver"
# Install Media
set install (string replace "_ver_" "$ver" "$_install")
if test "$_flag_install"
set boot_order d set boot_order d
set _args \ set _args \
--drive file="$_install",media=cdrom,readonly \ --drive file="$install",media=cdrom,readonly \
$_args $_args
end end
if test $_boot # Boot Media
if test "$_boot"
set boot_order a set boot_order a
set _args \ set _args \
--drive file="$_boot",format=raw,if=floppy,readonly \ --drive file="$_boot",format=raw,if=floppy,readonly \
$_args $_args
else
set boot_order c
end end
# Run!
env QEMU_AUDIO_DRV=pa "qemu-system-$_arch" \ env QEMU_AUDIO_DRV=pa "qemu-system-$_arch" \
--drive file="$_vm_img",format=qcow2,media=disk \ --drive file="$image",format=qcow2,media=disk \
--boot order="$boot_order" \ --boot order="$boot_order" \
-m "$_mem" \ -m "$_mem" \
--soundhw "$soundhw" \ --soundhw "$soundhw" \