Files
zroc/zroc-ova/scripts/03-setup-wizard.sh
T
Justin 79c025430e ova: fix swap, auto-launch setup wizard, add password change step
- Replace direct storage layout with explicit partitioning (no swap)
- Setup wizard now auto-launches on TTY1 via getty override instead
  of a separate systemd service that competed with console output
- Add step 1/7: prompt user to change default zroc password on first boot
- Update Makefile for QEMU-based build (was referencing old ovftool flow)
- Add backend package-lock.json for Docker build

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 09:59:17 -04:00

36 lines
1.1 KiB
Bash

#!/usr/bin/env bash
# zroc-ova/scripts/03-setup-wizard.sh
set -euo pipefail
echo "==> [03-setup-wizard] Installing setup wizard"
# The Packer file provisioner copies overlays/ to /tmp/overlays/
# Mirror the full directory tree into place
cp -r /tmp/overlays/usr /
chmod 0755 /usr/local/bin/zroc-setup
# Override getty on tty1 to run the setup wizard on first boot.
# Once .env exists the override is removed and normal getty resumes.
mkdir -p /etc/systemd/system/getty@tty1.service.d
cat > /etc/systemd/system/getty@tty1.service.d/zroc-firstboot.conf << 'EOF'
[Service]
ExecStartPre=/bin/sh -c '[ ! -f /opt/zroc/.env ] || { rm -f /etc/systemd/system/getty@tty1.service.d/zroc-firstboot.conf && systemctl daemon-reload && exit 1; }'
ExecStart=
ExecStart=-/usr/local/bin/zroc-setup
StandardInput=tty
StandardOutput=tty
StandardError=tty
TTYVTDisallocate=yes
Restart=always
RestartSec=3
EOF
systemctl daemon-reload
rm -f /etc/sudoers.d/zroc-packer
cat > /etc/sudoers.d/zroc << 'EOF'
zroc ALL=(ALL) NOPASSWD: /usr/bin/docker, /usr/local/bin/zroc-setup, /usr/bin/systemctl restart zroc
EOF
chmod 440 /etc/sudoers.d/zroc
echo "==> [03-setup-wizard] Done"