From 2a83aaa89997f682fa5764361dc507211378b622 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Fri, 1 Aug 2025 14:52:40 +0200 Subject: [PATCH] Update unifi-os-vm.sh --- vm/unifi-os-vm.sh | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/vm/unifi-os-vm.sh b/vm/unifi-os-vm.sh index f06f7e90..5770838c 100644 --- a/vm/unifi-os-vm.sh +++ b/vm/unifi-os-vm.sh @@ -446,6 +446,7 @@ ssh_check start_script post_to_api_vm + msg_info "Validating Storage" while read -r line; do TAG=$(echo $line | awk '{print $1}') @@ -474,8 +475,8 @@ else fi msg_ok "Using ${CL}${BL}$STORAGE${CL} ${GN}for Storage Location." msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}." -msg_info "Retrieving the URL for the Debian 12 Cloud-Init Image" -URL=https://cloud-images.ubuntu.com/oracular/current/oracular-server-cloudimg-amd64.img +msg_info "Retrieving the URL for the Ubuntu 24.04 Disk Image" +URL=https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img sleep 2 msg_ok "${CL}${BL}${URL}${CL}" curl -f#SL -o "$(basename "$URL")" "$URL" @@ -511,7 +512,7 @@ msg_ok "Cloud-Init user-data snippet for UniFi OS Server created at ${USERDATA_S STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') case $STORAGE_TYPE in -nfs | dir) +nfs | dir | cifs) DISK_EXT=".qcow2" DISK_REF="$VMID/" DISK_IMPORT="-format qcow2" @@ -531,7 +532,7 @@ for i in {0,1}; do eval DISK${i}_REF=${STORAGE}:${DISK_REF:-}${!disk} done -msg_info "Creating a Debian 12 Cloud VM" +msg_info "Creating a Ubuntu 24.04 VM" qm create $VMID -agent 1${MACHINE} -tablet 0 -localtime 1 -bios ovmf${CPU_TYPE} -cores $CORE_COUNT -memory $RAM_SIZE \ -name $HN -tags community-script -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN$MTU -onboot 1 -ostype l26 -scsihw virtio-scsi-pci pvesm alloc $STORAGE $VMID $DISK0 4M 1>&/dev/null @@ -539,9 +540,40 @@ qm importdisk $VMID ${FILE} $STORAGE ${DISK_IMPORT:-} 1>&/dev/null qm set $VMID \ -efidisk0 ${DISK0_REF}${FORMAT} \ -scsi0 ${DISK1_REF},${DISK_CACHE}${THIN}size=${DISK_SIZE} \ + -ide2 ${STORAGE}:cloudinit \ -boot order=scsi0 \ -serial0 socket >/dev/null +DESCRIPTION=$( + cat < + + Logo + +

ubuntu VM

+ +

+ + spend Coffee + +

+ + + + GitHub + + + + Discussions + + + + Issues + + +EOF +) +qm set "$VMID" -description "$DESCRIPTION" >/dev/null if [ -n "$DISK_SIZE" ]; then msg_info "Resizing disk to $DISK_SIZE GB" qm resize $VMID scsi0 ${DISK_SIZE} >/dev/null