From 66615872ae40371e32d1c1447b63abe1d990a6a3 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Sun, 3 Aug 2025 21:27:18 -0400 Subject: [PATCH 01/42] Added VirtualBox, Gnome-Boxes for Arch, Debian/Ubuntu, Fedora, openSUSE. Added virt-manager for Debian/Ubuntu, openSUSE, moved Arch virt-manager to applications/virtual-machines, added QEMU for Debian/Ubuntu and openSUSE --- core/tabs/applications-setup/tab_data.toml | 27 +++++++++ .../virtual-machines/gnome-boxes.sh | 33 +++++++++++ .../virtual-machines/qemu-install.sh | 46 +++++++++++++++ .../virtual-machines/virt-manager.sh | 48 ++++++++++++++++ .../virtual-machines/virtualbox.sh | 57 +++++++++++++++++++ core/tabs/system-setup/arch/virtualization.sh | 18 +++--- 6 files changed, 220 insertions(+), 9 deletions(-) create mode 100644 core/tabs/applications-setup/virtual-machines/gnome-boxes.sh create mode 100644 core/tabs/applications-setup/virtual-machines/qemu-install.sh create mode 100644 core/tabs/applications-setup/virtual-machines/virt-manager.sh create mode 100644 core/tabs/applications-setup/virtual-machines/virtualbox.sh diff --git a/core/tabs/applications-setup/tab_data.toml b/core/tabs/applications-setup/tab_data.toml index 62eb71a17..5426346d1 100644 --- a/core/tabs/applications-setup/tab_data.toml +++ b/core/tabs/applications-setup/tab_data.toml @@ -222,6 +222,33 @@ 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 free type 2 hypervisor avialble on most Linux distributions" +script = "virtual-machines/gnome-boxes.sh" +task_list = "I" + +[[data.entries]] +name = "VirtualBox" +description = "VirtualBox is a type 2 hypervisor for creating virtual machines" +script = "virtual-machines/virtualbox.sh" +task_list = "I" + +[[data.entries]] +name = "Virt Manager" +description = "" +script = "virtual-machines/virt-manager.sh" +task_list = "I" + +[[data.entries]] +name = "QEMU" +description = "" +script = "virtual-machines/qemu-install.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." diff --git a/core/tabs/applications-setup/virtual-machines/gnome-boxes.sh b/core/tabs/applications-setup/virtual-machines/gnome-boxes.sh new file mode 100644 index 000000000..c475c5daf --- /dev/null +++ b/core/tabs/applications-setup/virtual-machines/gnome-boxes.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +. ../../common-script.sh + +installBoxes() { + printf "%b\n" "${YELLOW}Installing Gnome Boxes...${RC}" + case "$PACKAGER" in + apt-get|nala) + "$ESCALATION_TOOL" "$PACKAGER" -y install gnome-boxes + ;; + dnf) + "$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core + dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1) + + "$ESCALATION_TOOL" "$PACKAGER" -y install gnome-boxes + ;; + 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 + exit 1 + ;; + esac +} + +checkEnv +checkEscalationTool +installBoxes \ No newline at end of file diff --git a/core/tabs/applications-setup/virtual-machines/qemu-install.sh b/core/tabs/applications-setup/virtual-machines/qemu-install.sh new file mode 100644 index 000000000..d0a1909bf --- /dev/null +++ b/core/tabs/applications-setup/virtual-machines/qemu-install.sh @@ -0,0 +1,46 @@ +#!/bin/sh -e + +. ../../common-script.sh + +installQEMUDesktop() { + printf "%b\n" "${YELLOW}Installing QEMU.${RC}" + case "$PACKAGER" in + apt-get|nala) + if ! command_exists qemu-img; then + "$ESCALATION_TOOL" "$PACKAGER" install -y qemu-utils qemu-system-x86 qemu-system-gui + else + printf "%b\n" "${GREEN}QEMU already installed.${RC}" + fi + ;; + # dnf) + # if ! command_exists qemu-img; then + # "$ESCALATION_TOOL" "$PACKAGER" install -y qemu + # else + # printf "%b\n" "${GREEN}QEMU already installed.${RC}" + # fi + # ;; + zypper) + if ! command_exists qemu-img; then + "$ESCALATION_TOOL" "$PACKAGER" install -y qemu + else + printf "%b\n" "${GREEN}QEMU already installed.${RC}" + fi + ;; + # pacman) + # if ! command_exists qemu-img; then + # "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qemu-desktop + # else + # printf "%b\n" "${GREEN}QEMU is already installed.${RC}" + # fi + # checkKVM + # ;; + *) + printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" + exit 1 + ;; + esac +} + +checkEnv +checkEscalationTool +installQEMUDesktop \ No newline at end of file diff --git a/core/tabs/applications-setup/virtual-machines/virt-manager.sh b/core/tabs/applications-setup/virtual-machines/virt-manager.sh new file mode 100644 index 000000000..e4c58c9d4 --- /dev/null +++ b/core/tabs/applications-setup/virtual-machines/virt-manager.sh @@ -0,0 +1,48 @@ +#!/bin/sh -e + +. ../../common-script.sh + +installVirtManager() { + printf "%b\n" "${YELLOW}Installing VirtualBox...${RC}" + case "$PACKAGER" in + apt-get|nala) + if ! command_exists virt-manager; then + "$ESCALATION_TOOL" "$PACKAGER" install -y virt-manager + else + printf "%b\n" "${GREEN}Virt-Manager already installed.${RC}" + fi + ;; + # dnf) + # "$ESCALATION_TOOL" "$PACKAGER" install -y @virtualization + + # sudo systemctl start libvirtd + # #sets the libvirtd service to start on system start + # sudo systemctl enable libvirtd + + # #add current user to virt manager group + # sudo usermod -a -G libvirt $(whoami) + # ;; + zypper) + if ! command_exists virt-manager; then + "$ESCALATION_TOOL" "$PACKAGER" install -y virt-manager + else + printf "%b\n" "${GREEN}Virt-Manager already installed.${RC}" + fi + ;; + pacman) + if ! command_exists virt-manager; then + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm virt-manager + else + printf "%b\n" "${GREEN}Virt-Manager already installed.${RC}" + fi + ;; + *) + printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" + exit 1 + ;; + esac +} + +checkEnv +checkEscalationTool +installVirtManager \ No newline at end of file diff --git a/core/tabs/applications-setup/virtual-machines/virtualbox.sh b/core/tabs/applications-setup/virtual-machines/virtualbox.sh new file mode 100644 index 000000000..2fe5f3fe2 --- /dev/null +++ b/core/tabs/applications-setup/virtual-machines/virtualbox.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +. ../../common-script.sh + +installVirtualBox() { + printf "%b\n" "${YELLOW}Installing VirtualBox...${RC}" + case "$PACKAGER" in + apt-get|nala) + wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg + "$ESCALATION_TOOL" sh -c 'echo "Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs)\nSuites: $(lsb_release -cs 2>/dev/null)\nComponents: contrib\nArchitectures: $ARCH\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n" > /etc/apt/sources.list.d/virtualbox.sources' + "$ESCALATION_TOOL" "$PACKAGER" update + "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-7.1 + + wget -P /home/$USER/Downloads/vbox.vbox-extpack https://download.virtualbox.org/virtualbox/$(vboxmanage --version | cut -f1 -d"r")/Oracle_VirtualBox_Extension_Pack-$(vboxmanage --version | cut -f1 -d"r").vbox-extpack + VBoxManage extpack install vbox.vbox-extpack + ;; + dnf) + "$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core + dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1) + if [ "$dnf_version" -eq 4 ]; then + "$ESCALATION_TOOL" "$PACKAGER" config-manager --add-repo https://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo + else + "$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo + fi + "$ESCALATION_TOOL" "$PACKAGER" -y install VirtualBox-7.1.$ARCH + "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-guest-additions.$ARCH + ;; + zypper) + if [ "$DTYPE" == "opensuse-leap" ]; then + wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc + sudo rpm --import oracle_vbox_2016.asc + "$ESCALATION_TOOL" "$PACKAGER" addrepo -f https://download.virtualbox.org/virtualbox/rpm/opensuse/virtualbox.repo + fi + "$ESCALATION_TOOL" "$PACKAGER" install -y virtualbox + "$ESCALATION_TOOL" "$PACKAGER" install -y virtualbox-guest-tools + ;; + pacman) + "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm virtualbox-host-modules-arch + "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm virtualbox + "$ESCALATION_TOOL" modprobe vboxdrv + ;; + *) + printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" + exit 1 + ;; + esac +} + +virtualBoxPermissions() { + printf "%b\n" "${YELLOW}Adding current user to the vboxusers group...${RC}" + "$ESCALATION_TOOL" usermod -aG vboxusers "$USER" +} + +checkEnv +checkEscalationTool +installVirtualBox +virtualBoxPermissions \ No newline at end of file diff --git a/core/tabs/system-setup/arch/virtualization.sh b/core/tabs/system-setup/arch/virtualization.sh index e7543abca..3775a8afc 100755 --- a/core/tabs/system-setup/arch/virtualization.sh +++ b/core/tabs/system-setup/arch/virtualization.sh @@ -21,14 +21,14 @@ installQEMUEmulators() { fi } -installVirtManager() { - if ! command_exists virt-manager; then - printf "%b\n" "${YELLOW}Installing Virt-Manager.${RC}" - "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm virt-manager - else - printf "%b\n" "${GREEN}Virt-Manager already installed.${RC}" - fi -} +# installVirtManager() { +# if ! command_exists virt-manager; then +# printf "%b\n" "${YELLOW}Installing Virt-Manager.${RC}" +# "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm virt-manager +# else +# printf "%b\n" "${GREEN}Virt-Manager already installed.${RC}" +# fi +# } checkKVM() { if [ ! -e "/dev/kvm" ]; then @@ -88,7 +88,7 @@ main() { 1) installQEMUDesktop ;; 2) installQEMUEmulators ;; 3) installLibvirt ;; - 4) installVirtManager ;; + #4) installVirtManager ;; 5) installQEMUDesktop installQEMUEmulators From c39a70dd9f65fa4400033a3384766306f0379df2 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Mon, 4 Aug 2025 07:08:25 -0400 Subject: [PATCH 02/42] renamed virtual-machines to virtualization --- .../{virtual-machines => virtualization}/gnome-boxes.sh | 0 .../{virtual-machines => virtualization}/qemu-install.sh | 0 .../{virtual-machines => virtualization}/virt-manager.sh | 0 .../{virtual-machines => virtualization}/virtualbox.sh | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename core/tabs/applications-setup/{virtual-machines => virtualization}/gnome-boxes.sh (100%) rename core/tabs/applications-setup/{virtual-machines => virtualization}/qemu-install.sh (100%) rename core/tabs/applications-setup/{virtual-machines => virtualization}/virt-manager.sh (100%) rename core/tabs/applications-setup/{virtual-machines => virtualization}/virtualbox.sh (100%) diff --git a/core/tabs/applications-setup/virtual-machines/gnome-boxes.sh b/core/tabs/applications-setup/virtualization/gnome-boxes.sh similarity index 100% rename from core/tabs/applications-setup/virtual-machines/gnome-boxes.sh rename to core/tabs/applications-setup/virtualization/gnome-boxes.sh diff --git a/core/tabs/applications-setup/virtual-machines/qemu-install.sh b/core/tabs/applications-setup/virtualization/qemu-install.sh similarity index 100% rename from core/tabs/applications-setup/virtual-machines/qemu-install.sh rename to core/tabs/applications-setup/virtualization/qemu-install.sh diff --git a/core/tabs/applications-setup/virtual-machines/virt-manager.sh b/core/tabs/applications-setup/virtualization/virt-manager.sh similarity index 100% rename from core/tabs/applications-setup/virtual-machines/virt-manager.sh rename to core/tabs/applications-setup/virtualization/virt-manager.sh diff --git a/core/tabs/applications-setup/virtual-machines/virtualbox.sh b/core/tabs/applications-setup/virtualization/virtualbox.sh similarity index 100% rename from core/tabs/applications-setup/virtual-machines/virtualbox.sh rename to core/tabs/applications-setup/virtualization/virtualbox.sh From 202e465bd6eff80c5154935da41fbf5d3f76cffb Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Mon, 4 Aug 2025 07:17:11 -0400 Subject: [PATCH 03/42] updated Arch virtualization to remove virtual manager as a choice since it was moved to applications-setup/virtualization --- core/tabs/system-setup/arch/virtualization.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/tabs/system-setup/arch/virtualization.sh b/core/tabs/system-setup/arch/virtualization.sh index 3775a8afc..16a6be803 100755 --- a/core/tabs/system-setup/arch/virtualization.sh +++ b/core/tabs/system-setup/arch/virtualization.sh @@ -80,16 +80,16 @@ main() { printf "%b\n" "1. ${YELLOW}QEMU${RC}" printf "%b\n" "2. ${YELLOW}QEMU-Emulators ( Extended architectures )${RC}" printf "%b\n" "3. ${YELLOW}Libvirt${RC}" - printf "%b\n" "4. ${YELLOW}Virtual-Manager${RC}" - printf "%b\n" "5. ${YELLOW}All${RC}" + #printf "%b\n" "4. ${YELLOW}Virtual-Manager${RC}" + printf "%b\n" "4. ${YELLOW}All${RC}" printf "%b" "Enter your choice [1-5]: " read -r CHOICE case "$CHOICE" in - 1) installQEMUDesktop ;; + 1) installQ#EMUDesktop ;; 2) installQEMUEmulators ;; 3) installLibvirt ;; #4) installVirtManager ;; - 5) + 4) installQEMUDesktop installQEMUEmulators installLibvirt From 945987d44bf6f159c7197df8d34ff716976ac05c Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Mon, 4 Aug 2025 09:01:17 -0400 Subject: [PATCH 04/42] Fixed descrtiptions in tab_data.toml for applications-setup, removed # in wrong place in arch virtualization --- core/tabs/applications-setup/tab_data.toml | 8 ++++---- core/tabs/system-setup/arch/virtualization.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/tabs/applications-setup/tab_data.toml b/core/tabs/applications-setup/tab_data.toml index 5426346d1..3568d3721 100644 --- a/core/tabs/applications-setup/tab_data.toml +++ b/core/tabs/applications-setup/tab_data.toml @@ -227,25 +227,25 @@ name = "Virtual Machines" [[data.entries]] name = "Gnome Boxes" -description = "Gnome Boxes is a free type 2 hypervisor avialble on most Linux distributions" +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 = "VirtualBox is a type 2 hypervisor for creating virtual machines" +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 = "" +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 = "" +description = "QEMU is a generic and open source machine emulator and virtualizer." script = "virtual-machines/qemu-install.sh" task_list = "I" diff --git a/core/tabs/system-setup/arch/virtualization.sh b/core/tabs/system-setup/arch/virtualization.sh index 16a6be803..25904ff01 100755 --- a/core/tabs/system-setup/arch/virtualization.sh +++ b/core/tabs/system-setup/arch/virtualization.sh @@ -85,7 +85,7 @@ main() { printf "%b" "Enter your choice [1-5]: " read -r CHOICE case "$CHOICE" in - 1) installQ#EMUDesktop ;; + 1) installQEMUDesktop ;; 2) installQEMUEmulators ;; 3) installLibvirt ;; #4) installVirtManager ;; From 4d73bc3b33ce3ece84320df38937540dbb71b351 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Mon, 4 Aug 2025 17:10:11 -0400 Subject: [PATCH 05/42] Fixed gnome-boxes install --- core/tabs/applications-setup/virtualization/gnome-boxes.sh | 4 ---- core/tabs/applications-setup/virtualization/qemu-install.sh | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/gnome-boxes.sh b/core/tabs/applications-setup/virtualization/gnome-boxes.sh index c475c5daf..cda2ed7ed 100644 --- a/core/tabs/applications-setup/virtualization/gnome-boxes.sh +++ b/core/tabs/applications-setup/virtualization/gnome-boxes.sh @@ -9,9 +9,6 @@ installBoxes() { "$ESCALATION_TOOL" "$PACKAGER" -y install gnome-boxes ;; dnf) - "$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core - dnf_version=$(dnf --version | head -n 1 | cut -d '.' -f 1) - "$ESCALATION_TOOL" "$PACKAGER" -y install gnome-boxes ;; zypper) @@ -23,7 +20,6 @@ installBoxes() { *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER" Installing Flatpak version"${RC}" "$ESCALATION_TOOL" flatpak install --noninteractive org.gnome.Boxes - exit 1 ;; esac } diff --git a/core/tabs/applications-setup/virtualization/qemu-install.sh b/core/tabs/applications-setup/virtualization/qemu-install.sh index d0a1909bf..5e290e5c5 100644 --- a/core/tabs/applications-setup/virtualization/qemu-install.sh +++ b/core/tabs/applications-setup/virtualization/qemu-install.sh @@ -36,7 +36,7 @@ installQEMUDesktop() { # ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" - exit 1 + "$ESCALATION_TOOL" flatpak install --noninteractive org.virt_manager.virt_manager.Extension.Qemu ;; esac } From c5903bbf942e2604cd1fd32216e6967c9de4cd57 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Tue, 5 Aug 2025 07:05:19 -0400 Subject: [PATCH 06/42] minor changes to fix typos and bashisms --- .../virtualization/qemu-install.sh | 15 --------------- .../virtualization/virt-manager.sh | 1 + 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/qemu-install.sh b/core/tabs/applications-setup/virtualization/qemu-install.sh index 5e290e5c5..26fe1c4e2 100644 --- a/core/tabs/applications-setup/virtualization/qemu-install.sh +++ b/core/tabs/applications-setup/virtualization/qemu-install.sh @@ -12,13 +12,6 @@ installQEMUDesktop() { printf "%b\n" "${GREEN}QEMU already installed.${RC}" fi ;; - # dnf) - # if ! command_exists qemu-img; then - # "$ESCALATION_TOOL" "$PACKAGER" install -y qemu - # else - # printf "%b\n" "${GREEN}QEMU already installed.${RC}" - # fi - # ;; zypper) if ! command_exists qemu-img; then "$ESCALATION_TOOL" "$PACKAGER" install -y qemu @@ -26,14 +19,6 @@ installQEMUDesktop() { printf "%b\n" "${GREEN}QEMU already installed.${RC}" fi ;; - # pacman) - # if ! command_exists qemu-img; then - # "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qemu-desktop - # else - # printf "%b\n" "${GREEN}QEMU is already installed.${RC}" - # fi - # checkKVM - # ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" "$ESCALATION_TOOL" flatpak install --noninteractive org.virt_manager.virt_manager.Extension.Qemu diff --git a/core/tabs/applications-setup/virtualization/virt-manager.sh b/core/tabs/applications-setup/virtualization/virt-manager.sh index e4c58c9d4..7ba332eb4 100644 --- a/core/tabs/applications-setup/virtualization/virt-manager.sh +++ b/core/tabs/applications-setup/virtualization/virt-manager.sh @@ -38,6 +38,7 @@ installVirtManager() { ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" + "$ESCALATION_TOOL" flatpak install --noninteractive org.virt_manager.virt-manager exit 1 ;; esac From b42aaff121763fdc34047179f73dbc39e8504681 Mon Sep 17 00:00:00 2001 From: namato1 <60294463+namato1@users.noreply.github.com> Date: Mon, 11 Aug 2025 16:05:51 -0400 Subject: [PATCH 07/42] Moved qemu and libvirt to virtualzation installer. added create virtual machine script with only VirtalBox completed so far --- .../virtualization/create-virtual-machine.sh | 94 ++++++++++ .../virtualization/libvert.sh | 61 +++++++ .../virtualization/qemu-install.sh | 48 +++++- .../virtualization/virt-manager.sh | 16 +- core/tabs/system-setup/arch/virtualization.sh | 160 +++++++++--------- .../system-setup/fedora/virtualization.sh | 34 ++-- 6 files changed, 307 insertions(+), 106 deletions(-) create mode 100644 core/tabs/applications-setup/virtualization/create-virtual-machine.sh create mode 100644 core/tabs/applications-setup/virtualization/libvert.sh diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh new file mode 100644 index 000000000..d255ffa1d --- /dev/null +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -0,0 +1,94 @@ +#!/bin/sh -e + +. ../../common-script.sh + +createVBoxVM(){ + echo "Please enter VM Name" + read name + + printf "%b\n" "Select Distro:" + printf "%b\n" "1. ArchLinux" + printf "%b\n" "2. Debian" + printf "%b\n" "3. Fedora" + printf "%b\n" "4. Gentoo" + printf "%b\n" "5. Oracle Linux" + printf "%b\n" "6. Red Hat" + printf "%b\n" "7. openSUSE" + printf "%b\n" "8. Ubuntu" + printf "%b\n" "9. Windows 11" + printf "%b\n" "10. Other" + printf "%b" "Enter your choice [1-10]: " + read -r CHOICE + case "$CHOICE" in + 1) distro="ArchLinux" ;; + 2) distro="Debian" ;; + 3) distro="Fedora" ;; + 4) distro="Gentoo" ;; + 5) distro="Oracle" ;; + 6) distro="Red Hat" ;; + 7) distro="openSUSE" ;; + 8) distro="Ubuntu" ;; + 9) distro="Windows11" ;; + 10) distro="Other" ;; + + *) printf "%b\n" "Invalid choice." && exit 1 ;; + esac + + if [[ "$distro" = "openSUSE" ]]; then + printf "%b\n" "Select openSUSE Version:" + printf "%b\n" "1. Leap" + printf "%b\n" "2. Tumbleweed" + printf "%b" "Enter your choice [1-2]: " + read -r CHOICE2 + case "$CHOICE2" in + 1) distro="openSUSE_Leap" ;; + 2) distro="openSUSE_Tumbleweed" ;; + *) printf "%b\n" "Invalid choice." && exit 1 ;; + esac + fi + + if [[ "$(dpkg --print-architecture)" == "amd64" ]]; then + arch="x86" + subdistro="$distro""_64" + elif [[ "$(dpkg --print-architecture)" == "arm64" ]]; then + arch="arm" + subdistro="$distro""_arm64" + fi + + vboxmanage createvm --name="$name" --platform-architecture=$arch --ostype="$distro" --register + + vboxmanage modifyvm "$name" --os-type=$subdistro --memory=4096 --chipset=piix3 --graphicscontroller=vmsvga --firmware=efi --acpi=on --ioapic=on --cpus=4 --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 + + vboxmanage createmedium disk --filename="/media/namato/Data/Virtual Machines/$name/$name.vdi" --size=100000 --variant=Standard --format=VDI + + vboxmanage storagectl "$name" --name "IDE Controller" --add ide --controller piix4 + vboxmanage storagectl "$name" --name "SATA Controller" --add sata --controller IntelAHCI + + vboxmanage storageattach "$name" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium "/media/namato/Data/Virtual Machines/usbboot.vmdk" + vboxmanage storageattach "$name" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium emptydrive + vboxmanage storageattach "$name" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "/media/namato/Data/Virtual Machines/$name/$name.vdi" +} + +main() { + 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}Libvirt${RC}" + printf "%b\n" "4. ${YELLOW}VirtualBox${RC}" + printf "%b\n" "5. ${YELLOW}Gnome Boxes${RC}" + printf "%b" "Enter your choice [1-5]: " + read -r CHOICE + case "$CHOICE" in + 1) createVirtManagerVM ;; + 2) createQEMUVM ;; + 3) createLibvirtVM ;; + 4) createVBoxVM ;; + 5) createGnomeBoxVM;; + *) printf "%b\n" "${RED}Invalid choice.${RC}" && exit 1 ;; + esac +} + +checkEnv +checkEscalationTool +main \ No newline at end of file diff --git a/core/tabs/applications-setup/virtualization/libvert.sh b/core/tabs/applications-setup/virtualization/libvert.sh new file mode 100644 index 000000000..27c3fe3e7 --- /dev/null +++ b/core/tabs/applications-setup/virtualization/libvert.sh @@ -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 "$USER" -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 \ No newline at end of file diff --git a/core/tabs/applications-setup/virtualization/qemu-install.sh b/core/tabs/applications-setup/virtualization/qemu-install.sh index 26fe1c4e2..368fa24e3 100644 --- a/core/tabs/applications-setup/virtualization/qemu-install.sh +++ b/core/tabs/applications-setup/virtualization/qemu-install.sh @@ -12,6 +12,16 @@ installQEMUDesktop() { printf "%b\n" "${GREEN}QEMU already installed.${RC}" fi ;; + dnf) + "$ESCALATION_TOOL" "$PACKAGER" install -y @virtualization + + sudo systemctl start libvirtd + #sets the libvirtd service to start on system start + sudo systemctl enable libvirtd + + #add current user to virt manager group + sudo usermod -a -G libvirt $(whoami) + ;; zypper) if ! command_exists qemu-img; then "$ESCALATION_TOOL" "$PACKAGER" install -y qemu @@ -19,6 +29,33 @@ installQEMUDesktop() { printf "%b\n" "${GREEN}QEMU already installed.${RC}" fi ;; + pacman) + if ! command_exists qemu-img; then + printf "%b\n" "${YELLOW}Installing QEMU.${RC}" + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qemu-desktop + else + printf "%b\n" "${GREEN}QEMU is already installed.${RC}" + fi + checkKVM + ;; + *) + printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" + "$ESCALATION_TOOL" flatpak install --noninteractive org.virt_manager.virt_manager.Extension.Qemu + ;; + +} + +installQEMUEmulators() { + printf "%b\n" "${YELLOW}Installing QEMU.${RC}" + case "$PACKAGER" in + pacman) + if ! "$PACKAGER" -Q | grep -q "qemu-emulators-full "; then + printf "%b\n" "${YELLOW}Installing QEMU-Emulators.${RC}" + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qemu-emulators-full swtpm + else + printf "%b\n" "${GREEN}QEMU-Emulators already installed.${RC}" + fi + ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" "$ESCALATION_TOOL" flatpak install --noninteractive org.virt_manager.virt_manager.Extension.Qemu @@ -26,6 +63,15 @@ installQEMUDesktop() { esac } +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 "$USER" -aG kvm + fi +} + checkEnv checkEscalationTool -installQEMUDesktop \ No newline at end of file +installQEMUDesktop +installQEMUEmulators \ No newline at end of file diff --git a/core/tabs/applications-setup/virtualization/virt-manager.sh b/core/tabs/applications-setup/virtualization/virt-manager.sh index 7ba332eb4..3ff352867 100644 --- a/core/tabs/applications-setup/virtualization/virt-manager.sh +++ b/core/tabs/applications-setup/virtualization/virt-manager.sh @@ -12,16 +12,16 @@ installVirtManager() { printf "%b\n" "${GREEN}Virt-Manager already installed.${RC}" fi ;; - # dnf) - # "$ESCALATION_TOOL" "$PACKAGER" install -y @virtualization + dnf) + "$ESCALATION_TOOL" "$PACKAGER" install -y @virtualization - # sudo systemctl start libvirtd - # #sets the libvirtd service to start on system start - # sudo systemctl enable libvirtd + sudo systemctl start libvirtd + #sets the libvirtd service to start on system start + sudo systemctl enable libvirtd - # #add current user to virt manager group - # sudo usermod -a -G libvirt $(whoami) - # ;; + #add current user to virt manager group + sudo usermod -a -G libvirt $(whoami) + ;; zypper) if ! command_exists virt-manager; then "$ESCALATION_TOOL" "$PACKAGER" install -y virt-manager diff --git a/core/tabs/system-setup/arch/virtualization.sh b/core/tabs/system-setup/arch/virtualization.sh index 25904ff01..d2f613c39 100755 --- a/core/tabs/system-setup/arch/virtualization.sh +++ b/core/tabs/system-setup/arch/virtualization.sh @@ -1,25 +1,25 @@ #!/bin/sh -e -. ../../common-script.sh +# . ../../common-script.sh -installQEMUDesktop() { - if ! command_exists qemu-img; then - printf "%b\n" "${YELLOW}Installing QEMU.${RC}" - "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qemu-desktop - else - printf "%b\n" "${GREEN}QEMU is already installed.${RC}" - fi - checkKVM -} +# installQEMUDesktop() { +# if ! command_exists qemu-img; then +# printf "%b\n" "${YELLOW}Installing QEMU.${RC}" +# "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qemu-desktop +# else +# printf "%b\n" "${GREEN}QEMU is already installed.${RC}" +# fi +# checkKVM +# } -installQEMUEmulators() { - if ! "$PACKAGER" -Q | grep -q "qemu-emulators-full "; then - printf "%b\n" "${YELLOW}Installing QEMU-Emulators.${RC}" - "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qemu-emulators-full swtpm - else - printf "%b\n" "${GREEN}QEMU-Emulators already installed.${RC}" - fi -} +# installQEMUEmulators() { +# if ! "$PACKAGER" -Q | grep -q "qemu-emulators-full "; then +# printf "%b\n" "${YELLOW}Installing QEMU-Emulators.${RC}" +# "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm qemu-emulators-full swtpm +# else +# printf "%b\n" "${GREEN}QEMU-Emulators already installed.${RC}" +# fi +# } # installVirtManager() { # if ! command_exists virt-manager; then @@ -30,75 +30,75 @@ installQEMUEmulators() { # fi # } -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 "$USER" -aG kvm - fi -} +# 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 "$USER" -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 +# 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" +# "$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 +# 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 +# "$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 +# 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 +# "$ESCALATION_TOOL" systemctl enable --now libvirtd.service +# "$ESCALATION_TOOL" virsh net-autostart default - checkKVM -} +# checkKVM +# } -installLibvirt() { - 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 -} +# installLibvirt() { +# 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 +# } -main() { - printf "%b\n" "${YELLOW}Choose what to install:${RC}" - printf "%b\n" "1. ${YELLOW}QEMU${RC}" - printf "%b\n" "2. ${YELLOW}QEMU-Emulators ( Extended architectures )${RC}" - printf "%b\n" "3. ${YELLOW}Libvirt${RC}" - #printf "%b\n" "4. ${YELLOW}Virtual-Manager${RC}" - printf "%b\n" "4. ${YELLOW}All${RC}" - printf "%b" "Enter your choice [1-5]: " - read -r CHOICE - case "$CHOICE" in - 1) installQEMUDesktop ;; - 2) installQEMUEmulators ;; - 3) installLibvirt ;; - #4) installVirtManager ;; - 4) - installQEMUDesktop - installQEMUEmulators - installLibvirt - installVirtManager - ;; - *) printf "%b\n" "${RED}Invalid choice.${RC}" && exit 1 ;; - esac -} +# main() { +# printf "%b\n" "${YELLOW}Choose what to install:${RC}" +# printf "%b\n" "1. ${YELLOW}QEMU${RC}" +# printf "%b\n" "2. ${YELLOW}QEMU-Emulators ( Extended architectures )${RC}" +# printf "%b\n" "3. ${YELLOW}Libvirt${RC}" +# printf "%b\n" "4. ${YELLOW}Virtual-Manager${RC}" +# printf "%b\n" "5. ${YELLOW}All${RC}" +# printf "%b" "Enter your choice [1-5]: " +# read -r CHOICE +# case "$CHOICE" in +# 1) installQEMUDesktop ;; +# 2) installQEMUEmulators ;; +# 3) installLibvirt ;; +# 4) installVirtManager ;; +# 5) +# installQEMUDesktop +# installQEMUEmulators +# installLibvirt +# installVirtManager +# ;; +# *) printf "%b\n" "${RED}Invalid choice.${RC}" && exit 1 ;; +# esac +# } -checkEnv -checkEscalationTool -main +# checkEnv +# checkEscalationTool +# main \ No newline at end of file diff --git a/core/tabs/system-setup/fedora/virtualization.sh b/core/tabs/system-setup/fedora/virtualization.sh index 3359efeb5..f2cbdc640 100644 --- a/core/tabs/system-setup/fedora/virtualization.sh +++ b/core/tabs/system-setup/fedora/virtualization.sh @@ -1,21 +1,21 @@ #!/bin/sh -e -. ../../common-script.sh +# . ../../common-script.sh -# Install virtualization tools to enable virtual machines -configureVirtualization() { - case "$PACKAGER" in - dnf) - printf "%b\n" "${YELLOW}Installing virtualization tools...${RC}" - "$ESCALATION_TOOL" "$PACKAGER" install -y @virtualization - printf "%b\n" "${GREEN}Installed virtualization tools...${RC}" - ;; - *) - printf "%b\n" "${RED}Unsupported distribution: $DTYPE${RC}" - ;; - esac -} +# # Install virtualization tools to enable virtual machines +# configureVirtualization() { +# case "$PACKAGER" in +# dnf) +# printf "%b\n" "${YELLOW}Installing virtualization tools...${RC}" +# "$ESCALATION_TOOL" "$PACKAGER" install -y @virtualization +# printf "%b\n" "${GREEN}Installed virtualization tools...${RC}" +# ;; +# *) +# printf "%b\n" "${RED}Unsupported distribution: $DTYPE${RC}" +# ;; +# esac +# } -checkEnv -checkEscalationTool -configureVirtualization +# checkEnv +# checkEscalationTool +# configureVirtualization From eddcf8bc507c841fbf4ba791b67e4a94bf1a63a3 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Mon, 11 Aug 2025 20:56:37 -0400 Subject: [PATCH 08/42] Added virt-manager vm creation --- .../virtualization/create-virtual-machine.sh | 135 +++++++++++++++--- .../virtualization/virt-manager.sh | 2 +- 2 files changed, 120 insertions(+), 17 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index d255ffa1d..e16fe86d8 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -2,10 +2,58 @@ . ../../common-script.sh +createVirtManagerVM() { + setVMDetails + virt-install --name "$name" --memory=$memory --vcpus=$vcpus --location $isoFile --os-type $os --osVariant $distro --disk size=$driveSize --network network=default +} + +createQEMUVM() { + setVMDetails +} + +createLibvirtVM() { + setVMDetails +} + createVBoxVM(){ + setVMDetails + 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 + + vboxmanage createmedium disk --filename="/media/namato/Data/Virtual Machines/$name/$name.vdi" --size=$driveSize --variant=Standard --format=VDI + + vboxmanage storagectl "$name" --name "IDE Controller" --add ide --controller piix4 + vboxmanage storagectl "$name" --name "SATA Controller" --add sata --controller IntelAHCI + + vboxmanage storageattach "$name" --storagectl "IDE Controller" --port 0 --device 0 --type $storageType --medium "$isoFile" + vboxmanage storageattach "$name" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$name.vdi" +} + +createGnomeBoxVM() { + setVMDetails +} + +setVMDetails() { echo "Please enter VM Name" read name + echo "Please enter amount of memory in MB" + read memory + + echo "Please enter number of vCPUs" + read vcpus + + echo "Please enter drive size (virtualbox in MB. virt-manage in GB)" + read driveSize + + echo "Please enter full iso/drive path" + read isoFile + + echo "Please select OS" + read os + printf "%b\n" "Select Distro:" printf "%b\n" "1. ArchLinux" printf "%b\n" "2. Debian" @@ -16,7 +64,7 @@ createVBoxVM(){ printf "%b\n" "7. openSUSE" printf "%b\n" "8. Ubuntu" printf "%b\n" "9. Windows 11" - printf "%b\n" "10. Other" + printf "%b\n" "10. Enter Distro Name" printf "%b" "Enter your choice [1-10]: " read -r CHOICE case "$CHOICE" in @@ -29,7 +77,7 @@ createVBoxVM(){ 7) distro="openSUSE" ;; 8) distro="Ubuntu" ;; 9) distro="Windows11" ;; - 10) distro="Other" ;; + 10) read distro ;; *) printf "%b\n" "Invalid choice." && exit 1 ;; esac @@ -55,19 +103,74 @@ createVBoxVM(){ subdistro="$distro""_arm64" fi - vboxmanage createvm --name="$name" --platform-architecture=$arch --ostype="$distro" --register + if $isoFile ~= *".iso"; then + storageType=dvddrive + else + storageType=hdd + fi +} - vboxmanage modifyvm "$name" --os-type=$subdistro --memory=4096 --chipset=piix3 --graphicscontroller=vmsvga --firmware=efi --acpi=on --ioapic=on --cpus=4 --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 +checkInstalled() { + hypervisor=$1 + + printf "%b\n" "${YELLOW}Check if $ ${RC}" + case "$PACKAGER" in + apt-get|nala) + if ! command_exists $hypervisor; then + runCreateVM $hypervisor + else + printf "%b\n" "${GREEN}$hypervisor is not installed.${RC}" + exit 1 + fi + ;; + dnf) + if ! command_exists $hypervisor; then + runCreateVM $hypervisor + else + printf "%b\n" "${GREEN}$hypervisor is not installed.${RC}" + exit 1 + fi + ;; + zypper) + if ! command_exists virt-manager; then + runCreateVM $hypervisor + else + printf "%b\n" "${GREEN}$hypervisor is not installed.${RC}" + exit 1 + fi + ;; + pacman) + if ! command_exists virt-manager; then + runCreateVM $hypervisor + else + printf "%b\n" "${GREEN}$hypervisor is not installed.${RC}" + exit 1 + fi + ;; + *) + printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" + exit 1 + ;; + esac +} - vboxmanage createmedium disk --filename="/media/namato/Data/Virtual Machines/$name/$name.vdi" --size=100000 --variant=Standard --format=VDI +runCreateVM() { + hypervisor=$1 - vboxmanage storagectl "$name" --name "IDE Controller" --add ide --controller piix4 - vboxmanage storagectl "$name" --name "SATA Controller" --add sata --controller IntelAHCI + if "$hypervisor" == "virt-manager"; then + createVirtManagerVM + elif "$hypervisor" == "qemu-img"; then + createQEMUVM + elif "$hypervisor" == "libvirt"; then + createLibvirtVM + elif "$hypervisor" == "virtualbox"; then + createVBoxVM + elif "$hypervisor" == "gnome-boxes"; then + createGnomeBoxVM + else + printf "%b\n" "hypervisor not supported" + fi - vboxmanage storageattach "$name" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium "/media/namato/Data/Virtual Machines/usbboot.vmdk" - vboxmanage storageattach "$name" --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium emptydrive - vboxmanage storageattach "$name" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "/media/namato/Data/Virtual Machines/$name/$name.vdi" } main() { @@ -80,11 +183,11 @@ main() { printf "%b" "Enter your choice [1-5]: " read -r CHOICE case "$CHOICE" in - 1) createVirtManagerVM ;; - 2) createQEMUVM ;; - 3) createLibvirtVM ;; - 4) createVBoxVM ;; - 5) createGnomeBoxVM;; + 1) checkInstalled virt-manager ;; + 2) checkInstalled qemu-img ;; + 3) checkInstalled libvirt ;; + 4) checkInstalled virtualbox ;; + 5) checkInstalled gnome-boxes ;; *) printf "%b\n" "${RED}Invalid choice.${RC}" && exit 1 ;; esac } diff --git a/core/tabs/applications-setup/virtualization/virt-manager.sh b/core/tabs/applications-setup/virtualization/virt-manager.sh index 3ff352867..27252aeb7 100644 --- a/core/tabs/applications-setup/virtualization/virt-manager.sh +++ b/core/tabs/applications-setup/virtualization/virt-manager.sh @@ -3,7 +3,7 @@ . ../../common-script.sh installVirtManager() { - printf "%b\n" "${YELLOW}Installing VirtualBox...${RC}" + printf "%b\n" "${YELLOW}Installing Virtual Manager...${RC}" case "$PACKAGER" in apt-get|nala) if ! command_exists virt-manager; then From f4cca01a57bd4b83816b23540d92fe015bf83811 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Tue, 12 Aug 2025 10:46:18 -0400 Subject: [PATCH 09/42] Added qemu createVM and simplified install by setting cpu and memory to 1/4 physical size --- .../virtualization/create-virtual-machine.sh | 101 ++++-------------- .../virtualization/gnome-boxes.sh | 8 +- .../virtualization/qemu-install.sh | 2 +- .../virtualization/virt-manager.sh | 13 +-- 4 files changed, 26 insertions(+), 98 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index e16fe86d8..f70130496 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -9,6 +9,24 @@ createVirtManagerVM() { createQEMUVM() { setVMDetails + + qemu-img create -f qcow2 $name.qcow2 $driveSize + 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 + 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 } createLibvirtVM() { @@ -17,6 +35,8 @@ createLibvirtVM() { createVBoxVM(){ setVMDetails + + memory=$(expr $memory \* 1024) 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 @@ -31,83 +51,8 @@ createVBoxVM(){ vboxmanage storageattach "$name" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$name.vdi" } -createGnomeBoxVM() { - setVMDetails -} - setVMDetails() { - echo "Please enter VM Name" - read name - - echo "Please enter amount of memory in MB" - read memory - - echo "Please enter number of vCPUs" - read vcpus - - echo "Please enter drive size (virtualbox in MB. virt-manage in GB)" - read driveSize - - echo "Please enter full iso/drive path" - read isoFile - - echo "Please select OS" - read os - - printf "%b\n" "Select Distro:" - printf "%b\n" "1. ArchLinux" - printf "%b\n" "2. Debian" - printf "%b\n" "3. Fedora" - printf "%b\n" "4. Gentoo" - printf "%b\n" "5. Oracle Linux" - printf "%b\n" "6. Red Hat" - printf "%b\n" "7. openSUSE" - printf "%b\n" "8. Ubuntu" - printf "%b\n" "9. Windows 11" - printf "%b\n" "10. Enter Distro Name" - printf "%b" "Enter your choice [1-10]: " - read -r CHOICE - case "$CHOICE" in - 1) distro="ArchLinux" ;; - 2) distro="Debian" ;; - 3) distro="Fedora" ;; - 4) distro="Gentoo" ;; - 5) distro="Oracle" ;; - 6) distro="Red Hat" ;; - 7) distro="openSUSE" ;; - 8) distro="Ubuntu" ;; - 9) distro="Windows11" ;; - 10) read distro ;; - - *) printf "%b\n" "Invalid choice." && exit 1 ;; - esac - - if [[ "$distro" = "openSUSE" ]]; then - printf "%b\n" "Select openSUSE Version:" - printf "%b\n" "1. Leap" - printf "%b\n" "2. Tumbleweed" - printf "%b" "Enter your choice [1-2]: " - read -r CHOICE2 - case "$CHOICE2" in - 1) distro="openSUSE_Leap" ;; - 2) distro="openSUSE_Tumbleweed" ;; - *) printf "%b\n" "Invalid choice." && exit 1 ;; - esac - fi - - if [[ "$(dpkg --print-architecture)" == "amd64" ]]; then - arch="x86" - subdistro="$distro""_64" - elif [[ "$(dpkg --print-architecture)" == "arm64" ]]; then - arch="arm" - subdistro="$distro""_arm64" - fi - - if $isoFile ~= *".iso"; then - storageType=dvddrive - else - storageType=hdd - fi + } checkInstalled() { @@ -165,8 +110,6 @@ runCreateVM() { createLibvirtVM elif "$hypervisor" == "virtualbox"; then createVBoxVM - elif "$hypervisor" == "gnome-boxes"; then - createGnomeBoxVM else printf "%b\n" "hypervisor not supported" fi @@ -179,7 +122,6 @@ main() { printf "%b\n" "2. ${YELLOW}QEMU${RC}" printf "%b\n" "3. ${YELLOW}Libvirt${RC}" printf "%b\n" "4. ${YELLOW}VirtualBox${RC}" - printf "%b\n" "5. ${YELLOW}Gnome Boxes${RC}" printf "%b" "Enter your choice [1-5]: " read -r CHOICE case "$CHOICE" in @@ -187,7 +129,6 @@ main() { 2) checkInstalled qemu-img ;; 3) checkInstalled libvirt ;; 4) checkInstalled virtualbox ;; - 5) checkInstalled gnome-boxes ;; *) printf "%b\n" "${RED}Invalid choice.${RC}" && exit 1 ;; esac } diff --git a/core/tabs/applications-setup/virtualization/gnome-boxes.sh b/core/tabs/applications-setup/virtualization/gnome-boxes.sh index cda2ed7ed..9dc302388 100644 --- a/core/tabs/applications-setup/virtualization/gnome-boxes.sh +++ b/core/tabs/applications-setup/virtualization/gnome-boxes.sh @@ -5,15 +5,9 @@ installBoxes() { printf "%b\n" "${YELLOW}Installing Gnome Boxes...${RC}" case "$PACKAGER" in - apt-get|nala) + apt-get|nala|dnf|zypper) "$ESCALATION_TOOL" "$PACKAGER" -y install gnome-boxes ;; - dnf) - "$ESCALATION_TOOL" "$PACKAGER" -y install gnome-boxes - ;; - zypper) - "$ESCALATION_TOOL" "$PACKAGER" -y install gnome-boxes - ;; pacman) "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm gnome-boxes ;; diff --git a/core/tabs/applications-setup/virtualization/qemu-install.sh b/core/tabs/applications-setup/virtualization/qemu-install.sh index 368fa24e3..fa62487dc 100644 --- a/core/tabs/applications-setup/virtualization/qemu-install.sh +++ b/core/tabs/applications-setup/virtualization/qemu-install.sh @@ -7,7 +7,7 @@ installQEMUDesktop() { case "$PACKAGER" in apt-get|nala) if ! command_exists qemu-img; then - "$ESCALATION_TOOL" "$PACKAGER" install -y qemu-utils qemu-system-x86 qemu-system-gui + "$ESCALATION_TOOL" "$PACKAGER" install -y qemu-utils qemu-system-$ARCH qemu-system-gui else printf "%b\n" "${GREEN}QEMU already installed.${RC}" fi diff --git a/core/tabs/applications-setup/virtualization/virt-manager.sh b/core/tabs/applications-setup/virtualization/virt-manager.sh index 27252aeb7..56aebb9ac 100644 --- a/core/tabs/applications-setup/virtualization/virt-manager.sh +++ b/core/tabs/applications-setup/virtualization/virt-manager.sh @@ -5,7 +5,7 @@ installVirtManager() { printf "%b\n" "${YELLOW}Installing Virtual Manager...${RC}" case "$PACKAGER" in - apt-get|nala) + apt-get|nala|zypper) if ! command_exists virt-manager; then "$ESCALATION_TOOL" "$PACKAGER" install -y virt-manager else @@ -15,20 +15,13 @@ installVirtManager() { dnf) "$ESCALATION_TOOL" "$PACKAGER" install -y @virtualization - sudo systemctl start libvirtd - #sets the libvirtd service to start on system start + #sets the libvirtd service to start on system start sudo systemctl enable libvirtd + sudo systemctl start libvirtd #add current user to virt manager group sudo usermod -a -G libvirt $(whoami) ;; - zypper) - if ! command_exists virt-manager; then - "$ESCALATION_TOOL" "$PACKAGER" install -y virt-manager - else - printf "%b\n" "${GREEN}Virt-Manager already installed.${RC}" - fi - ;; pacman) if ! command_exists virt-manager; then "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm virt-manager From 62c550fa479ee052ce6bf5df85f863c3779acb04 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Tue, 12 Aug 2025 10:49:33 -0400 Subject: [PATCH 10/42] Added libvirt to toml --- core/tabs/applications-setup/tab_data.toml | 6 ++ .../virtualization/create-virtual-machine.sh | 85 ++++++++++++++++++- 2 files changed, 90 insertions(+), 1 deletion(-) diff --git a/core/tabs/applications-setup/tab_data.toml b/core/tabs/applications-setup/tab_data.toml index 3568d3721..590f0f94c 100644 --- a/core/tabs/applications-setup/tab_data.toml +++ b/core/tabs/applications-setup/tab_data.toml @@ -249,6 +249,12 @@ description = "QEMU is a generic and open source machine emulator and virtualize 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." diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index f70130496..e828a2769 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -52,7 +52,90 @@ createVBoxVM(){ } setVMDetails() { - + mem=$(grep MemTotal /proc/meminfo | tr -s ' ' | cut -d ' ' -f2) + mem=$(expr $(expr $mem / 1024000) + 1) + memory=$(expr $mem / 4) + if [ "$memory" -lt "4" ]; then + memory=4 + fi + + cpus=$(getconf _NPROCESSORS_ONLN) + vcpus=$(expr $cpu / 4) + if [ "$vcpus" -lt "2" ]; then + vcpus=2 + fi + + printf "%b\n" "Please enter VM Name" + read name + + printf "%b\n" "Please enter drive size (virtualbox in MB. virt-manage in GB)" + read driveSize + + printf "%b\n" "Please enter full iso/drive path" + read isoFile + + printf "%b\n" "Select Distro:" + printf "%b\n" "1. ArchLinux" + printf "%b\n" "2. Debian" + printf "%b\n" "3. Fedora" + printf "%b\n" "4. Gentoo" + printf "%b\n" "5. Oracle Linux" + printf "%b\n" "6. Red Hat" + printf "%b\n" "7. openSUSE" + printf "%b\n" "8. Ubuntu" + printf "%b\n" "9. Windows 11" + printf "%b\n" "10. Enter Distro Name" + printf "%b" "Enter your choice [1-10]: " + read -r CHOICE + case "$CHOICE" in + 1) distro="ArchLinux" ;; + 2) distro="Debian" ;; + 3) distro="Fedora" ;; + 4) distro="Gentoo" ;; + 5) distro="Oracle" ;; + 6) distro="Red Hat" ;; + 7) distro="openSUSE" ;; + 8) distro="Ubuntu" ;; + 9) distro="Windows11" ;; + 10) read distro ;; + + *) printf "%b\n" "Invalid choice." && exit 1 ;; + esac + + if [[ "$distro" == "openSUSE" ]]; then + printf "%b\n" "Select openSUSE Version:" + printf "%b\n" "1. Leap" + printf "%b\n" "2. Tumbleweed" + printf "%b" "Enter your choice [1-2]: " + read -r CHOICE2 + case "$CHOICE2" in + 1) distro="openSUSE_Leap" ;; + 2) distro="openSUSE_Tumbleweed" ;; + *) printf "%b\n" "Invalid choice." && exit 1 ;; + esac + fi + + if [[ "$distro" == "Windows11" ]]; then + os="Windows" + else + os="Linux" + fi + + 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 + + if [[ $isoFile ~= *".iso" ]]; then + storageType=dvddrive + else + storageType=hdd + fi } checkInstalled() { From 8f6d7520bd77de0f21f262bb24ef620f6322eae7 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Wed, 13 Aug 2025 20:56:09 -0400 Subject: [PATCH 11/42] finished most of the create VMs --- .../virtualization/create-virtual-machine.sh | 203 +++++++++--------- .../virtualization/libvert.sh | 2 +- .../virtualization/qemu-install.sh | 6 +- .../virtualization/virt-manager.sh | 4 +- .../virtualization/virtualbox.sh | 2 +- 5 files changed, 105 insertions(+), 112 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index e828a2769..48d532441 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -4,7 +4,28 @@ createVirtManagerVM() { setVMDetails - virt-install --name "$name" --memory=$memory --vcpus=$vcpus --location $isoFile --os-type $os --osVariant $distro --disk size=$driveSize --network network=default + + if [[ "$distroInfo" ~= *"ARCH"* ]]; then + distro="archlinux" + elif [[ "$distroInfo" ~= *"Debian"* ]]; then + distro="debian""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1 -d".")" + elif [[ "$distroInfo" ~= *"Fedora"* ]]; then + distro="fedora""$(echo "${distroInfo##*-}")" + elif [[ "$distroInfo" ~= *"openSUSE"* ]]; then + if [[ "$distroInfo" ~= *"Leap"* ]]; then + distro="opensuse""$(echo "${distroInfo##*-}")" + else + distro="opensusetumbleweed" + fi + elif [[ "$distroInfo" ~= *"Ubuntu"* ]]; then + distro="Ubuntu""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1,2 -d".")" + elif [[ "$windows" ~= *"MICROSOFT"* ]]; then + distro="Windows" + else + distro="Other Linux" + fi + + virt-install --name "$name" --memory=$memory --vcpus=$vcpus --location $isoFile --osvariant $distro --disk size=$driveSize } createQEMUVM() { @@ -20,23 +41,55 @@ createQEMUVM() { -netdev user,id=net0,hostfwd=tcp::2222-:22 \ -device e1000,netdev=net0 \ -display default,show-cursor=on - qemu-system-x86_64 \ + + printf "%b\n" "Run the below to launch new VM" + 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 + -display default,show-cursor=on" } createLibvirtVM() { - setVMDetails + #setVMDetails + printf "%b\n" "${YELLOW}Libvirt is still under construction${RC}" } createVBoxVM(){ setVMDetails - memory=$(expr $memory \* 1024) + if [[ "$distroInfo" ~= *"ARCH"* ]]; then + distro="ArchLinux" + elif [[ "$distroInfo" ~= *"Debian"* ]]; then + distro="Debian" + elif [[ "$distroInfo" ~= *"Fedora"* ]]; then + distro="Fedora" + elif [[ "$distroInfo" ~= *"openSUSE"* ]]; then + if [[ "$distroInfo" ~= *"Leap"* ]]; then + distro="openSUSE_Leap" + else + distro="openSUSE_Tumbleweed" + fi + elif [[ "$distroInfo" ~= *"Ubuntu"* ]]; then + distro="Ubuntu" + elif [[ "$windows" ~= *"MICROSOFT"* ]]; then + distro="Windows" + else + distro="Other Linux" + fi + + 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 @@ -44,20 +97,22 @@ createVBoxVM(){ vboxmanage createmedium disk --filename="/media/namato/Data/Virtual Machines/$name/$name.vdi" --size=$driveSize --variant=Standard --format=VDI - vboxmanage storagectl "$name" --name "IDE Controller" --add ide --controller piix4 - vboxmanage storagectl "$name" --name "SATA Controller" --add sata --controller IntelAHCI + vboxmanage storagectl "$name" --name "IDE" --add ide --controller piix4 + vboxmanage storagectl "$name" --name "SATA" --add sata --controller IntelAHCI - vboxmanage storageattach "$name" --storagectl "IDE Controller" --port 0 --device 0 --type $storageType --medium "$isoFile" - vboxmanage storageattach "$name" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$name.vdi" + vboxmanage storageattach "$name" --storagectl "SATA" --port 0 --device 0 --type hdd --medium "$name.vdi" + vboxmanage storageattach "$name" --storagectl "IDE" --port 0 --device 0 --type $storageType --medium "$isoFile" } setVMDetails() { + # Set memory to 1/4 of host memnory mem=$(grep MemTotal /proc/meminfo | tr -s ' ' | cut -d ' ' -f2) mem=$(expr $(expr $mem / 1024000) + 1) memory=$(expr $mem / 4) if [ "$memory" -lt "4" ]; then memory=4 fi + memory=$(expr $memory \* 1024) cpus=$(getconf _NPROCESSORS_ONLN) vcpus=$(expr $cpu / 4) @@ -71,119 +126,53 @@ setVMDetails() { printf "%b\n" "Please enter drive size (virtualbox in MB. virt-manage in GB)" read driveSize - printf "%b\n" "Please enter full iso/drive path" + printf "%b\n" "Please enter full iso path" read isoFile - printf "%b\n" "Select Distro:" - printf "%b\n" "1. ArchLinux" - printf "%b\n" "2. Debian" - printf "%b\n" "3. Fedora" - printf "%b\n" "4. Gentoo" - printf "%b\n" "5. Oracle Linux" - printf "%b\n" "6. Red Hat" - printf "%b\n" "7. openSUSE" - printf "%b\n" "8. Ubuntu" - printf "%b\n" "9. Windows 11" - printf "%b\n" "10. Enter Distro Name" - printf "%b" "Enter your choice [1-10]: " - read -r CHOICE - case "$CHOICE" in - 1) distro="ArchLinux" ;; - 2) distro="Debian" ;; - 3) distro="Fedora" ;; - 4) distro="Gentoo" ;; - 5) distro="Oracle" ;; - 6) distro="Red Hat" ;; - 7) distro="openSUSE" ;; - 8) distro="Ubuntu" ;; - 9) distro="Windows11" ;; - 10) read distro ;; - - *) printf "%b\n" "Invalid choice." && exit 1 ;; - esac - - if [[ "$distro" == "openSUSE" ]]; then - printf "%b\n" "Select openSUSE Version:" - printf "%b\n" "1. Leap" - printf "%b\n" "2. Tumbleweed" - printf "%b" "Enter your choice [1-2]: " - read -r CHOICE2 - case "$CHOICE2" in - 1) distro="openSUSE_Leap" ;; - 2) distro="openSUSE_Tumbleweed" ;; - *) printf "%b\n" "Invalid choice." && exit 1 ;; - esac - fi + if [[ $isoFile ~= *".iso" ]]; then + storageType=dvddrive - if [[ "$distro" == "Windows11" ]]; then - os="Windows" - else - os="Linux" - fi + if ! command_exists isoinfo; then + installIsoInfo + fi - if [[ "$(dpkg --print-architecture)" == "amd64" ]]; then - arch="x86" - subdistro="$distro""_64" - elif [[ "$(dpkg --print-architecture)" == "arm64" ]]; then - arch="arm" - subdistro="$distro""_arm64" + distroInfo=$(isoinfo -d -i $isoFile | awk 'NR==3{print $3}') + windows=$(isoinfo -d -i $isoFile | awk 'NR==5{print $3, $4}') else - printf "%b" "Architecture not supported" + storageType=hdd fi - if [[ $isoFile ~= *".iso" ]]; then - storageType=dvddrive + # Variable Not Used as of 2025/08/13 + if [[ "$distro" == "Windows11" ]]; then + os="Windows" else - storageType=hdd + os="Linux" fi } -checkInstalled() { - hypervisor=$1 - - printf "%b\n" "${YELLOW}Check if $ ${RC}" +installIsoInfo(){ + printf "%b\n" "${YELLOW}Installing Gnome Boxes...${RC}" case "$PACKAGER" in - apt-get|nala) - if ! command_exists $hypervisor; then - runCreateVM $hypervisor - else - printf "%b\n" "${GREEN}$hypervisor is not installed.${RC}" - exit 1 - fi - ;; - dnf) - if ! command_exists $hypervisor; then - runCreateVM $hypervisor - else - printf "%b\n" "${GREEN}$hypervisor is not installed.${RC}" - exit 1 - fi - ;; - zypper) - if ! command_exists virt-manager; then - runCreateVM $hypervisor - else - printf "%b\n" "${GREEN}$hypervisor is not installed.${RC}" - exit 1 - fi - ;; - pacman) - if ! command_exists virt-manager; then - runCreateVM $hypervisor - else - printf "%b\n" "${GREEN}$hypervisor is not installed.${RC}" - exit 1 - fi + apt-get|nala|dnf|zypper) + "$ESCALATION_TOOL" "$PACKAGER" -y install genisoimage ;; *) printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" - exit 1 ;; esac } +checkInstalled() { + + if ! command_exists $hypervisor; then + runCreateVM + else + printf "%b\n" "${GREEN}$hypervisor is not installed.${RC}" + exit 1 + fi +} + runCreateVM() { - hypervisor=$1 if "$hypervisor" == "virt-manager"; then createVirtManagerVM @@ -196,22 +185,22 @@ runCreateVM() { else printf "%b\n" "hypervisor not supported" 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" "3. ${YELLOW}Libvirt${RC}" - printf "%b\n" "4. ${YELLOW}VirtualBox${RC}" - printf "%b" "Enter your choice [1-5]: " + printf "%b" "Enter your choice [1-3]: " read -r CHOICE case "$CHOICE" in 1) checkInstalled virt-manager ;; 2) checkInstalled qemu-img ;; - 3) checkInstalled libvirt ;; - 4) checkInstalled virtualbox ;; + 3) checkInstalled virtualbox ;; + 4) checkInstalled libvirt ;; *) printf "%b\n" "${RED}Invalid choice.${RC}" && exit 1 ;; esac } diff --git a/core/tabs/applications-setup/virtualization/libvert.sh b/core/tabs/applications-setup/virtualization/libvert.sh index 27c3fe3e7..2140aa16e 100644 --- a/core/tabs/applications-setup/virtualization/libvert.sh +++ b/core/tabs/applications-setup/virtualization/libvert.sh @@ -6,7 +6,7 @@ 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 "$USER" -aG kvm + "$ESCALATION_TOOL" usermod $(who | awk 'NR==1{print $1}') -aG kvm fi } diff --git a/core/tabs/applications-setup/virtualization/qemu-install.sh b/core/tabs/applications-setup/virtualization/qemu-install.sh index fa62487dc..317352ec0 100644 --- a/core/tabs/applications-setup/virtualization/qemu-install.sh +++ b/core/tabs/applications-setup/virtualization/qemu-install.sh @@ -42,7 +42,9 @@ installQEMUDesktop() { printf "%b\n" "${RED}Unsupported package manager: ""$PACKAGER""${RC}" "$ESCALATION_TOOL" flatpak install --noninteractive org.virt_manager.virt_manager.Extension.Qemu ;; - + esac + + "$ESCALATION_TOOL" systemctl status qemu-kvm.service } installQEMUEmulators() { @@ -67,7 +69,7 @@ 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 "$USER" -aG kvm + "$ESCALATION_TOOL" usermod $(who | awk 'NR==1{print $1}') -aG kvm fi } diff --git a/core/tabs/applications-setup/virtualization/virt-manager.sh b/core/tabs/applications-setup/virtualization/virt-manager.sh index 56aebb9ac..c522641e2 100644 --- a/core/tabs/applications-setup/virtualization/virt-manager.sh +++ b/core/tabs/applications-setup/virtualization/virt-manager.sh @@ -20,7 +20,7 @@ installVirtManager() { sudo systemctl start libvirtd #add current user to virt manager group - sudo usermod -a -G libvirt $(whoami) + sudo usermod -a -G libvirt $(who | awk 'NR==1{print $1}') ;; pacman) if ! command_exists virt-manager; then @@ -35,6 +35,8 @@ installVirtManager() { exit 1 ;; esac + + "$ESCALATION_TOOL" systemctl status qemu-kvm.service } checkEnv diff --git a/core/tabs/applications-setup/virtualization/virtualbox.sh b/core/tabs/applications-setup/virtualization/virtualbox.sh index 2fe5f3fe2..6d0c2adb1 100644 --- a/core/tabs/applications-setup/virtualization/virtualbox.sh +++ b/core/tabs/applications-setup/virtualization/virtualbox.sh @@ -48,7 +48,7 @@ installVirtualBox() { virtualBoxPermissions() { printf "%b\n" "${YELLOW}Adding current user to the vboxusers group...${RC}" - "$ESCALATION_TOOL" usermod -aG vboxusers "$USER" + "$ESCALATION_TOOL" usermod -aG vboxusers $(who | awk 'NR==1{print $1}') } checkEnv From acd5e93a80afc94fc58f27d1a72b5ba4156878d4 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Sat, 16 Aug 2025 21:24:29 -0400 Subject: [PATCH 12/42] added port for ssh with NAT setup --- .../virtualization/create-virtual-machine.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index 48d532441..af8ada985 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -94,6 +94,7 @@ createVBoxVM(){ 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 + vboxmanage modifyvm "$name" --nat-pf1 "SSH,tcp,127.0.0.1,2522,10.0.2.15,22" vboxmanage createmedium disk --filename="/media/namato/Data/Virtual Machines/$name/$name.vdi" --size=$driveSize --variant=Standard --format=VDI @@ -142,12 +143,11 @@ setVMDetails() { storageType=hdd fi - # Variable Not Used as of 2025/08/13 - if [[ "$distro" == "Windows11" ]]; then - os="Windows" - else - os="Linux" - fi + # if [[ "$distro" == "Windows11" ]]; then + # os="Windows" + # else + # os="Linux" + # fi } installIsoInfo(){ From 6a5269ff2a9f6d1e3f5f255c35bfedccf0428c54 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Mon, 18 Aug 2025 12:09:19 -0400 Subject: [PATCH 13/42] Finished VirtualBox, No GPU passthough available according to Oracle Documentation --- .../virtualization/create-virtual-machine.sh | 128 +++++++++++------- 1 file changed, 81 insertions(+), 47 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index af8ada985..fbba8301b 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -2,7 +2,7 @@ . ../../common-script.sh -createVirtManagerVM() { +virt-manager() { setVMDetails if [[ "$distroInfo" ~= *"ARCH"* ]]; then @@ -25,12 +25,16 @@ createVirtManagerVM() { distro="Other Linux" fi + # Need to add PCI Graphics Passthrough + virt-install --name "$name" --memory=$memory --vcpus=$vcpus --location $isoFile --osvariant $distro --disk size=$driveSize } -createQEMUVM() { +qemu() { setVMDetails + # Need to add PCI Graphics Passthrough + qemu-img create -f qcow2 $name.qcow2 $driveSize qemu-system-x86_64 \ -m "$memory"G \ @@ -52,29 +56,29 @@ createQEMUVM() { -display default,show-cursor=on" } -createLibvirtVM() { +libvirt() { #setVMDetails printf "%b\n" "${YELLOW}Libvirt is still under construction${RC}" } -createVBoxVM(){ +virtualbox(){ setVMDetails - if [[ "$distroInfo" ~= *"ARCH"* ]]; then + if [[ "${distroInfo,,}" == *"ARCH"* ]] || [[ "$distroInfo" == *"ARCH"* ]] ; then distro="ArchLinux" - elif [[ "$distroInfo" ~= *"Debian"* ]]; then + elif [[ "${distroInfo,,}" == *"Debian"* ]] || [[ "$distroInfo" == *"Debian"* ]] ; then distro="Debian" - elif [[ "$distroInfo" ~= *"Fedora"* ]]; then + elif [[ "${distroInfo,,}" == *"Fedora"* ]] || [[ "$distroInfo" == *"Fedora"* ]]; then distro="Fedora" - elif [[ "$distroInfo" ~= *"openSUSE"* ]]; then - if [[ "$distroInfo" ~= *"Leap"* ]]; then + elif [[ "${distroInfo,,}" == *"openSUSE"* ]] || [[ "$distroInfo" == *"openSUSE"* ]]; then + if [[ "${distroInfo,,}" == *"Leap"* ]] || [[ "$distroInfo" == *"Leap"* ]]; then distro="openSUSE_Leap" else distro="openSUSE_Tumbleweed" fi - elif [[ "$distroInfo" ~= *"Ubuntu"* ]]; then + elif [[ "${distroInfo,,}" == *"Ubuntu"* ]] || [[ "$distroInfo" == *"Ubuntu"* ]]; then distro="Ubuntu" - elif [[ "$windows" ~= *"MICROSOFT"* ]]; then + elif [[ "$windows" == *"MICROSOFT"* ]] || [[ "$distroInfo" == *"MICROSOFT"* ]]; then distro="Windows" else distro="Other Linux" @@ -94,35 +98,85 @@ createVBoxVM(){ 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="/media/namato/Data/Virtual Machines/$name/$name.vdi" --size=$driveSize --variant=Standard --format=VDI + 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 "$name.vdi" + 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. + + # printf "%b\n" "${RED}Only use this option if a second graphics adapter for your host machine${RC}" + # printf "%b\n" "${YELLOW}Do you want to pass through a GPU?${RC}" + # yes_or_no + + # passthtough=$? + + # if $passthtough == 1; then + + # printf "%b\n" "Please enter the Graphics Card model (ex. 5080, 4060, 9070, etc)" + # read 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=$(echo graphicsAdapters | cut -f1 -d" ") + # vboxmanage modifyvm "$name" --pci-attach=$graphicsAdapter@01:05.0 + # fi + + printf "b%\n" "Do you want to start the $name" + yes_or_no + + startvm=$? + + if $startvm == 1; then + vboxmanage startvm $name + fi } setVMDetails() { # Set memory to 1/4 of host memnory - mem=$(grep MemTotal /proc/meminfo | tr -s ' ' | cut -d ' ' -f2) - mem=$(expr $(expr $mem / 1024000) + 1) + totalMemory=$(grep MemTotal /proc/meminfo | tr -s ' ' | cut -d ' ' -f2) + mem=$(expr $(expr $totalMemory / 1024000) + 1) memory=$(expr $mem / 4) - if [ "$memory" -lt "4" ]; then - memory=4 + if [ "$memory" -lt "2" ]; then + memory=2 fi - memory=$(expr $memory \* 1024) + memory=$(expr $memory \* 1024)ory - cpus=$(getconf _NPROCESSORS_ONLN) - vcpus=$(expr $cpu / 4) + totalCpus=$(getconf _NPROCESSORS_ONLN) + vcpus=$(expr $totalCpus / 4) if [ "$vcpus" -lt "2" ]; then vcpus=2 fi - printf "%b\n" "Please enter VM Name" - read name + while true + do + printf "%b\n" "Please enter VM Name" + read name + + vmExists=$(vboxmanage list vms | grep -i \"$name\") + if [[ -z $vmExists ]]; then + break + else + printf "%b\n" "VM with that name already exists" + fi + done printf "%b\n" "Please enter drive size (virtualbox in MB. virt-manage in GB)" read driveSize @@ -142,12 +196,6 @@ setVMDetails() { else storageType=hdd fi - - # if [[ "$distro" == "Windows11" ]]; then - # os="Windows" - # else - # os="Linux" - # fi } installIsoInfo(){ @@ -163,44 +211,30 @@ installIsoInfo(){ } checkInstalled() { + $hypervisor=$1 - if ! command_exists $hypervisor; then - runCreateVM + if command_exists $hypervisor; then + $hypervisor else printf "%b\n" "${GREEN}$hypervisor is not installed.${RC}" exit 1 fi } -runCreateVM() { - - if "$hypervisor" == "virt-manager"; then - createVirtManagerVM - elif "$hypervisor" == "qemu-img"; then - createQEMUVM - elif "$hypervisor" == "libvirt"; then - createLibvirtVM - elif "$hypervisor" == "virtualbox"; then - createVBoxVM - else - printf "%b\n" "hypervisor not supported" - 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" "3. ${YELLOW}Libvirt${RC}" + # printf "%b\n" "4. ${YELLOW}Libvirt${RC}" printf "%b" "Enter your choice [1-3]: " read -r CHOICE case "$CHOICE" in 1) checkInstalled virt-manager ;; 2) checkInstalled qemu-img ;; 3) checkInstalled virtualbox ;; - 4) checkInstalled libvirt ;; + # 4) checkInstalled libvirt ;; *) printf "%b\n" "${RED}Invalid choice.${RC}" && exit 1 ;; esac } From f58cf11dc85b82c209a511da367fb81d1bd3680f Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Mon, 18 Aug 2025 16:56:19 -0400 Subject: [PATCH 14/42] renamed libvirt.sh correctly --- .../applications-setup/virtualization/{libvert.sh => libvirt.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename core/tabs/applications-setup/virtualization/{libvert.sh => libvirt.sh} (100%) diff --git a/core/tabs/applications-setup/virtualization/libvert.sh b/core/tabs/applications-setup/virtualization/libvirt.sh similarity index 100% rename from core/tabs/applications-setup/virtualization/libvert.sh rename to core/tabs/applications-setup/virtualization/libvirt.sh From 0c79382e5445d5903a3e0c7375c8fcb0c32283a3 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Tue, 19 Aug 2025 19:45:09 -0400 Subject: [PATCH 15/42] updated QEMU and Virt-Manager --- .../virtualization/create-virtual-machine.sh | 71 +++++++++++-------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index fbba8301b..fc0ba06ab 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -25,9 +25,14 @@ virt-manager() { distro="Other Linux" fi - # Need to add PCI Graphics Passthrough + printf "%b\n" "Please enter full folder path of for VM" + read path + + # setup physical PCI/USB etc + hostDev="" - virt-install --name "$name" --memory=$memory --vcpus=$vcpus --location $isoFile --osvariant $distro --disk size=$driveSize + 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() { @@ -35,7 +40,7 @@ qemu() { # Need to add PCI Graphics Passthrough - qemu-img create -f qcow2 $name.qcow2 $driveSize + qemu-img create -f qcow2 $name.qcow2 $driveSize"G" qemu-system-x86_64 \ -m "$memory"G \ -smp $vcpus \ @@ -44,16 +49,17 @@ qemu() { -drive file=$name.qcow2,format=qcow2 \ -netdev user,id=net0,hostfwd=tcp::2222-:22 \ -device e1000,netdev=net0 \ - -display default,show-cursor=on + -display default,show-cursor=on \ + -cpu host \ + -enable-kvm \ + -name $name - printf "%b\n" "Run the below to launch new VM" - 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" + 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 "virt-install --name "$name" --memory=$memory --vcpus=$vcpus --os-variant $distro --disk $path/$name.qcow2 --network default --import" } libvirt() { @@ -110,13 +116,9 @@ virtualbox(){ 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. + # Graphics Passthrough not available on VirtualBox 7.0 and newer yet. - # printf "%b\n" "${RED}Only use this option if a second graphics adapter for your host machine${RC}" # printf "%b\n" "${YELLOW}Do you want to pass through a GPU?${RC}" - # yes_or_no - - # passthtough=$? # if $passthtough == 1; then @@ -139,14 +141,7 @@ virtualbox(){ # vboxmanage modifyvm "$name" --pci-attach=$graphicsAdapter@01:05.0 # fi - printf "b%\n" "Do you want to start the $name" - yes_or_no - - startvm=$? - - if $startvm == 1; then - vboxmanage startvm $name - fi + vboxmanage startvm $name } setVMDetails() { @@ -169,16 +164,15 @@ setVMDetails() { do printf "%b\n" "Please enter VM Name" read name - - vmExists=$(vboxmanage list vms | grep -i \"$name\") - if [[ -z $vmExists ]]; then + + if ! checkVMExists; then break else printf "%b\n" "VM with that name already exists" fi done - printf "%b\n" "Please enter drive size (virtualbox in MB. virt-manage in GB)" + printf "%b\n" "Please enter drive size" read driveSize printf "%b\n" "Please enter full iso path" @@ -191,8 +185,8 @@ setVMDetails() { installIsoInfo fi - distroInfo=$(isoinfo -d -i $isoFile | awk 'NR==3{print $3}') - windows=$(isoinfo -d -i $isoFile | awk 'NR==5{print $3, $4}') + distroInfo=$(isoinfo -d -i $isoFile | grep -i "volume id:" | awk '{print $3}') + windows=$(isoinfo -d -i $isoFile | grep -i "Publisher id:" | awk '{print $3, $4}') else storageType=hdd fi @@ -210,6 +204,21 @@ installIsoInfo(){ 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\") + fi + + if [[ -z vmExists ]]; then + return 1 + else + return 0 + fi +} + checkInstalled() { $hypervisor=$1 From 00b6ea9afd45322e4c895feb9a9338a8cb030cfe Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Thu, 21 Aug 2025 14:06:20 -0400 Subject: [PATCH 16/42] Fixed issue with VirtualBox and QEMU --- .../virtualization/create-virtual-machine.sh | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index fc0ba06ab..ca27e02dc 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -5,21 +5,21 @@ virt-manager() { setVMDetails - if [[ "$distroInfo" ~= *"ARCH"* ]]; then + if [[ "${distroInfo,,}" == *"ARCH"* ]] || [[ "$distroInfo" == *"ARCH"* ]]; then distro="archlinux" - elif [[ "$distroInfo" ~= *"Debian"* ]]; then + elif [[ "${distroInfo,,}" == *"Debian"* ]] || [[ "$distroInfo" == *"Debian"* ]]; then distro="debian""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1 -d".")" - elif [[ "$distroInfo" ~= *"Fedora"* ]]; then + elif [[ "${distroInfo,,}" == *"Fedora"* ]] || [[ "$distroInfo" == *"Fedora"* ]]; then distro="fedora""$(echo "${distroInfo##*-}")" - elif [[ "$distroInfo" ~= *"openSUSE"* ]]; then - if [[ "$distroInfo" ~= *"Leap"* ]]; then + elif [[ "${distroInfo,,}" == *"openSUSE"* ]] || [[ "$distroInfo" == *"openSUSE"* ]]; then + if [[ "${distroInfo,,}" == *"Leap"* ]] || [[ "$distroInfo" == *"Leap"* ]]; then distro="opensuse""$(echo "${distroInfo##*-}")" else distro="opensusetumbleweed" fi - elif [[ "$distroInfo" ~= *"Ubuntu"* ]]; then + elif [[ "${distroInfo,,}" == *"Ubuntu"* ]] || [[ "$distroInfo" == *"Ubuntu"* ]]; then distro="Ubuntu""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1,2 -d".")" - elif [[ "$windows" ~= *"MICROSOFT"* ]]; then + elif [[ "${windows,,}" == *"MICROSOFT"* ]] || [[ "$windows" == *"MICROSOFT"* ]]; then distro="Windows" else distro="Other Linux" @@ -70,9 +70,9 @@ libvirt() { virtualbox(){ setVMDetails - if [[ "${distroInfo,,}" == *"ARCH"* ]] || [[ "$distroInfo" == *"ARCH"* ]] ; then + if [[ "${distroInfo,,}" == *"ARCH"* ]] || [[ "$distroInfo" == *"ARCH"* ]]; then distro="ArchLinux" - elif [[ "${distroInfo,,}" == *"Debian"* ]] || [[ "$distroInfo" == *"Debian"* ]] ; then + elif [[ "${distroInfo,,}" == *"Debian"* ]] || [[ "$distroInfo" == *"Debian"* ]]; then distro="Debian" elif [[ "${distroInfo,,}" == *"Fedora"* ]] || [[ "$distroInfo" == *"Fedora"* ]]; then distro="Fedora" @@ -84,7 +84,7 @@ virtualbox(){ fi elif [[ "${distroInfo,,}" == *"Ubuntu"* ]] || [[ "$distroInfo" == *"Ubuntu"* ]]; then distro="Ubuntu" - elif [[ "$windows" == *"MICROSOFT"* ]] || [[ "$distroInfo" == *"MICROSOFT"* ]]; then + elif [[ "${windows,,}" == *"MICROSOFT"* ]] || [[ "$windows" == *"MICROSOFT"* ]]; then distro="Windows" else distro="Other Linux" @@ -152,7 +152,7 @@ setVMDetails() { if [ "$memory" -lt "2" ]; then memory=2 fi - memory=$(expr $memory \* 1024)ory + memory=$(expr $memory \* 1024) totalCpus=$(getconf _NPROCESSORS_ONLN) vcpus=$(expr $totalCpus / 4) @@ -178,7 +178,7 @@ setVMDetails() { printf "%b\n" "Please enter full iso path" read isoFile - if [[ $isoFile ~= *".iso" ]]; then + if [[ ${isoFile,,} == *".iso" ]] || [[ $isoFile == *".iso" ]]; then storageType=dvddrive if ! command_exists isoinfo; then @@ -192,7 +192,7 @@ setVMDetails() { fi } -installIsoInfo(){ +installIsoInfo() { printf "%b\n" "${YELLOW}Installing Gnome Boxes...${RC}" case "$PACKAGER" in apt-get|nala|dnf|zypper) @@ -206,13 +206,13 @@ installIsoInfo(){ checkVMExists() { - if "$hypervisor" == "virt-manager"; then + 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\") + elif [[ "$hypervisor" == "virtualbox" ]]; then + vmExists=$(vboxmanage list vms | grep -i \"$name\" | cut -f1 -d" ") fi - if [[ -z vmExists ]]; then + if [ -z $vmExists ]; then return 1 else return 0 @@ -220,7 +220,7 @@ checkVMExists() { } checkInstalled() { - $hypervisor=$1 + hypervisor=$1 if command_exists $hypervisor; then $hypervisor From c731158589b5e60296ea1d077d3c5403f736fa7c Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 10:59:53 -0400 Subject: [PATCH 17/42] Fixed bashism test --- .../applications-setup/virtualization/create-virtual-machine.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index ca27e02dc..545dfc616 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -5,7 +5,7 @@ virt-manager() { setVMDetails - if [[ "${distroInfo,,}" == *"ARCH"* ]] || [[ "$distroInfo" == *"ARCH"* ]]; then + if [[ "${distroInfo,[,][pat]}" == *"ARCH"* ]]; then distro="archlinux" elif [[ "${distroInfo,,}" == *"Debian"* ]] || [[ "$distroInfo" == *"Debian"* ]]; then distro="debian""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1 -d".")" From ec4ce36d98ab1e1064633ae9f18f908511b3420e Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 12:08:29 -0400 Subject: [PATCH 18/42] Fix bashism attempt --- .../virtualization/create-virtual-machine.sh | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index 545dfc616..57a38b233 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -5,24 +5,24 @@ virt-manager() { setVMDetails - if [[ "${distroInfo,[,][pat]}" == *"ARCH"* ]]; then + if [[ "${distroInfo,,}" == *"arch"* ]]; then distro="archlinux" - elif [[ "${distroInfo,,}" == *"Debian"* ]] || [[ "$distroInfo" == *"Debian"* ]]; then + elif [[ "${distroInfo,,}" == *"debian"* ]]; then distro="debian""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1 -d".")" - elif [[ "${distroInfo,,}" == *"Fedora"* ]] || [[ "$distroInfo" == *"Fedora"* ]]; then + elif [[ "${distroInfo,,}" == *"fedora"* ]]; then distro="fedora""$(echo "${distroInfo##*-}")" - elif [[ "${distroInfo,,}" == *"openSUSE"* ]] || [[ "$distroInfo" == *"openSUSE"* ]]; then - if [[ "${distroInfo,,}" == *"Leap"* ]] || [[ "$distroInfo" == *"Leap"* ]]; then + elif [[ "${distroInfo,,}" == *"opensuse"* ]]; then + if [[ "${distroInfo,,}" == *"leap"* ]]; then distro="opensuse""$(echo "${distroInfo##*-}")" else distro="opensusetumbleweed" fi - elif [[ "${distroInfo,,}" == *"Ubuntu"* ]] || [[ "$distroInfo" == *"Ubuntu"* ]]; then + elif [[ "${distroInfo,,}" == *"ubuntu"* ]]; then distro="Ubuntu""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1,2 -d".")" - elif [[ "${windows,,}" == *"MICROSOFT"* ]] || [[ "$windows" == *"MICROSOFT"* ]]; then - distro="Windows" + elif [[ "${windows,,}" == *"microsoft"* ]]; then + distro="win11" else - distro="Other Linux" + distro="unknown" fi printf "%b\n" "Please enter full folder path of for VM" @@ -70,21 +70,21 @@ libvirt() { virtualbox(){ setVMDetails - if [[ "${distroInfo,,}" == *"ARCH"* ]] || [[ "$distroInfo" == *"ARCH"* ]]; then + if [[ "${distroInfo,,}" == *"arch"* ]]; then distro="ArchLinux" - elif [[ "${distroInfo,,}" == *"Debian"* ]] || [[ "$distroInfo" == *"Debian"* ]]; then + elif [[ "${distroInfo,,}" == *"debian"* ]]; then distro="Debian" - elif [[ "${distroInfo,,}" == *"Fedora"* ]] || [[ "$distroInfo" == *"Fedora"* ]]; then + elif [[ "${distroInfo,,}" == *"fedora"* ]]; then distro="Fedora" - elif [[ "${distroInfo,,}" == *"openSUSE"* ]] || [[ "$distroInfo" == *"openSUSE"* ]]; then - if [[ "${distroInfo,,}" == *"Leap"* ]] || [[ "$distroInfo" == *"Leap"* ]]; then + elif [[ "${distroInfo,,}" == *"opensuse"* ]]; then + if [[ "${distroInfo,,}" == *"leap"* ]]; then distro="openSUSE_Leap" else distro="openSUSE_Tumbleweed" fi - elif [[ "${distroInfo,,}" == *"Ubuntu"* ]] || [[ "$distroInfo" == *"Ubuntu"* ]]; then + elif [[ "${distroInfo,,}" == *"ubuntu"* ]]; then distro="Ubuntu" - elif [[ "${windows,,}" == *"MICROSOFT"* ]] || [[ "$windows" == *"MICROSOFT"* ]]; then + elif [[ "${windows,,}" == *"microsoft"* ]]; then distro="Windows" else distro="Other Linux" From db2ecf10914650be68558d70f873f2a0b5c49052 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 12:14:24 -0400 Subject: [PATCH 19/42] Fix bashism attempt --- .../virtualization/create-virtual-machine.sh | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index 57a38b233..8fbfc7a58 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -5,19 +5,19 @@ virt-manager() { setVMDetails - if [[ "${distroInfo,,}" == *"arch"* ]]; then + if [[ "$distroInfo" == *"arch"* ]]; then distro="archlinux" - elif [[ "${distroInfo,,}" == *"debian"* ]]; then + elif [[ "$distroInfo" == *"debian"* ]]; then distro="debian""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1 -d".")" - elif [[ "${distroInfo,,}" == *"fedora"* ]]; then + elif [[ "$distroInfo" == *"fedora"* ]]; then distro="fedora""$(echo "${distroInfo##*-}")" - elif [[ "${distroInfo,,}" == *"opensuse"* ]]; then - if [[ "${distroInfo,,}" == *"leap"* ]]; then + elif [[ "$distroInfo" == *"opensuse"* ]]; then + if [[ "$distroInfo" == *"leap"* ]]; then distro="opensuse""$(echo "${distroInfo##*-}")" else distro="opensusetumbleweed" fi - elif [[ "${distroInfo,,}" == *"ubuntu"* ]]; then + elif [[ "$distroInfo" == *"ubuntu"* ]]; then distro="Ubuntu""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1,2 -d".")" elif [[ "${windows,,}" == *"microsoft"* ]]; then distro="win11" @@ -70,19 +70,19 @@ libvirt() { virtualbox(){ setVMDetails - if [[ "${distroInfo,,}" == *"arch"* ]]; then + if [[ "$distroInfo" == *"arch"* ]]; then distro="ArchLinux" - elif [[ "${distroInfo,,}" == *"debian"* ]]; then + elif [[ "$distroInfo" == *"debian"* ]]; then distro="Debian" - elif [[ "${distroInfo,,}" == *"fedora"* ]]; then + elif [[ "$distroInfo" == *"fedora"* ]]; then distro="Fedora" - elif [[ "${distroInfo,,}" == *"opensuse"* ]]; then - if [[ "${distroInfo,,}" == *"leap"* ]]; then + elif [[ "$distroInfo" == *"opensuse"* ]]; then + if [[ "$distroInfo" == *"leap"* ]]; then distro="openSUSE_Leap" else distro="openSUSE_Tumbleweed" fi - elif [[ "${distroInfo,,}" == *"ubuntu"* ]]; then + elif [[ "$distroInfo" == *"ubuntu"* ]]; then distro="Ubuntu" elif [[ "${windows,,}" == *"microsoft"* ]]; then distro="Windows" @@ -186,6 +186,7 @@ setVMDetails() { fi distroInfo=$(isoinfo -d -i $isoFile | grep -i "volume id:" | awk '{print $3}') + distroInfo="${distroInfo,,}" windows=$(isoinfo -d -i $isoFile | grep -i "Publisher id:" | awk '{print $3, $4}') else storageType=hdd From 101193601d4c7e4295da7d6a153f2bc5107f7328 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 13:06:25 -0400 Subject: [PATCH 20/42] Fixed bashism --- .../virtualization/create-virtual-machine.sh | 129 ++++++++++-------- 1 file changed, 73 insertions(+), 56 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index 8fbfc7a58..30e8af5e4 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -2,28 +2,33 @@ . ../../common-script.sh -virt-manager() { +virtmanager() { setVMDetails - if [[ "$distroInfo" == *"arch"* ]]; then - distro="archlinux" - elif [[ "$distroInfo" == *"debian"* ]]; then - distro="debian""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1 -d".")" - elif [[ "$distroInfo" == *"fedora"* ]]; then - distro="fedora""$(echo "${distroInfo##*-}")" - elif [[ "$distroInfo" == *"opensuse"* ]]; then - if [[ "$distroInfo" == *"leap"* ]]; then - distro="opensuse""$(echo "${distroInfo##*-}")" - else - distro="opensusetumbleweed" - fi - elif [[ "$distroInfo" == *"ubuntu"* ]]; then - distro="Ubuntu""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1,2 -d".")" - elif [[ "${windows,,}" == *"microsoft"* ]]; then - distro="win11" - else - distro="unknown" - fi + case $distroInfo in + *"arch"*) + distro="archlinux" ;; + *"debian"*) + distro="debian""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1 -d".")" ;; + *"fedora"*) + distro="fedora""$(echo "${distroInfo##*-}")" ;; + *"opensuse"*) + case $distroInfo in + *"leap"*) + distro="opensuse""$(echo "${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 path @@ -70,30 +75,35 @@ libvirt() { virtualbox(){ setVMDetails - if [[ "$distroInfo" == *"arch"* ]]; then - distro="ArchLinux" - elif [[ "$distroInfo" == *"debian"* ]]; then - distro="Debian" - elif [[ "$distroInfo" == *"fedora"* ]]; then - distro="Fedora" - elif [[ "$distroInfo" == *"opensuse"* ]]; then - if [[ "$distroInfo" == *"leap"* ]]; then - distro="openSUSE_Leap" - else - distro="openSUSE_Tumbleweed" - fi - elif [[ "$distroInfo" == *"ubuntu"* ]]; then - distro="Ubuntu" - elif [[ "${windows,,}" == *"microsoft"* ]]; then - distro="Windows" - else - distro="Other Linux" - fi - - if [[ "$(dpkg --print-architecture)" == "amd64" ]]; then + 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 + elif [ "$(dpkg --print-architecture)" = "arm64" ]; then arch="arm" subdistro="$distro""_arm64" else @@ -178,19 +188,20 @@ setVMDetails() { printf "%b\n" "Please enter full iso path" read isoFile - if [[ ${isoFile,,} == *".iso" ]] || [[ $isoFile == *".iso" ]]; then - storageType=dvddrive + case $isoFile in + *".iso") + storageType=dvddrive - if ! command_exists isoinfo; then - installIsoInfo - fi + if ! command_exists isoinfo; then + installIsoInfo + fi - distroInfo=$(isoinfo -d -i $isoFile | grep -i "volume id:" | awk '{print $3}') - distroInfo="${distroInfo,,}" - windows=$(isoinfo -d -i $isoFile | grep -i "Publisher id:" | awk '{print $3, $4}') - else - storageType=hdd - fi + distroInfo=$(isoinfo -d -i $isoFile | grep -i "volume id:" | awk '{print $3}') + distroInfo="${distroInfo,,}" + windows=$(isoinfo -d -i $isoFile | grep -i "Publisher id:" | awk '{print $3, $4}') ;; + *) + storageType=hdd ;; + esac } installIsoInfo() { @@ -207,9 +218,9 @@ installIsoInfo() { checkVMExists() { - if [[ "$hypervisor" == "virt-manager" ]]; then + if [ "$hypervisor" = "virt-manager" ]; then vmExists=$(virsh list --all | grep -i $name | awk '{print $2}') - elif [[ "$hypervisor" == "virtualbox" ]]; then + elif [ "$hypervisor" = "virtualbox" ]; then vmExists=$(vboxmanage list vms | grep -i \"$name\" | cut -f1 -d" ") fi @@ -224,7 +235,13 @@ checkInstalled() { hypervisor=$1 if command_exists $hypervisor; then - $hypervisor + 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 From bf95fce5dc462b6503b1002589782ded84db4660 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 13:12:44 -0400 Subject: [PATCH 21/42] Fixed last 2 bashism maybe? --- .../applications-setup/virtualization/create-virtual-machine.sh | 2 +- core/tabs/applications-setup/virtualization/virtualbox.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index 30e8af5e4..87934f581 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -197,7 +197,7 @@ setVMDetails() { fi distroInfo=$(isoinfo -d -i $isoFile | grep -i "volume id:" | awk '{print $3}') - distroInfo="${distroInfo,,}" + distroInfo="$(echo $distroInfo | tr '[:upper:]' '[:lower:]') windows=$(isoinfo -d -i $isoFile | grep -i "Publisher id:" | awk '{print $3, $4}') ;; *) storageType=hdd ;; diff --git a/core/tabs/applications-setup/virtualization/virtualbox.sh b/core/tabs/applications-setup/virtualization/virtualbox.sh index 6d0c2adb1..cdc444ec2 100644 --- a/core/tabs/applications-setup/virtualization/virtualbox.sh +++ b/core/tabs/applications-setup/virtualization/virtualbox.sh @@ -26,7 +26,7 @@ installVirtualBox() { "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-guest-additions.$ARCH ;; zypper) - if [ "$DTYPE" == "opensuse-leap" ]; then + if [ "$DTYPE" = "opensuse-leap" ]; then wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc sudo rpm --import oracle_vbox_2016.asc "$ESCALATION_TOOL" "$PACKAGER" addrepo -f https://download.virtualbox.org/virtualbox/rpm/opensuse/virtualbox.repo From 072b203dd105e6a2809ecb4e38fd29607c16fadf Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 13:37:37 -0400 Subject: [PATCH 22/42] changed virtualbox install variables --- .../virtualization/create-virtual-machine.sh | 2 +- core/tabs/applications-setup/virtualization/virtualbox.sh | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index 87934f581..afbe5bbe1 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -197,7 +197,7 @@ setVMDetails() { fi distroInfo=$(isoinfo -d -i $isoFile | grep -i "volume id:" | awk '{print $3}') - distroInfo="$(echo $distroInfo | tr '[:upper:]' '[:lower:]') + distroInfo="$(echo $distroInfo | tr '[:upper:]' '[:lower:]')" windows=$(isoinfo -d -i $isoFile | grep -i "Publisher id:" | awk '{print $3, $4}') ;; *) storageType=hdd ;; diff --git a/core/tabs/applications-setup/virtualization/virtualbox.sh b/core/tabs/applications-setup/virtualization/virtualbox.sh index cdc444ec2..73a1e114d 100644 --- a/core/tabs/applications-setup/virtualization/virtualbox.sh +++ b/core/tabs/applications-setup/virtualization/virtualbox.sh @@ -11,7 +11,8 @@ installVirtualBox() { "$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-7.1 - wget -P /home/$USER/Downloads/vbox.vbox-extpack https://download.virtualbox.org/virtualbox/$(vboxmanage --version | cut -f1 -d"r")/Oracle_VirtualBox_Extension_Pack-$(vboxmanage --version | cut -f1 -d"r").vbox-extpack + vboxVersion=$(vboxmanage --version | cut -f1 -d"r") + wget -P /home/$USER/Downloads/vbox.vbox-extpack https://download.virtualbox.org/virtualbox/${vboxVersion}/Oracle_VirtualBox_Extension_Pack-${vboxVersion}.vbox-extpack VBoxManage extpack install vbox.vbox-extpack ;; dnf) @@ -22,8 +23,8 @@ installVirtualBox() { else "$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo fi - "$ESCALATION_TOOL" "$PACKAGER" -y install VirtualBox-7.1.$ARCH - "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-guest-additions.$ARCH + "$ESCALATION_TOOL" "$PACKAGER" -y install VirtualBox-7.1.${ARCH} + "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-guest-additions.${ARCH} ;; zypper) if [ "$DTYPE" = "opensuse-leap" ]; then From 2a14bb95078c14ca590396b14b0c0de61c5b508a Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 13:41:04 -0400 Subject: [PATCH 23/42] fixed vbox installer --- core/tabs/applications-setup/virtualization/virtualbox.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/virtualbox.sh b/core/tabs/applications-setup/virtualization/virtualbox.sh index 73a1e114d..4223ee582 100644 --- a/core/tabs/applications-setup/virtualization/virtualbox.sh +++ b/core/tabs/applications-setup/virtualization/virtualbox.sh @@ -12,7 +12,7 @@ installVirtualBox() { "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-7.1 vboxVersion=$(vboxmanage --version | cut -f1 -d"r") - wget -P /home/$USER/Downloads/vbox.vbox-extpack https://download.virtualbox.org/virtualbox/${vboxVersion}/Oracle_VirtualBox_Extension_Pack-${vboxVersion}.vbox-extpack + wget -P /home/"$USER"/Downloads/vbox.vbox-extpack https://download.virtualbox.org/virtualbox/"${vboxVersion}"/Oracle_VirtualBox_Extension_Pack-"${vboxVersion}".vbox-extpack VBoxManage extpack install vbox.vbox-extpack ;; dnf) @@ -23,8 +23,8 @@ installVirtualBox() { else "$ESCALATION_TOOL" "$PACKAGER" config-manager addrepo --from-repofile=https://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo fi - "$ESCALATION_TOOL" "$PACKAGER" -y install VirtualBox-7.1.${ARCH} - "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-guest-additions.${ARCH} + "$ESCALATION_TOOL" "$PACKAGER" -y install VirtualBox-7.1."${ARCH}" + "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-guest-additions."${ARCH}" ;; zypper) if [ "$DTYPE" = "opensuse-leap" ]; then From 4eec4e973c0613d4d24744537a4d008d94c4c1c5 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 13:56:33 -0400 Subject: [PATCH 24/42] fixed useless echos --- .../virtualization/create-virtual-machine.sh | 8 ++++---- .../applications-setup/virtualization/qemu-install.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index afbe5bbe1..26a99602c 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -11,11 +11,11 @@ virtmanager() { *"debian"*) distro="debian""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1 -d".")" ;; *"fedora"*) - distro="fedora""$(echo "${distroInfo##*-}")" ;; + distro="fedora""${distroInfo##*-}" ;; *"opensuse"*) case $distroInfo in *"leap"*) - distro="opensuse""$(echo "${distroInfo##*-}")" ;; + distro="opensuse""${distroInfo##*-}" ;; *) distro="opensusetumbleweed" ;; esac ;; @@ -144,10 +144,10 @@ virtualbox(){ # count=${#graphicsAdapters[@]} # if [[ "$count" -gt 1 ]]; then - # graphicsAdapter=$(echo graphicsAdapters | cut -f1 -d" ") + # graphicsAdapter=$($graphicsAdapters | cut -f1 -d" ") # fi - # graphicsAdapter=$(echo graphicsAdapters | cut -f1 -d" ") + # graphicsAdapter=$($graphicsAdapters | cut -f1 -d" ") # vboxmanage modifyvm "$name" --pci-attach=$graphicsAdapter@01:05.0 # fi diff --git a/core/tabs/applications-setup/virtualization/qemu-install.sh b/core/tabs/applications-setup/virtualization/qemu-install.sh index 317352ec0..5db63fc49 100644 --- a/core/tabs/applications-setup/virtualization/qemu-install.sh +++ b/core/tabs/applications-setup/virtualization/qemu-install.sh @@ -7,7 +7,7 @@ installQEMUDesktop() { case "$PACKAGER" in apt-get|nala) if ! command_exists qemu-img; then - "$ESCALATION_TOOL" "$PACKAGER" install -y qemu-utils qemu-system-$ARCH qemu-system-gui + "$ESCALATION_TOOL" "$PACKAGER" install -y qemu-utils qemu-system-"$ARCH" qemu-system-gui else printf "%b\n" "${GREEN}QEMU already installed.${RC}" fi From 79b3ed625f9745f695fae6d4de9d7d2116a488da Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 13:57:10 -0400 Subject: [PATCH 25/42] fixed useless echos --- .../virtualization/create-virtual-machine.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index 26a99602c..f890e03ae 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -196,8 +196,7 @@ setVMDetails() { installIsoInfo fi - distroInfo=$(isoinfo -d -i $isoFile | grep -i "volume id:" | awk '{print $3}') - distroInfo="$(echo $distroInfo | tr '[:upper:]' '[:lower:]')" + 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 ;; From feb5194dbe8e8a197a52a7ee7e9715d96d2765c6 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 14:06:13 -0400 Subject: [PATCH 26/42] fixed all variables not in double quotes --- .../virtualization/create-virtual-machine.sh | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index f890e03ae..3614f5b9b 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -9,7 +9,7 @@ virtmanager() { *"arch"*) distro="archlinux" ;; *"debian"*) - distro="debian""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1 -d".")" ;; + distro="debian""$(isoinfo -d -i "$isoFile" | awk 'NR==3{print $4}' | cut -f1 -d".")" ;; *"fedora"*) distro="fedora""${distroInfo##*-}" ;; *"opensuse"*) @@ -20,7 +20,7 @@ virtmanager() { distro="opensusetumbleweed" ;; esac ;; *"ubuntu"*) - distro="Ubuntu""$(isoinfo -d -i $isoFile | awk 'NR==3{print $4}' | cut -f1,2 -d".")" ;; + distro="Ubuntu""$(isoinfo -d -i "$isoFile" | awk 'NR==3{print $4}' | cut -f1,2 -d".")" ;; *) case $windows in *"windows"*) @@ -37,7 +37,7 @@ virtmanager() { 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 + virt-install --name "$name" --memory="$memory" --vcpus="$vcpus" --cdrom "$isoFile" --os-variant "$distro" --disk "$path"/"$name".qcow2 "$hostDev" } qemu() { @@ -48,23 +48,23 @@ qemu() { qemu-img create -f qcow2 $name.qcow2 $driveSize"G" qemu-system-x86_64 \ -m "$memory"G \ - -smp $vcpus \ + -smp "$vcpus" \ -boot d \ - -cdrom $isoFile \ - -drive file=$name.qcow2,format=qcow2 \ + -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 + -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 \ + 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" + -display default,show-cursor=on -smbios -enable-kvm -name "$name"" printf "%b\n" "To import this VM into virt-manager run the below" - printf "virt-install --name "$name" --memory=$memory --vcpus=$vcpus --os-variant $distro --disk $path/$name.qcow2 --network default --import" + printf "virt-install --name "$name" --memory="$memory" --vcpus="$vcpus" --os-variant "$distro" --disk "$path"/"$name".qcow2 --network default --import" } libvirt() { @@ -110,21 +110,21 @@ virtualbox(){ printf "%b" "Architecture not supported" fi - vboxmanage createvm --name="$name" --platform-architecture=$arch --ostype="$distro" --register + 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" --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 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" + 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. @@ -134,17 +134,17 @@ virtualbox(){ # printf "%b\n" "Please enter the Graphics Card model (ex. 5080, 4060, 9070, etc)" # read model - # graphicsAdapters=$(lspci | grep -i vga | grep -i $model) + # graphicsAdapters=$(lspci | grep -i vga | grep -i "$model") # SAVEIFS=$IFS # IFS=$'\n' - # graphicsAdapters=($graphicsAdapters) + # graphicsAdapters=("$graphicsAdapters") # IFS=$SAVEIFS # count=${#graphicsAdapters[@]} # if [[ "$count" -gt 1 ]]; then - # graphicsAdapter=$($graphicsAdapters | cut -f1 -d" ") + # graphicsAdapter=$(echo "$graphicsAdapters" | cut -f1 -d" ") # fi # graphicsAdapter=$($graphicsAdapters | cut -f1 -d" ") @@ -157,15 +157,15 @@ virtualbox(){ setVMDetails() { # Set memory to 1/4 of host memnory totalMemory=$(grep MemTotal /proc/meminfo | tr -s ' ' | cut -d ' ' -f2) - mem=$(expr $(expr $totalMemory / 1024000) + 1) - memory=$(expr $mem / 4) + mem=$(expr $(expr "$totalMemory" / 1024000) + 1) + memory=$(expr "$mem" / 4) if [ "$memory" -lt "2" ]; then memory=2 fi - memory=$(expr $memory \* 1024) + memory=$(expr "$memory" \* 1024) totalCpus=$(getconf _NPROCESSORS_ONLN) - vcpus=$(expr $totalCpus / 4) + vcpus=$(expr "$totalCpus" / 4) if [ "$vcpus" -lt "2" ]; then vcpus=2 fi @@ -196,8 +196,8 @@ setVMDetails() { 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}') ;; + 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 @@ -218,9 +218,9 @@ installIsoInfo() { checkVMExists() { if [ "$hypervisor" = "virt-manager" ]; then - vmExists=$(virsh list --all | grep -i $name | awk '{print $2}') + vmExists=$(virsh list --all | grep -i "$name" | awk '{print $2}') elif [ "$hypervisor" = "virtualbox" ]; then - vmExists=$(vboxmanage list vms | grep -i \"$name\" | cut -f1 -d" ") + vmExists=$(vboxmanage list vms | grep -i \""$name"\" | cut -f1 -d" ") fi if [ -z $vmExists ]; then @@ -242,7 +242,7 @@ checkInstalled() { $hypervisor fi else - printf "%b\n" "${GREEN}$hypervisor is not installed.${RC}" + printf "%b\n" "${GREEN}"$hypervisor" is not installed.${RC}" exit 1 fi } From 89792adce9b7c025ac555e37c00cbf97576c95d6 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 14:17:01 -0400 Subject: [PATCH 27/42] fixed more variables not in double quotes --- .../virtualization/create-virtual-machine.sh | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index 3614f5b9b..2d57f8f5d 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -36,7 +36,7 @@ virtmanager() { # setup physical PCI/USB etc hostDev="" - qemu-img create -f qcow2 $path/$name.qcow2 $driveSize"G" + 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" } @@ -45,7 +45,7 @@ qemu() { # Need to add PCI Graphics Passthrough - qemu-img create -f qcow2 $name.qcow2 $driveSize"G" + qemu-img create -f qcow2 "$name".qcow2 "$driveSize""G" qemu-system-x86_64 \ -m "$memory"G \ -smp "$vcpus" \ @@ -60,11 +60,11 @@ qemu() { -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 \ + 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"" + -display default,show-cursor=on -smbios -enable-kvm -name ${name}" printf "%b\n" "To import this VM into virt-manager run the below" - printf "virt-install --name "$name" --memory="$memory" --vcpus="$vcpus" --os-variant "$distro" --disk "$path"/"$name".qcow2 --network default --import" + printf "virt-install --name ${name} --memory=${memory} --vcpus=${vcpus} --os-variant ${distro} --disk ${path}/${name}.qcow2 --network default --import" } libvirt() { @@ -118,12 +118,12 @@ virtualbox(){ # 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 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 "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. @@ -223,7 +223,7 @@ checkVMExists() { vmExists=$(vboxmanage list vms | grep -i \""$name"\" | cut -f1 -d" ") fi - if [ -z $vmExists ]; then + if [ -z "$vmExists" ]; then return 1 else return 0 @@ -233,7 +233,7 @@ checkVMExists() { checkInstalled() { hypervisor=$1 - if command_exists $hypervisor; then + if command_exists "$hypervisor"; then if [ "$hypervisor" = "virt-manager" ]; then virtmanager elif [ "$hypervisor" = "qemu-img" ]; then @@ -242,7 +242,7 @@ checkInstalled() { $hypervisor fi else - printf "%b\n" "${GREEN}"$hypervisor" is not installed.${RC}" + printf "%b\n" "${GREEN}${hypervisor} is not installed.${RC}" exit 1 fi } From 426793ab477218a009571d175e1cead7c15fd164 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 14:22:39 -0400 Subject: [PATCH 28/42] fixed more variables not in double quotes --- .../virtualization/create-virtual-machine.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index 2d57f8f5d..926eff57a 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -118,12 +118,12 @@ virtualbox(){ # 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 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 "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. @@ -151,7 +151,7 @@ virtualbox(){ # vboxmanage modifyvm "$name" --pci-attach=$graphicsAdapter@01:05.0 # fi - vboxmanage startvm $name + vboxmanage startvm "$name" } setVMDetails() { From d12c09079fb2b1d18cd045bcd2e9bb832112bb46 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 14:35:16 -0400 Subject: [PATCH 29/42] removed expr --- .../virtualization/create-virtual-machine.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index 926eff57a..d5a424dc4 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -31,7 +31,7 @@ virtmanager() { esac printf "%b\n" "Please enter full folder path of for VM" - read path + read -r path # setup physical PCI/USB etc hostDev="" @@ -133,7 +133,7 @@ virtualbox(){ # if $passthtough == 1; then # printf "%b\n" "Please enter the Graphics Card model (ex. 5080, 4060, 9070, etc)" - # read model + # read -r model # graphicsAdapters=$(lspci | grep -i vga | grep -i "$model") # SAVEIFS=$IFS @@ -173,20 +173,20 @@ setVMDetails() { while true do printf "%b\n" "Please enter VM Name" - read name + read -r name if ! checkVMExists; then break else - printf "%b\n" "VM with that name already exists" + printf "%b\n" "VM with that name alread -ry exists" fi done printf "%b\n" "Please enter drive size" - read driveSize + read -r driveSize printf "%b\n" "Please enter full iso path" - read isoFile + read -r isoFile case $isoFile in *".iso") @@ -255,7 +255,7 @@ main() { printf "%b\n" "3. ${YELLOW}VirtualBox${RC}" # printf "%b\n" "4. ${YELLOW}Libvirt${RC}" printf "%b" "Enter your choice [1-3]: " - read -r CHOICE + read -r -r CHOICE case "$CHOICE" in 1) checkInstalled virt-manager ;; 2) checkInstalled qemu-img ;; From 24f2bef7a2e1465e7c0f9532440562ba8c101616 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 14:38:32 -0400 Subject: [PATCH 30/42] fixed already being replaced incorrectly --- .../virtualization/create-virtual-machine.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index d5a424dc4..b45c1609c 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -157,17 +157,17 @@ virtualbox(){ setVMDetails() { # Set memory to 1/4 of host memnory totalMemory=$(grep MemTotal /proc/meminfo | tr -s ' ' | cut -d ' ' -f2) - mem=$(expr $(expr "$totalMemory" / 1024000) + 1) - memory=$(expr "$mem" / 4) + mem=$(("$totalMemory" / 1024000 + 1)) + memory=$(("$mem" / 4)) if [ "$memory" -lt "2" ]; then - memory=2 + memory="2" fi - memory=$(expr "$memory" \* 1024) + memory=$(("$memory" * 1024)) totalCpus=$(getconf _NPROCESSORS_ONLN) - vcpus=$(expr "$totalCpus" / 4) + vcpus=$(("$totalCpus" / 4)) if [ "$vcpus" -lt "2" ]; then - vcpus=2 + vcpus="2" fi while true @@ -178,7 +178,7 @@ setVMDetails() { if ! checkVMExists; then break else - printf "%b\n" "VM with that name alread -ry exists" + printf "%b\n" "VM with that name already exists" fi done From 50136f36894d12f3b05192c4cd0c876f3e145ff6 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 14:50:59 -0400 Subject: [PATCH 31/42] fixed last few errors --- .../virtualization/create-virtual-machine.sh | 2 +- core/tabs/applications-setup/virtualization/libvirt.sh | 2 +- core/tabs/applications-setup/virtualization/qemu-install.sh | 4 ++-- core/tabs/applications-setup/virtualization/virt-manager.sh | 2 +- core/tabs/applications-setup/virtualization/virtualbox.sh | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index b45c1609c..870016c57 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -64,7 +64,7 @@ qemu() { -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 "virt-install --name ${name} --memory=${memory} --vcpus=${vcpus} --os-variant ${distro} --disk ${path}/${name}.qcow2 --network default --import" + printf "virt-install --name ""${name}"" --memory=""${memory}"" --vcpus=""${vcpus}"" --os-variant ""${distro}"" --disk ""${path}""/""${name}"".qcow2 --network default --import" } libvirt() { diff --git a/core/tabs/applications-setup/virtualization/libvirt.sh b/core/tabs/applications-setup/virtualization/libvirt.sh index 2140aa16e..d5fd0c205 100644 --- a/core/tabs/applications-setup/virtualization/libvirt.sh +++ b/core/tabs/applications-setup/virtualization/libvirt.sh @@ -6,7 +6,7 @@ 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 + "$ESCALATION_TOOL" usermod "$(who | awk 'NR==1{print $1}')" -aG kvm fi } diff --git a/core/tabs/applications-setup/virtualization/qemu-install.sh b/core/tabs/applications-setup/virtualization/qemu-install.sh index 5db63fc49..23c3925bb 100644 --- a/core/tabs/applications-setup/virtualization/qemu-install.sh +++ b/core/tabs/applications-setup/virtualization/qemu-install.sh @@ -20,7 +20,7 @@ installQEMUDesktop() { sudo systemctl enable libvirtd #add current user to virt manager group - sudo usermod -a -G libvirt $(whoami) + sudo usermod -a -G "libvirt" "$(who | awk 'NR==1{print $1}')" ;; zypper) if ! command_exists qemu-img; then @@ -69,7 +69,7 @@ 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 + "$ESCALATION_TOOL" usermod "$(who | awk 'NR==1{print $1}')" -aG kvm fi } diff --git a/core/tabs/applications-setup/virtualization/virt-manager.sh b/core/tabs/applications-setup/virtualization/virt-manager.sh index c522641e2..cd8a08fa1 100644 --- a/core/tabs/applications-setup/virtualization/virt-manager.sh +++ b/core/tabs/applications-setup/virtualization/virt-manager.sh @@ -20,7 +20,7 @@ installVirtManager() { sudo systemctl start libvirtd #add current user to virt manager group - sudo usermod -a -G libvirt $(who | awk 'NR==1{print $1}') + sudo usermod -a -G "libvirt" "$(who | awk 'NR==1{print $1}')" ;; pacman) if ! command_exists virt-manager; then diff --git a/core/tabs/applications-setup/virtualization/virtualbox.sh b/core/tabs/applications-setup/virtualization/virtualbox.sh index 4223ee582..26ea46e3d 100644 --- a/core/tabs/applications-setup/virtualization/virtualbox.sh +++ b/core/tabs/applications-setup/virtualization/virtualbox.sh @@ -7,7 +7,7 @@ installVirtualBox() { case "$PACKAGER" in apt-get|nala) wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg - "$ESCALATION_TOOL" sh -c 'echo "Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs)\nSuites: $(lsb_release -cs 2>/dev/null)\nComponents: contrib\nArchitectures: $ARCH\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n" > /etc/apt/sources.list.d/virtualbox.sources' + "$ESCALATION_TOOL" sh -c "echo "Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs)\nSuites: $(lsb_release -cs 2>/dev/null)\nComponents: contrib\nArchitectures: $ARCH\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n" > /etc/apt/sources.list.d/virtualbox.sources" "$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-7.1 @@ -49,7 +49,7 @@ installVirtualBox() { virtualBoxPermissions() { printf "%b\n" "${YELLOW}Adding current user to the vboxusers group...${RC}" - "$ESCALATION_TOOL" usermod -aG vboxusers $(who | awk 'NR==1{print $1}') + "$ESCALATION_TOOL" usermod -aG "vboxusers" "$(who | awk 'NR==1{print $1}')" } checkEnv From 0fe542414ff2528dda319be46ee845ba97413a62 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 15:27:25 -0400 Subject: [PATCH 32/42] removed unnecessary comment --- .../applications-setup/virtualization/create-virtual-machine.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index 870016c57..82b985b88 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -43,8 +43,6 @@ virtmanager() { qemu() { setVMDetails - # Need to add PCI Graphics Passthrough - qemu-img create -f qcow2 "$name".qcow2 "$driveSize""G" qemu-system-x86_64 \ -m "$memory"G \ From fe8756b760abf97a8a2ea6b90a56e47dc3b065a8 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 15:34:43 -0400 Subject: [PATCH 33/42] changed line 10 in virtualbox.sh to meet requirements --- core/tabs/applications-setup/virtualization/virtualbox.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/applications-setup/virtualization/virtualbox.sh b/core/tabs/applications-setup/virtualization/virtualbox.sh index 26ea46e3d..19a3839d5 100644 --- a/core/tabs/applications-setup/virtualization/virtualbox.sh +++ b/core/tabs/applications-setup/virtualization/virtualbox.sh @@ -7,7 +7,7 @@ installVirtualBox() { case "$PACKAGER" in apt-get|nala) wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg - "$ESCALATION_TOOL" sh -c "echo "Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs)\nSuites: $(lsb_release -cs 2>/dev/null)\nComponents: contrib\nArchitectures: $ARCH\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n" > /etc/apt/sources.list.d/virtualbox.sources" + "$ESCALATION_TOOL" sh -c "echo "Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs)\nSuites: $(lsb_release -cs 2>/dev/null)\nComponents: contrib\nArchitectures: "${ARCH}"\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n" > /etc/apt/sources.list.d/virtualbox.sources" "$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-7.1 From d41b210486b1f6a185fa4d59dd5c3444eb748156 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 15:38:42 -0400 Subject: [PATCH 34/42] changed line 10 second attempt --- core/tabs/applications-setup/virtualization/virtualbox.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/applications-setup/virtualization/virtualbox.sh b/core/tabs/applications-setup/virtualization/virtualbox.sh index 19a3839d5..83401f3b4 100644 --- a/core/tabs/applications-setup/virtualization/virtualbox.sh +++ b/core/tabs/applications-setup/virtualization/virtualbox.sh @@ -7,7 +7,7 @@ installVirtualBox() { case "$PACKAGER" in apt-get|nala) wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg - "$ESCALATION_TOOL" sh -c "echo "Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs)\nSuites: $(lsb_release -cs 2>/dev/null)\nComponents: contrib\nArchitectures: "${ARCH}"\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n" > /etc/apt/sources.list.d/virtualbox.sources" + "$ESCALATION_TOOL" sh -c "echo \"Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian "$(lsb_release -cs 2>/dev/null)"\nSuites: "$(lsb_release -cs 2>/dev/null)"\nComponents: contrib\nArchitectures: "${ARCH}"\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n\" > /etc/apt/sources.list.d/virtualbox.sources" "$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-7.1 From e551a747d00cde54c0720b5d96005c7468ec5f69 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 15:45:43 -0400 Subject: [PATCH 35/42] changed line 10 third attempt --- core/tabs/applications-setup/virtualization/virtualbox.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/applications-setup/virtualization/virtualbox.sh b/core/tabs/applications-setup/virtualization/virtualbox.sh index 83401f3b4..934ce4050 100644 --- a/core/tabs/applications-setup/virtualization/virtualbox.sh +++ b/core/tabs/applications-setup/virtualization/virtualbox.sh @@ -7,7 +7,7 @@ installVirtualBox() { case "$PACKAGER" in apt-get|nala) wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg - "$ESCALATION_TOOL" sh -c "echo \"Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian "$(lsb_release -cs 2>/dev/null)"\nSuites: "$(lsb_release -cs 2>/dev/null)"\nComponents: contrib\nArchitectures: "${ARCH}"\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n\" > /etc/apt/sources.list.d/virtualbox.sources" + "$ESCALATION_TOOL" sh -c "echo \"Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian "$(lsb_release -cs 2>/dev/null)"\nSuites: "$(lsb_release -cs 2>/dev/null)"\nComponents: contrib\nArchitectures: ""${ARCH}""\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n\" > /etc/apt/sources.list.d/virtualbox.sources" "$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-7.1 From 15eb847d36286b63514cfe8c1a999fff473a001e Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 15:53:14 -0400 Subject: [PATCH 36/42] changed sources.list creation to printf --- core/tabs/applications-setup/virtualization/virtualbox.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/virtualbox.sh b/core/tabs/applications-setup/virtualization/virtualbox.sh index 934ce4050..d5f6f2157 100644 --- a/core/tabs/applications-setup/virtualization/virtualbox.sh +++ b/core/tabs/applications-setup/virtualization/virtualbox.sh @@ -7,8 +7,8 @@ installVirtualBox() { case "$PACKAGER" in apt-get|nala) wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg - "$ESCALATION_TOOL" sh -c "echo \"Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian "$(lsb_release -cs 2>/dev/null)"\nSuites: "$(lsb_release -cs 2>/dev/null)"\nComponents: contrib\nArchitectures: ""${ARCH}""\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n\" > /etc/apt/sources.list.d/virtualbox.sources" - "$ESCALATION_TOOL" "$PACKAGER" update + "$ESCALATION_TOOL" printf "Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian "$(lsb_release -cs 2>/dev/null)"\nSuites: "$(lsb_release -cs 2>/dev/null)"\nComponents: contrib\nArchitectures: ""${ARCH}""\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n" > /etc/apt/sources.list.d/virtualbox.sources + "$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-7.1 vboxVersion=$(vboxmanage --version | cut -f1 -d"r") From 524ea1d212393efe92f52306cf09c09b0d0da9ac Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 15:56:38 -0400 Subject: [PATCH 37/42] changed sources.list creation to printf --- core/tabs/applications-setup/virtualization/virtualbox.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/applications-setup/virtualization/virtualbox.sh b/core/tabs/applications-setup/virtualization/virtualbox.sh index d5f6f2157..0d66a26a1 100644 --- a/core/tabs/applications-setup/virtualization/virtualbox.sh +++ b/core/tabs/applications-setup/virtualization/virtualbox.sh @@ -7,7 +7,7 @@ installVirtualBox() { case "$PACKAGER" in apt-get|nala) wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg - "$ESCALATION_TOOL" printf "Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian "$(lsb_release -cs 2>/dev/null)"\nSuites: "$(lsb_release -cs 2>/dev/null)"\nComponents: contrib\nArchitectures: ""${ARCH}""\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n" > /etc/apt/sources.list.d/virtualbox.sources + "$ESCALATION_TOOL" printf "Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian ""$(lsb_release -cs 2>/dev/null)""\nSuites: ""$(lsb_release -cs 2>/dev/null)""\nComponents: contrib\nArchitectures: ""${ARCH}""\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n" > /etc/apt/sources.list.d/virtualbox.sources "$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-7.1 From 2536676f05da9deae6a88c4333931cfe3fbf4cc4 Mon Sep 17 00:00:00 2001 From: Nick Amato Date: Fri, 22 Aug 2025 16:01:35 -0400 Subject: [PATCH 38/42] changed sources.list creation to printf --- .../applications-setup/virtualization/create-virtual-machine.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh index 82b985b88..7f55e819a 100644 --- a/core/tabs/applications-setup/virtualization/create-virtual-machine.sh +++ b/core/tabs/applications-setup/virtualization/create-virtual-machine.sh @@ -62,7 +62,7 @@ qemu() { -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 "virt-install --name ""${name}"" --memory=""${memory}"" --vcpus=""${vcpus}"" --os-variant ""${distro}"" --disk ""${path}""/""${name}"".qcow2 --network default --import" + printf "%b\n" "virt-install --name ${name} --memory=${memory} --vcpus=${vcpus} --os-variant ${distro} --disk ${path}/${name}.qcow2 --network default --import" } libvirt() { From 4be647ae634b8a41002fff66a1d411ce4f8e9057 Mon Sep 17 00:00:00 2001 From: Nick A Date: Thu, 11 Sep 2025 15:31:39 -0400 Subject: [PATCH 39/42] Fixed debian vbox install --- core/tabs/applications-setup/virtualization/virtualbox.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tabs/applications-setup/virtualization/virtualbox.sh b/core/tabs/applications-setup/virtualization/virtualbox.sh index 0d66a26a1..34ebcaca7 100644 --- a/core/tabs/applications-setup/virtualization/virtualbox.sh +++ b/core/tabs/applications-setup/virtualization/virtualbox.sh @@ -7,12 +7,12 @@ installVirtualBox() { case "$PACKAGER" in apt-get|nala) wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg - "$ESCALATION_TOOL" printf "Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian ""$(lsb_release -cs 2>/dev/null)""\nSuites: ""$(lsb_release -cs 2>/dev/null)""\nComponents: contrib\nArchitectures: ""${ARCH}""\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n" > /etc/apt/sources.list.d/virtualbox.sources + "$ESCALATION_TOOL" printf "Types: deb\nURIs: http://download.virtualbox.org/virtualbox/debian\nSuites: ""$(lsb_release -cs 2>/dev/null)""\nComponents: contrib\nArchitectures: ""${ARCH}""\nSigned-By: /usr/share/keyrings/oracle-virtualbox-2016.gpg\n" > /etc/apt/sources.list.d/virtualbox.sources "$ESCALATION_TOOL" "$PACKAGER" update "$ESCALATION_TOOL" "$PACKAGER" -y install virtualbox-7.1 vboxVersion=$(vboxmanage --version | cut -f1 -d"r") - wget -P /home/"$USER"/Downloads/vbox.vbox-extpack https://download.virtualbox.org/virtualbox/"${vboxVersion}"/Oracle_VirtualBox_Extension_Pack-"${vboxVersion}".vbox-extpack + wget -c -O /home/"$USER"/Downloads/vbox.vbox-extpack https://download.virtualbox.org/virtualbox/"${vboxVersion}"/Oracle_VirtualBox_Extension_Pack-"${vboxVersion}".vbox-extpack VBoxManage extpack install vbox.vbox-extpack ;; dnf) From 9eabfcf234208f4b60cb5018e8add2d69858cead Mon Sep 17 00:00:00 2001 From: Nick A Date: Tue, 16 Sep 2025 21:15:47 -0400 Subject: [PATCH 40/42] added ctype and rtype --- core/tabs/common-script.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/tabs/common-script.sh b/core/tabs/common-script.sh index fc990e02d..109bbf6a6 100644 --- a/core/tabs/common-script.sh +++ b/core/tabs/common-script.sh @@ -178,6 +178,13 @@ checkDistro() { if [ -f /etc/os-release ]; then . /etc/os-release DTYPE=$ID + CTYPE=$VERSION_CODENAME + RTYPE=$VERSION_ID + # Use lsb-release if /etc/os-release is missing + elif command_exists lsb_release; then + DTYPE=$(lsb_release -is 2>/dev/null) + CTYPE=$(lsb_release -cs 2>/dev/null) + RTYPE=$(lsb_release -rs 2>/dev/null) fi } From 6ec04624c84d05842851ba319b91bae2bec4ce2a Mon Sep 17 00:00:00 2001 From: Nick A Date: Tue, 16 Sep 2025 21:25:17 -0400 Subject: [PATCH 41/42] Fixed typo in fallout76 --- core/tabs/gaming/fallout-76/fallout76settings.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/tabs/gaming/fallout-76/fallout76settings.sh b/core/tabs/gaming/fallout-76/fallout76settings.sh index 1778ad3d9..2d2c41a9f 100755 --- a/core/tabs/gaming/fallout-76/fallout76settings.sh +++ b/core/tabs/gaming/fallout-76/fallout76settings.sh @@ -171,9 +171,9 @@ find_common_paths() { IFS=' ' for steam_dir in $steamapps_dirs; do - fo76_path="$steam_dir/common/Fallout76" - if [ -d "$fo76_path" ]; then - common_paths="$common_paths$fo76_path + fallout76_path="$steam_dir/common/Fallout76" + if [ -d "$fallout76_path" ]; then + common_paths="$common_paths$fallout76_path " fi done From 79a1e0f7613fa5b2b7d9f0e1a4c36955b42b0ef7 Mon Sep 17 00:00:00 2001 From: Nick A Date: Tue, 16 Sep 2025 21:31:02 -0400 Subject: [PATCH 42/42] Fixed incorrect shell command in fallout76 --- core/tabs/gaming/fallout-76/fallout76settings.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/tabs/gaming/fallout-76/fallout76settings.sh b/core/tabs/gaming/fallout-76/fallout76settings.sh index 2d2c41a9f..6d2fdb83c 100755 --- a/core/tabs/gaming/fallout-76/fallout76settings.sh +++ b/core/tabs/gaming/fallout-76/fallout76settings.sh @@ -414,8 +414,8 @@ prepare_path_selection() { } # Main execution starts here -find_steamapps_dirs -if [ $? -ne 0 ]; then + +if ! find_steamapps_dirs; then printf "%b\n" "${RED}Cannot proceed without Steam library folders.${RC}" exit 1 fi