Skip to content

Commit ae2f760

Browse files
Merge pull request #1026 from yasinBursali/fix/installer-writes-setup-complete
fix(installer): pre-mark setup wizard complete on successful install
2 parents 081f8a1 + ac3b04b commit ae2f760

4 files changed

Lines changed: 63 additions & 0 deletions

File tree

dream-server/installers/macos/install-macos.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,6 +1207,22 @@ else
12071207
ai_warn "Perplexica auto-config skipped -- complete setup at http://localhost:3004"
12081208
fi
12091209

1210+
# ── Pre-mark setup wizard complete ──
1211+
# The dashboard-api reads ${INSTALL_DIR}/data/config/setup-complete.json
1212+
# (mounted at /data/config/setup-complete.json inside the container) to
1213+
# decide first_run state. Writing this here prevents the wizard from
1214+
# reappearing on every visit after a fresh install. Non-fatal.
1215+
_setup_config_dir="${INSTALL_DIR}/data/config"
1216+
_setup_complete_file="${_setup_config_dir}/setup-complete.json"
1217+
_completed_at=$(date -u +%Y-%m-%dT%H:%M:%SZ)
1218+
if mkdir -p "${_setup_config_dir}" 2>/dev/null \
1219+
&& printf '{"completed_at": "%s", "version": "1.0.0"}\n' "${_completed_at}" > "${_setup_complete_file}" 2>/dev/null \
1220+
&& chmod 644 "${_setup_complete_file}" 2>/dev/null; then
1221+
ai_ok "Setup wizard pre-marked complete"
1222+
else
1223+
ai_warn "Could not write ${_setup_complete_file} (non-fatal)"
1224+
fi
1225+
12101226
# ── Success card ──
12111227
if ! $ALL_HEALTHY; then
12121228
echo ""

dream-server/installers/phases/13-summary.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@ fi
4747
# Show the cinematic success card
4848
show_success_card "http://localhost:3000" "http://localhost:3001" "$LOCAL_IP"
4949

50+
# Mark the setup wizard as already completed for fresh installs. The
51+
# dashboard-api reads this file (container path /data/config/setup-complete.json,
52+
# mounted from ${INSTALL_DIR}/data) to decide first_run state; without it the
53+
# wizard reappears on every visit after a fresh install. Non-fatal — if the
54+
# write fails, the wizard simply shows once.
55+
if ! $DRY_RUN; then
56+
_setup_config_dir="${INSTALL_DIR}/data/config"
57+
_setup_complete_file="${_setup_config_dir}/setup-complete.json"
58+
_completed_at=$(date -u +%Y-%m-%dT%H:%M:%SZ)
59+
if mkdir -p "${_setup_config_dir}" 2>/dev/null \
60+
&& printf '{"completed_at": "%s", "version": "1.0.0"}\n' "${_completed_at}" > "${_setup_complete_file}" 2>/dev/null \
61+
&& chmod 644 "${_setup_complete_file}" 2>/dev/null; then
62+
log "Setup wizard pre-marked complete at ${_setup_complete_file}"
63+
else
64+
ai_warn "Could not write ${_setup_complete_file} (non-fatal)"
65+
fi
66+
fi
67+
5068
# Check background tasks before showing additional info
5169
if [[ -f "$SCRIPT_DIR/installers/lib/background-tasks.sh" ]]; then
5270
. "$SCRIPT_DIR/installers/lib/background-tasks.sh"

dream-server/installers/windows/install-windows.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,23 @@ if ($allHealthy) {
891891
Write-SuccessCard
892892
}
893893

894+
# ── Pre-mark setup wizard complete ────────────────────────────────────────────
895+
# The dashboard-api reads ${INSTALL_DIR}/data/config/setup-complete.json
896+
# (mounted at /data/config/setup-complete.json inside the container) to decide
897+
# first_run state. Writing this here prevents the wizard from reappearing on
898+
# every visit after a fresh install. Non-fatal.
899+
try {
900+
$setupConfigDir = Join-Path $installDir "data\config"
901+
$setupCompleteFile = Join-Path $setupConfigDir "setup-complete.json"
902+
New-Item -Path $setupConfigDir -ItemType Directory -Force | Out-Null
903+
$completedAt = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
904+
$payload = @{ completed_at = $completedAt; version = "1.0.0" } | ConvertTo-Json -Compress
905+
Set-Content -Path $setupCompleteFile -Value $payload -Encoding UTF8
906+
Write-AISuccess "Setup wizard pre-marked complete"
907+
} catch {
908+
Write-AIWarn "Could not write setup-complete.json (non-fatal): $_"
909+
}
910+
894911
# ── Summary JSON (for CI / automation) ───────────────────────────────────────
895912
if ($SummaryJsonPath) {
896913
$summary = @{

dream-server/tests/contracts/test-installer-contracts.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,16 @@ if grep -q 'cdn.jsdelivr.net/npm/chart.js\|cdn.jsdelivr.net/npm/chartjs-adapter-
6767
exit 1
6868
fi
6969

70+
echo "[contract] installers pre-mark setup wizard complete"
71+
# All three installers must write data/config/setup-complete.json at install time
72+
# so the dashboard wizard doesn't reappear on every visit after a fresh install.
73+
# dashboard-api reads this file (container path /data/config/setup-complete.json,
74+
# mounted from ${INSTALL_DIR}/data) to decide first_run state.
75+
grep -q 'data/config/setup-complete.json' installers/phases/13-summary.sh \
76+
|| { echo "[FAIL] Linux phase 13 does not write data/config/setup-complete.json"; exit 1; }
77+
grep -q 'data/config/setup-complete.json' installers/macos/install-macos.sh \
78+
|| { echo "[FAIL] macOS installer does not write data/config/setup-complete.json"; exit 1; }
79+
grep -q 'data\\\\config\\\\setup-complete.json\|setup-complete.json' installers/windows/install-windows.ps1 \
80+
|| { echo "[FAIL] Windows installer does not write setup-complete.json"; exit 1; }
81+
7082
echo "[PASS] installer contracts"

0 commit comments

Comments
 (0)