Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
6661587
Added VirtualBox, Gnome-Boxes for Arch, Debian/Ubuntu, Fedora, openSU…
Aug 4, 2025
c39a70d
renamed virtual-machines to virtualization
Aug 4, 2025
202e465
updated Arch virtualization to remove virtual manager as a choice sin…
Aug 4, 2025
945987d
Fixed descrtiptions in tab_data.toml for applications-setup, removed …
Aug 4, 2025
4d73bc3
Fixed gnome-boxes install
Aug 4, 2025
c5903bb
minor changes to fix typos and bashisms
Aug 5, 2025
d7be179
Merge branch 'ChrisTitusTech:main' into feature/applications/vms
namato1 Aug 11, 2025
b42aaff
Moved qemu and libvirt to virtualzation installer. added create virt…
namato1 Aug 11, 2025
eddcf8b
Added virt-manager vm creation
Aug 12, 2025
ff514d6
Merge branch 'ChrisTitusTech:main' into feature/applications/vms
namato1 Aug 12, 2025
f4cca01
Added qemu createVM and simplified install by setting cpu and memory …
Aug 12, 2025
28e1bc9
Merge branch 'feature/applications/vms' of https://github.com/namato1…
Aug 12, 2025
62c550f
Added libvirt to toml
Aug 12, 2025
8f6d752
finished most of the create VMs
Aug 14, 2025
5bad487
Merge branch 'ChrisTitusTech:main' into feature/applications/vms
namato1 Aug 14, 2025
989df43
Merge branch 'ChrisTitusTech:main' into feature/applications/vms
namato1 Aug 14, 2025
acd5e93
added port for ssh with NAT setup
Aug 17, 2025
f6bb0d7
Merge branch 'feature/applications/vms' of https://github.com/namato1…
Aug 17, 2025
6a5269f
Finished VirtualBox, No GPU passthough available according to Oracle …
Aug 18, 2025
fb892fd
Merge branch 'ChrisTitusTech:main' into feature/applications/vms
namato1 Aug 18, 2025
f58cf11
renamed libvirt.sh correctly
Aug 18, 2025
0c79382
updated QEMU and Virt-Manager
Aug 19, 2025
00b6ea9
Fixed issue with VirtualBox and QEMU
Aug 21, 2025
a46e467
Merge branch 'ChrisTitusTech:main' into feature/applications/vms
namato1 Aug 22, 2025
c731158
Fixed bashism test
Aug 22, 2025
ec4ce36
Fix bashism attempt
Aug 22, 2025
db2ecf1
Fix bashism attempt
Aug 22, 2025
1011936
Fixed bashism
Aug 22, 2025
bf95fce
Fixed last 2 bashism maybe?
Aug 22, 2025
072b203
changed virtualbox install variables
Aug 22, 2025
2a14bb9
fixed vbox installer
Aug 22, 2025
4eec4e9
fixed useless echos
Aug 22, 2025
79b3ed6
fixed useless echos
Aug 22, 2025
feb5194
fixed all variables not in double quotes
Aug 22, 2025
89792ad
fixed more variables not in double quotes
Aug 22, 2025
426793a
fixed more variables not in double quotes
Aug 22, 2025
d12c090
removed expr
Aug 22, 2025
24f2bef
fixed already being replaced incorrectly
Aug 22, 2025
50136f3
fixed last few errors
Aug 22, 2025
0fe5424
removed unnecessary comment
Aug 22, 2025
fe8756b
changed line 10 in virtualbox.sh to meet requirements
Aug 22, 2025
d41b210
changed line 10 second attempt
Aug 22, 2025
e551a74
changed line 10 third attempt
Aug 22, 2025
15eb847
changed sources.list creation to printf
Aug 22, 2025
524ea1d
changed sources.list creation to printf
Aug 22, 2025
2536676
changed sources.list creation to printf
Aug 22, 2025
4be647a
Fixed debian vbox install
Sep 11, 2025
9eabfcf
added ctype and rtype
Sep 17, 2025
55e0bc0
Merge branch 'ChrisTitusTech:main' into feature/applications/vms
namato1 Sep 17, 2025
6ec0462
Fixed typo in fallout76
Sep 17, 2025
79a1e0f
Fixed incorrect shell command in fallout76
Sep 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions core/tabs/applications-setup/tab_data.toml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,39 @@ description = "Waterfox is the privacy-focused web browser engineered to give yo
script = "browsers/waterfox.sh"
task_list = "FI"

[[data]]
name = "Virtual Machines"

