Update unifi-os-vm.sh

This commit is contained in:
CanbiZ 2025-08-01 11:34:55 +02:00
parent 607e29fab3
commit 0cdea98a71

View File

@ -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)