From 0cdea98a717cebab10ad9bfae5d11942a1b5d39e Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Fri, 1 Aug 2025 11:34:55 +0200 Subject: [PATCH] Update unifi-os-vm.sh --- vm/unifi-os-vm.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/vm/unifi-os-vm.sh b/vm/unifi-os-vm.sh index 61a79fbe..9308f7b7 100644 --- a/vm/unifi-os-vm.sh +++ b/vm/unifi-os-vm.sh @@ -488,6 +488,37 @@ echo -en "\e[1A\e[0K" FILE=$(basename $URL) msg_ok "Downloaded ${CL}${BL}${FILE}${CL}" +### UNI-FI OS BLOCK BEGIN + +UOS_VERSION="4.2.23" +UOS_URL="https://fw-download.ubnt.com/data/unifi-os-server/8b93-linux-x64-4.2.23-158fa00b-6b2c-4cd8-94ea-e92bc4a81369.23-x64" +UOS_INSTALLER="unifi-os-server-${UOS_VERSION}.bin" + +if ! command -v virt-customize &>/dev/null; then + msg_info "Installing required package: libguestfs-tools on Proxmox host" + apt-get -qq update >/dev/null + apt-get -qq install libguestfs-tools lsb-release -y >/dev/null + msg_ok "libguestfs-tools installed successfully" +fi + +msg_info "Patching DNS resolver for apt inside the image" +virt-customize -q -a "${FILE}" --run-command 'echo "nameserver 1.1.1.1" > /etc/resolv.conf' >/dev/null + +msg_info "Injecting UniFi OS Server dependencies and installer into Debian 12 image" +virt-customize -q -a "${FILE}" \ + --install qemu-guest-agent,ca-certificates,curl,lsb-release,podman \ + --run-command "curl -fsSL '${UOS_URL}' -o /root/${UOS_INSTALLER} && chmod +x /root/${UOS_INSTALLER}" >/dev/null + +msg_info "Cleaning up temporary DNS resolver in image" +virt-customize -q -a "${FILE}" --run-command 'rm -f /etc/resolv.conf' >/dev/null + +msg_ok "UniFi OS Server installer and dependencies successfully added to Debian 12 image" +msg_custom "After first VM boot, SSH to the VM as root and run:" +msg_custom "/root/${UOS_INSTALLER} --install" +msg_custom "Official UniFi OS Server Guide: https://help.ui.com/hc/en-us/articles/26951761949147-UniFi-OS-Server" + +### UNI-FI OS BLOCK END + STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}') case $STORAGE_TYPE in nfs | dir)