Skip to content

Commit bdc34c5

Browse files
committed
Refactor VM scripts for improved error handling and user experience
- Updated error handling to use 'set -Eeo pipefail' for better script robustness. - Enhanced VM creation scripts for ownCloud, Home Assistant OS, Ubuntu, Umbrel OS, Waydroid, and ZimaOS with improved variable management and user prompts. - Increased disk size for ownCloud VM from 8G to 10G and updated version to 19.0. - Streamlined the process of selecting OS versions and handling cloud-init configurations across multiple scripts. - Improved messaging and logging for better user feedback during VM creation. - Removed redundant code and optimized disk image fetching and processing.
1 parent e72add5 commit bdc34c5

15 files changed

Lines changed: 396 additions & 643 deletions

‎.github/workflows/scripts/vm-wizard-test.sh‎

Lines changed: 112 additions & 93 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.github/workflows/vm-wizard.yml‎

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vm/blissos-vm.sh‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ THIN="discard=on,ssd=1,"
2222
header_info
2323
echo -e "\n Loading..."
2424

25-
set -e
25+
set -Eeo pipefail
2626
trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
2727
trap cleanup EXIT
2828
trap 'post_update_to_api "failed" "130"' SIGINT
@@ -135,6 +135,7 @@ qm create $VMID -agent 1${MACHINE} -tablet 1 -localtime 1 -bios ovmf${CPU_TYPE}
135135
-efidisk0 ${STORAGE}:1,efitype=4m,pre-enrolled-keys=0 -scsi0 ${STORAGE}:${DISK_SIZE%G},${DISK_CACHE}${THIN%,} \
136136
-cdrom "$ISO_VOLUME" -boot order='scsi0;ide2' -vga virtio >/dev/null
137137

138+
vm_mark_created
138139
set_description
139140

140141
msg_ok "Created a BlissOS VM ${CL}${BL}(${HN})"

‎vm/cachyos-vm.sh‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ THIN="discard=on,ssd=1,"
2727
header_info
2828
echo -e "\n Loading..."
2929

30-
set -e
30+
set -Eeo pipefail
3131
trap 'error_handler $LINENO "$BASH_COMMAND"' ERR
3232
trap cleanup EXIT
3333
trap 'post_update_to_api "failed" "130"' SIGINT
@@ -107,7 +107,8 @@ msg_info "Retrieving the URL for the CachyOS Desktop ISO"
107107
# Get latest release version from SourceForge (format: YYMMDD in folder links)
108108
CACHYOS_VERSION=$(curl -fsSL "https://sourceforge.net/projects/cachyos-arch/files/gui-installer/desktop/" 2>/dev/null | grep -oP 'desktop/\K[0-9]{6}(?=/)' | sort -rn | head -1)
109109
if [ -z "$CACHYOS_VERSION" ]; then
110-
CACHYOS_VERSION="260124"
110+
msg_error "Could not determine the current CachyOS release."
111+
exit 115
111112
fi
112113

113114
# SourceForge download URL with mirror redirect
@@ -133,6 +134,7 @@ qm create $VMID -agent 1${MACHINE} -tablet 0 -localtime 1 -bios ovmf${CPU_TYPE}
133134
-name $HN -tags community-script -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 0 -ostype l26 -scsihw virtio-scsi-pci \
134135
-efidisk0 ${STORAGE}:1,efitype=4m,pre-enrolled-keys=0 -scsi0 ${STORAGE}:${DISK_SIZE%G},${DISK_CACHE}${THIN%,} \
135136
-cdrom "$ISO_VOLUME" -boot order='scsi0;ide2' -vga qxl -serial0 socket >/dev/null
137+
vm_mark_created
136138

137139
set_description
138140

0 commit comments

Comments
 (0)