Skip to content

Commit

Permalink
Feature: Support multiple flavors, latest and daily ISO
Browse files Browse the repository at this point in the history
In response to Github Issue #17 #17
This enables Flavor Selection, and Choice of release or daily
Updated default config, and documentation
  • Loading branch information
Rick Timmis committed May 10, 2024
1 parent b6e9f8a commit a64ee57
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 26 deletions.
2 changes: 1 addition & 1 deletion KubuQA.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ISO_DOWNLOAD_DIR="$(xdg-user-dir DOWNLOAD)/KubuntuTestISO"

# Name of the VM.
# Default: "TestKubuntuInstall"
VM_NAME="TestKubuntuInstall"
VM_NAME="KubuQATestKubuntu"

# Path to the Virtual Disk Image (VDI). The image will be created if it doesn't exist.
# Default: "$HOME/VirtualBox VMs/$VM_NAME/$VM_NAME.vdi"
Expand Down
64 changes: 46 additions & 18 deletions KubuQA.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@

# Directory the ISO file will be downloaded to.
# Default is a XDG download dir, i.e. for English locale: "$HOME/Downloads/KubuntuTestISO"
ISO_DOWNLOAD_DIR="$(xdg-user-dir DOWNLOAD)/KubuntuTestISO"

# Name of the VM.
# Default: "TestKubuntuInstall"
VM_NAME="TestKubuntuInstall"

# Path to the Virtual Disk Image (VDI). The image will be created if it doesn't exist.
# Default: "$HOME/VirtualBox VMs/$VM_NAME/$VM_NAME.vdi"
VDI_FILEPATH="$HOME/VirtualBox VMs/$VM_NAME/$VM_NAME.vdi"
ISO_DOWNLOAD_DIR="$(xdg-user-dir DOWNLOAD)/KubuQATestISOfiles"

# Number of virtual CPUs to assign to the VM.
# You should not configure virtual machines to use more CPU cores than are available physically.
Expand Down Expand Up @@ -50,12 +42,7 @@ PARAVIRT="none"
# DO NOT EDIT ANY VARIABLES BELOW THIS LINE #
#############################################

ISO_FILENAME="noble-desktop-amd64.iso"

# Don't include the protocol http:// || https:// as we need to switch between them
# to enable zsync to be succesful. See:
# https://ubuntuforums.org/showthread.php?t=2494264
ISO_DOWNLOAD_URL="cdimages.ubuntu.com/kubuntu/daily-live/current/$ISO_FILENAME"

# FUNCTIONS
# ---------
Expand Down Expand Up @@ -90,7 +77,7 @@ check_and_install_tool() {
fi
}

# Function to check for a previous Kubuntu Test VM. If not found, create one.
# Function to check for a previous KubuQA test VM. If not found, create one.
check_existing_vm(){
# Run VBoxManage list vms and capture output
vms_output=$(VBoxManage list vms)
Expand Down Expand Up @@ -175,6 +162,46 @@ function check_existing_iso() {
fi
}

# Enable the user to choose which Ubuntu Flavor they want to test
function choose_flavor() {
# See: https://cdimage.ubuntu.com/ for flavors and path info etc...
choice=$(kdialog --menu "Select Ubuntu Flavor" 1 "Ubuntu" 2 "Kubuntu" 3 "Lubuntu" 4 "Ubuntu-Budgie" 5 "Edubuntu" 6 "Ubuntu-Unity" 7 "Ubuntu-Cinnamon")
case $choice in
1) FLAVOR="ubuntu"
VM_NAME="KubuQATestUbuntu";;
2) FLAVOR="kubuntu"
VM_NAME="KubuQATestKubuntu";;
3) FLAVOR="lubuntu"
VM_NAME="KubuQATestLubuntu";;
4) FLAVOR="ubuntu-budgie"
VM_NAME="KubuQATestUbuntuBudgie";;
5) FLAVOR="edubuntu"
VM_NAME="KubuQATestEdubuntu";;
6) FLAVOR="ubuntu-unity"
VM_NAME="KubuQATestUbuntuUnity";;
7) FLAVOR="ubuntucinnamon"
VM_NAME="KubuQATestUbuntuCinnamon";;
esac

release=$(kdialog --menu "Which version " 1 "Noble Numbat 24.04" 2 "Oracular Oriole 24.10")
case $release in
1) ISO_FILENAME="noble-desktop-amd64.iso";;
2) ISO_FILENAME="oracular-desktop-amd64.iso";;
esac