[[data.entries]]
name = "Gnome Boxes"
description = "GNOME Boxes is a virtualization application for the GNOME Desktop Environment (works on KDE and others) that allows users to create and manage virtual machines easily."
script = "virtual-machines/gnome-boxes.sh"
task_list = "I"

[[data.entries]]
name = "VirtualBox"
description = "Oracle VirtualBox is an open source, cross-platform, virtualization software, enables users to run multiple operating systems on a single device."
script = "virtual-machines/virtualbox.sh"
task_list = "I"

[[data.entries]]
name = "Virt Manager"
description = "Virt Manager is a Graphical tool to manage libvirt Virtual Machines"
script = "virtual-machines/virt-manager.sh"
task_list = "I"

[[data.entries]]
name = "QEMU"
description = "QEMU is a generic and open source machine emulator and virtualizer."
script = "virtual-machines/qemu-install.sh"
task_list = "I"

[[data.entries]]
name = "LibVirt"
description = ""
script = "virtual-machines/libvirt.sh"
task_list = "I"

[[data]]
name = "Alacritty"
description = "Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows. This command installs and configures alacritty terminal emulator."
Expand Down
268 changes: 268 additions & 0 deletions core/tabs/applications-setup/virtualization/create-virtual-machine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
#!/bin/sh -e

. ../../common-script.sh

virtmanager() {
setVMDetails

case $distroInfo in
*"arch"*)
distro="archlinux" ;;
*"debian"*)
distro="debian""$(isoinfo -d -i "$isoFile" | awk 'NR==3{print $4}' | cut -f1 -d".")" ;;
*"fedora"*)
distro="fedora""${distroInfo##*-}" ;;
*"opensuse"*)
case $distroInfo in
*"leap"*)
distro="opensuse""${distroInfo##*-}" ;;
*)
distro="opensusetumbleweed" ;;
esac ;;
*"ubuntu"*)
distro="Ubuntu""$(isoinfo -d -i "$isoFile" | awk 'NR==3{print $4}' | cut -f1,2 -d".")" ;;
*)
case $windows in
*"windows"*)
distro="win11" ;;
*)
distro="unknown" ;;
esac ;;
esac

printf "%b\n" "Please enter full folder path of for VM"
read -r path

# setup physical PCI/USB etc
hostDev=""

qemu-img create -f qcow2 "$path"/"$name".qcow2 "$driveSize""G"
virt-install --name "$name" --memory="$memory" --vcpus="$vcpus" --cdrom "$isoFile" --os-variant "$distro" --disk "$path"/"$name".qcow2 "$hostDev"
}

qemu() {
setVMDetails

qemu-img create -f qcow2 "$name".qcow2 "$driveSize""G"
qemu-system-x86_64 \
-m "$memory"G \
-smp "$vcpus" \
-boot d \
-cdrom "$isoFile" \
-drive file="$name".qcow2,format=qcow2 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-device e1000,netdev=net0 \
-display default,show-cursor=on \
-cpu host \
-enable-kvm \
-name "$name"

printf "%b\n" "To run the VM after initial exit, use the command below"
printf "%b\n" "qemu-system-x86_64 -m ${memory}G -smp ${vcpus} -drive file=${name}.qcow2,format=qcow2 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 -device e1000,netdev=net0 \
-display default,show-cursor=on -smbios -enable-kvm -name ${name}"
printf "%b\n" "To import this VM into virt-manager run the below"
printf "%b\n" "virt-install --name ${name} --memory=${memory} --vcpus=${vcpus} --os-variant ${distro} --disk ${path}/${name}.qcow2 --network default --import"
}

libvirt() {
#setVMDetails
printf "%b\n" "${YELLOW}Libvirt is still under construction${RC}"
}

virtualbox(){
setVMDetails

case $distroInfo in
*"arch"*)
distro="ArchLinux" ;;
*"debian"*)
distro="Debian" ;;
*"fedora"*)
distro="Fedora" ;;
*"opensuse"*)
case $distroInfo in
*"leap"*)
distro="openSUSE_Leap" ;;
*)
distro="openSUSE_Tumbleweed" ;;
esac ;;
*"ubuntu"*)
distro="Ubuntu" ;;
*)
case $windows in
*"windows"*)
distro="Windows" ;;
*)
distro="Other Linux" ;;
esac ;;
esac

if [ "$(dpkg --print-architecture)" = "amd64" ]; then
arch="x86"
subdistro="$distro""_64"
elif [ "$(dpkg --print-architecture)" = "arm64" ]; then
arch="arm"
subdistro="$distro""_arm64"
else
printf "%b" "Architecture not supported"
fi

vboxmanage createvm --name="$name" --platform-architecture="$arch" --ostype="$distro" --register

