Fix smoke test redirects and default updates to stable

This commit is contained in:
Aaron
2026-01-02 23:45:47 -05:00
parent b01c2ba737
commit 9c3156df35
4 changed files with 31 additions and 9 deletions

View File

@@ -101,3 +101,4 @@ Use the helper:
- Keep `RESCUE.md` in `/root` and `/home/dietpi` only (not in `/var/www`). - Keep `RESCUE.md` in `/root` and `/home/dietpi` only (not in `/var/www`).
- Prep enforces a password change for `dietpi` on first login; set `PIKIT_FORCE_PASSWORD_CHANGE=0` to skip. - Prep enforces a password change for `dietpi` on first login; set `PIKIT_FORCE_PASSWORD_CHANGE=0` to skip.
- After the password change, a onetime SSH hardening tip is shown on login. - After the password change, a onetime SSH hardening tip is shown on login.
- End-user defaults: auto updates off, stable release channel; both can be changed in the dashboard.

View File

@@ -250,6 +250,8 @@ prep_image() {
clean_file /etc/pikit/certs/pikit.local.csr clean_file /etc/pikit/certs/pikit.local.csr
clean_file /var/www/pikit-web/assets/pikit-ca.crt clean_file /var/www/pikit-web/assets/pikit-ca.crt
clean_file /var/www/pikit-web/assets/pikit-ca.sha256 clean_file /var/www/pikit-web/assets/pikit-ca.sha256
clean_file /var/lib/pikit-update/state.json
clean_file /var/run/pikit-update.lock
# --- Backup/editor cruft --- # --- Backup/editor cruft ---
clean_backups /var/www/pikit-web clean_backups /var/www/pikit-web
@@ -531,6 +533,8 @@ check_image() {
check_file_missing /etc/pikit/certs/pikit.local.key check_file_missing /etc/pikit/certs/pikit.local.key
check_file_missing /var/www/pikit-web/assets/pikit-ca.crt check_file_missing /var/www/pikit-web/assets/pikit-ca.crt
check_file_missing /var/www/pikit-web/assets/pikit-ca.sha256 check_file_missing /var/www/pikit-web/assets/pikit-ca.sha256
check_file_missing /var/lib/pikit-update/state.json
check_file_missing /var/run/pikit-update.lock
section "Logs" section "Logs"
if [ -d /var/log ]; then if [ -d /var/log ]; then

View File

@@ -126,28 +126,45 @@ check_https() {
check_api() { check_api() {
local url="$1" local url="$1"
local body local body
if ! body="$(curl -fsS --max-time 5 "$url")"; then if ! body="$(curl -kfsSL --max-time 5 "$url")"; then
status FAIL "API not reachable: $url" status FAIL "API not reachable: $url"
return return
fi fi
local ok if command -v python3 >/dev/null 2>&1; then
ok="$(printf "%s" "$body" | json_get "services" || true)" if printf "%s" "$body" | python3 - <<'PY'
if [ -n "$ok" ]; then import json, sys
try:
data = json.load(sys.stdin)
except Exception:
sys.exit(1)
for key in ("services", "hostname", "uptime_seconds"):
if key in data:
sys.exit(0)
sys.exit(1)
PY
then
status OK "API responds with JSON" status OK "API responds with JSON"
else else
status WARN "API response did not include expected fields" status WARN "API response did not include expected fields"
fi fi
else
status WARN "python3 missing; API JSON check skipped"
fi
} }
check_firstboot() { check_firstboot() {
local url="$1" local url="$1"
local body state error_present local body state error_present
if ! body="$(curl -fsS --max-time 5 "$url")"; then if ! body="$(curl -kfsSL --max-time 5 "$url")"; then
status FAIL "firstboot API not reachable" status FAIL "firstboot API not reachable"
return return
fi fi
state="$(printf "%s" "$body" | json_get "state" || true)" state="$(printf "%s" "$body" | json_get "state" || true)"
error_present="$(printf "%s" "$body" | json_get "error_present" || true)" error_present="$(printf "%s" "$body" | json_get "error_present" || true)"
if [ -z "$state" ]; then
status FAIL "firstboot status invalid or missing"
return
fi
if [ "$state" = "done" ] && [ "$error_present" != "true" ]; then if [ "$state" = "done" ] && [ "$error_present" != "true" ]; then
status OK "firstboot completed" status OK "firstboot completed"
else else

View File

@@ -90,10 +90,10 @@ def load_update_state() -> Dict[str, Any]:
"last_check": None, "last_check": None,
"status": "unknown", "status": "unknown",
"message": "", "message": "",
"auto_check": False, "auto_check": True,
"in_progress": False, "in_progress": False,
"progress": None, "progress": None,
"channel": os.environ.get("PIKIT_CHANNEL", "dev"), "channel": os.environ.get("PIKIT_CHANNEL", "stable"),
"changelog_url": None, "changelog_url": None,
"latest_release_date": None, "latest_release_date": None,
"current_release_date": None, "current_release_date": None,