# Don't include the protocol http:// || https:// as we need to switch between them
# to enable zsync to be successful. See:
# https://ubuntuforums.org/showthread.php?t=2494264
ISO_DOWNLOAD_URL="cdimages.ubuntu.com/$FLAVOR/daily-live/current/$ISO_FILENAME"

#Each Flavor should have it's own download director
ISO_DOWNLOAD_DIR="$ISO_DOWNLOAD_DIR/$FLAVOR"

# Path to the Virtual Disk Image (VDI). The image will be created if it doesn't exist.
# Default: "$HOME/VirtualBox VMs/$VM_NAME/$VM_NAME.vdi"
VDI_FILEPATH="$HOME/VirtualBox VMs/$VM_NAME/$VM_NAME.vdi"

}
# MAIN
# ----

Expand Down Expand Up @@ -215,7 +242,8 @@ while [[ "$#" -gt 0 ]]; do
shift
done

# Check whether various components exist. If not or if requested, (re)create them
# Check whether various components exist. If not or if requested, (re)create
choose_flavor
check_existing_vm
check_existing_vdi
check_existing_iso
Expand All @@ -224,7 +252,7 @@ check_existing_iso
if kdialog --yesno "Launch a Test Install using Virtual Box?"; then

# Enable the user to choose which device to boot from
choice=$(kdialog --menu "Select boot medium" 1 "ISO" 2 "VDI")
choice=$(kdialog --menu "Select boot medium" 1 "ISO cdimage" 2 "VDI disk")

case "$choice" in
# Attatch the ISO to its storage controller and make VirtualBox boot from it
Expand All @@ -243,7 +271,7 @@ if kdialog --yesno "Launch a Test Install using Virtual Box?"; then

# Wait 10 seconds and then resize the display
# This ensures that as the installer runs the Calamares Slide show renders nicely, and the user
# has enough screen realestate to operate the installer.
# has enough screen real estate to operate the installer.
# Hat Tip to 'Sergey Tkachenko' https://winaero.com/author/hb860root/
# https://winaero.com/set-exact-display-resolution-in-virtualbox-virtual-machine/
sleep 10
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## Kubuntu ISO Testing Utility - Spin up VMs with ease

**New to Kubuntu Testing & Development ?** No worries, we have you covered!!
**New to Ubuntu Testing & Development ?** No worries, we have got you covered!!

### Overview

This Bash script automates the process of setting up a test environment based off the latest daily build of Kubuntu.
This Bash script automates the process of setting up a test environment based upon Ubuntu CD images.
It downloads all required files if necessary and facilitates launching a test installation using VirtualBox.
It leverages `kdialog` for graphical user interaction,
making it accessible even for users who prefer not to work with the command line directly.
Expand Down Expand Up @@ -64,22 +64,22 @@ The script will guide you through the following steps:
- Install all necessary programs it needs to run (see above)
- Set up the scaffold of the testing VM if necessary
- Create a Virtual Disk Image (VDI) if necessary
- Look for the specified ISO download directory (`~/Downloads/KubuntuTestISO` by default) and create it if necessary
- Check if the `noble-desktop-amd64.iso` file exists within this directory:
- Look for the specified ISO download directory (`~/Downloads/KubuQATestISOfiles` by default) and create it if necessary
- Check if the flavor ISO file exists within this directory:
- If found, offer to check for updates using zsync.
- If not found, prompt to download the ISO.
- Ask if you want to launch a test installation in VirtualBox.
If you choose Yes, a new VirtualBox VM will be started.
Please **make sure to select `ISO`** when starting up a freshly created VM,
Please **make sure to select `ISO cdimage`** when starting up a freshly created VM,
since the VDI is empty and can't be used as boot device as long as there is no OS installed on it.

Upon subsequent runs, you may choose to boot from ISO or VDI, giving you the ability to Stop/Start your testing as desired.
Upon subsequent runs, you may choose to boot from 'ISO cdimage' or 'VDI disk', giving you the ability to Stop/Start your testing as desired.

For each of the steps that require user interaction, a `kdialog` prompt will appear to guide you through the process.

### Configuration

KubuQA aims to be usable by anyone, the goal is to provide an easy way to get started in the testing and development of Kubuntu.
KubuQA aims to be usable by anyone, the goal is to provide an easy way to get started in the testing and development of Ubuntu.
Following the KDE motto "Simple by default, powerful when needed", it comes with sane defaults and multiple configuration options.

You can set these variables either by directly editing the script, providing a config file (see the
Expand Down

0 comments on commit a64ee57

Please sign in to comment.