vboxmanage modifyvm "$name" --os-type="$subdistro" --memory="$memory" --chipset=piix3 --graphicscontroller=vmsvga --firmware=efi --acpi=on --ioapic=on --cpus="$vcpus" --cpu-profile=host --hwvirtex=on --apic=on --x86-x2apic=on --paravirt-provider=kvm --nested-paging=on --large-pages=off --x86-vtx-vpid=on --x86-vtx-ux=on --accelerate-3d=on --vram=256 --x86-long-mode=on --x86-pae=off
vboxmanage modifyvm "$name" --mouse=usb --keyboard=ps2 --usb-ohci=on --usb-ehci=on --audio-enabled=on --audio-driver=default --audio-controller=ac97 --audio-codec=ad1980

# Create SSH port for headless access after install (ssh -p 2522 username@10.0.2.15)
vboxmanage modifyvm "$name" --nat-pf1 "SSH,tcp,127.0.0.1,2522,10.0.2.15,22"

vboxmanage createmedium disk --filename="/home/""$USER""/VirtualBox VMs/""$name""/""$name"".vdi" --size="$driveSize" --variant=Standard --format=VDI

vboxmanage storagectl "$name" --name "IDE" --add ide --controller piix4
vboxmanage storagectl "$name" --name "SATA" --add sata --controller IntelAHCI

vboxmanage storageattach "$name" --storagectl "SATA" --port 0 --device 0 --type hdd --medium "/home/""$USER""/VirtualBox VMs/""$name""/""$name"".vdi"
vboxmanage storageattach "$name" --storagectl "IDE" --port 0 --device 0 --type "$storageType" --medium "$isoFile"

# Graphics Passthrough not available on VirtualBox 7.0 and newer yet.

# printf "%b\n" "${YELLOW}Do you want to pass through a GPU?${RC}"

# if $passthtough == 1; then

# printf "%b\n" "Please enter the Graphics Card model (ex. 5080, 4060, 9070, etc)"
# read -r model
# graphicsAdapters=$(lspci | grep -i vga | grep -i "$model")

# SAVEIFS=$IFS
# IFS=$'\n'
# graphicsAdapters=("$graphicsAdapters")
# IFS=$SAVEIFS

# count=${#graphicsAdapters[@]}

# if [[ "$count" -gt 1 ]]; then
# graphicsAdapter=$(echo "$graphicsAdapters" | cut -f1 -d" ")
# fi

# graphicsAdapter=$($graphicsAdapters | cut -f1 -d" ")
# vboxmanage modifyvm "$name" --pci-attach=$graphicsAdapter@01:05.0
# fi

vboxmanage startvm "$name"
}

setVMDetails() {
# Set memory to 1/4 of host memnory
totalMemory=$(grep MemTotal /proc/meminfo | tr -s ' ' | cut -d ' ' -f2)
mem=$(("$totalMemory" / 1024000 + 1))
memory=$(("$mem" / 4))
if [ "$memory" -lt "2" ]; then
memory="2"
fi
memory=$(("$memory" * 1024))

totalCpus=$(getconf _NPROCESSORS_ONLN)
vcpus=$(("$totalCpus" / 4))
if [ "$vcpus" -lt "2" ]; then
vcpus="2"
fi

while true
do
printf "%b\n" "Please enter VM Name"
read -r name

if ! checkVMExists; then
break
else
printf "%b\n" "VM with that name already exists"
fi
done

printf "%b\n" "Please enter drive size"
read -r driveSize

printf "%b\n" "Please enter full iso path"
read -r isoFile

case $isoFile in
*".iso")
storageType=dvddrive

if ! command_exists isoinfo; then
installIsoInfo
fi

distroInfo=$(isoinfo -d -i "$isoFile" | grep -i "volume id:" | awk '{print $3}' | tr '[:upper:]' '[:lower:]')
windows=$(isoinfo -d -i "$isoFile" | grep -i "Publisher id:" | awk '{print $3, $4}') ;;
*)
storageType=hdd ;;
esac
}

installIsoInfo() {
printf "%b\n" "${YELLOW}Installing Gnome Boxes...${RC}"
case "$PACKAGER" in
apt-get|nala|dnf|zypper)
"$ESCALATION_TOOL" "$PACKAGER" -y install genisoimage
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
;;
esac
}

