Compare commits

...

2 Commits

Author SHA1 Message Date
CanbiZ
7b2c9bf770 Update unifi-os-server-vm.sh 2025-12-03 15:23:51 +01:00
CanbiZ
b7756b7af9 Update unifi-os-server-vm.sh 2025-12-03 14:16:10 +01:00

View File

@ -592,22 +592,18 @@ msg_ok "Downloaded ${CL}${BL}${FILE}${CL}"
msg_info "Preparing ${OS_DISPLAY} Cloud Image for UniFi OS"
# Create Cloud-Init user-data for UniFi OS installation
cat > user-data.yaml <<'USERDATA'
cat >user-data.yaml <<EOFUSERDATA
#cloud-config
# UniFi OS Server Auto-Installation
# This runs automatically on first boot
# Resize root filesystem to use all available space
growpart:
mode: auto
devices: ['/']
resize_rootfs: true
# Set timezone
timezone: Europe/Berlin
# Install required packages
packages:
- qemu-guest-agent
- curl
@ -618,51 +614,25 @@ packages:
- slirp4netns
- iptables
# Configure system
runcmd:
# Enable and start qemu-guest-agent
- systemctl enable qemu-guest-agent
- systemctl start qemu-guest-agent
# Configure Podman
- loginctl enable-linger root
- cd /root
- curl -fsSL '${UOS_URL}' -o unifi-os-server-${UOS_VERSION}.bin
- chmod +x unifi-os-server-${UOS_VERSION}.bin
- /root/unifi-os-server-${UOS_VERSION}.bin install 2>&1 | tee /var/log/unifi-install.log
- sleep 10
- systemctl enable unifi-os-server 2>&1 || true
- systemctl start unifi-os-server 2>&1 || true
- touch /root/.unifi-installed
# Download and install UniFi OS Server
- |
set -e
cd /root
echo "[$(date)] Downloading UniFi OS Server ${UOS_VERSION}"
curl -fsSL '${UOS_URL}' -o unifi-os-server-${UOS_VERSION}.bin
chmod +x unifi-os-server-${UOS_VERSION}.bin
final_message: "UniFi OS Server installation complete!"
EOFUSERDATA
echo "[$(date)] Installing UniFi OS Server (this takes 3-5 minutes)"
./unifi-os-server-${UOS_VERSION}.bin install 2>&1 | tee /var/log/unifi-install.log
msg_ok "Created Cloud-Init configuration for UniFi OS installation"
echo "[$(date)] Checking for UniFi OS Server service"
sleep 10
if systemctl list-unit-files | grep -q unifi-os-server; then
echo "[$(date)] Starting UniFi OS Server service"
systemctl enable unifi-os-server
systemctl start unifi-os-server
sleep 5
if systemctl is-active --quiet unifi-os-server; then
echo "[$(date)] ✓ UniFi OS Server is running"
fi
fi
echo "[$(date)] Installation completed"
touch /root/.unifi-installed
final_message: |
UniFi OS Server installation complete!
Access the web interface at: https://$(hostname -I | awk '{print $1}'):11443
Installation log: /var/log/unifi-install.log
Cloud-Init log: /var/log/cloud-init-output.log
USERDATA
msg_ok "Created Cloud-Init configuration for UniFi OS installation"# Expand root partition to use full disk space
# Expand root partition to use full disk space
msg_info "Expanding disk image to ${DISK_SIZE}"
qemu-img create -f qcow2 expanded.qcow2 ${DISK_SIZE} >/dev/null 2>&1
@ -721,7 +691,9 @@ if [ -n "$CLOUDINIT_CRED_FILE" ] && [ -f "$CLOUDINIT_CRED_FILE" ]; then
echo -e "${TAB}${RD}⚠️ Installation starts automatically on first boot${CL}"
echo -e "${TAB}${INFO}Monitor: ${BL}tail -f /var/log/cloud-init-output.log${CL}"
echo ""
fiDESCRIPTION=$(
fi
DESCRIPTION=$(
cat <<EOF
<div align='center'>
<a href='https://Helper-Scripts.com' target='_blank' rel='noopener noreferrer'>