checkVMExists() {

if [ "$hypervisor" = "virt-manager" ]; then
vmExists=$(virsh list --all | grep -i "$name" | awk '{print $2}')
elif [ "$hypervisor" = "virtualbox" ]; then
vmExists=$(vboxmanage list vms | grep -i \""$name"\" | cut -f1 -d" ")
fi

if [ -z "$vmExists" ]; then
return 1
else
return 0
fi
}

checkInstalled() {
hypervisor=$1

if command_exists "$hypervisor"; then
if [ "$hypervisor" = "virt-manager" ]; then
virtmanager
elif [ "$hypervisor" = "qemu-img" ]; then
qemu
else
$hypervisor
fi
else
printf "%b\n" "${GREEN}${hypervisor} is not installed.${RC}"
exit 1
fi
}

main() {
printf "%b\n" "${YELLOW}Memory, CPU, OS/Distro are automatically determined${RC}"
printf "%b\n" "${YELLOW}Choose tool to create Virtual Machine:${RC}"
printf "%b\n" "1. ${YELLOW}Virtual-Manager${RC}"
printf "%b\n" "2. ${YELLOW}QEMU${RC}"
printf "%b\n" "3. ${YELLOW}VirtualBox${RC}"
# printf "%b\n" "4. ${YELLOW}Libvirt${RC}"
printf "%b" "Enter your choice [1-3]: "
read -r -r CHOICE
case "$CHOICE" in
1) checkInstalled virt-manager ;;
2) checkInstalled qemu-img ;;
3) checkInstalled virtualbox ;;
# 4) checkInstalled libvirt ;;
*) printf "%b\n" "${RED}Invalid choice.${RC}" && exit 1 ;;
esac
}

checkEnv
checkEscalationTool
main
23 changes: 23 additions & 0 deletions core/tabs/applications-setup/virtualization/gnome-boxes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

. ../../common-script.sh

installBoxes() {
printf "%b\n" "${YELLOW}Installing Gnome Boxes...${RC}"
case "$PACKAGER" in
apt-get|nala|dnf|zypper)
"$ESCALATION_TOOL" "$PACKAGER" -y install gnome-boxes
;;
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm gnome-boxes
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER" Installing Flatpak version"${RC}"
"$ESCALATION_TOOL" flatpak install --noninteractive org.gnome.Boxes
;;
esac
}

checkEnv
checkEscalationTool
installBoxes
61 changes: 61 additions & 0 deletions core/tabs/applications-setup/virtualization/libvirt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/sh -e

. ../../common-script.sh

checkKVM() {
if [ ! -e "/dev/kvm" ]; then
printf "%b\n" "${RED}KVM is not available. Make sure you have CPU virtualization support enabled in your BIOS/UEFI settings. Please refer https://wiki.archlinux.org/title/KVM for more information.${RC}"
else
"$ESCALATION_TOOL" usermod "$(who | awk 'NR==1{print $1}')" -aG kvm
fi
}

setupLibvirt() {
printf "%b\n" "${YELLOW}Configuring Libvirt.${RC}"
if "$PACKAGER" -Q | grep -q "iptables "; then
"$ESCALATION_TOOL" "$PACKAGER" -Rdd --noconfirm iptables
fi

"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm dnsmasq iptables-nft
"$ESCALATION_TOOL" sed -i 's/^#\?firewall_backend\s*=\s*".*"/firewall_backend = "iptables"/' "/etc/libvirt/network.conf"

if systemctl is-active --quiet polkit; then
"$ESCALATION_TOOL" sed -i 's/^#\?auth_unix_ro\s*=\s*".*"/auth_unix_ro = "polkit"/' "/etc/libvirt/libvirtd.conf"
"$ESCALATION_TOOL" sed -i 's/^#\?auth_unix_rw\s*=\s*".*"/auth_unix_rw = "polkit"/' "/etc/libvirt/libvirtd.conf"
fi

"$ESCALATION_TOOL" usermod "$USER" -aG libvirt

for value in libvirt libvirt_guest; do
if ! grep -wq "$value" /etc/nsswitch.conf; then
"$ESCALATION_TOOL" sed -i "/^hosts:/ s/$/ ${value}/" /etc/nsswitch.conf
fi
done

"$ESCALATION_TOOL" systemctl enable --now libvirtd.service
"$ESCALATION_TOOL" virsh net-autostart default

checkKVM
}

installLibvirt() {
printf "%b\n" "${YELLOW}Installing QEMU.${RC}"
case "$PACKAGER" in
pacman)
if ! command_exists libvirtd; then
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm libvirt dmidecode
else
printf "%b\n" "${GREEN}Libvirt is already installed.${RC}"
fi
setupLibvirt
;;
*)
printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}"
"$ESCALATION_TOOL" flatpak install --noninteractive org.virt_manager.virt_manager.Extension.Qemu
;;
esac
}

checkEnv
checkEscalationTool
installLibvirt
Loading