Fix six bugs found in final audit

montage-mvt.sh, year-end-join.sh: CAM_NAME fallback referenced undefined
\$CAM_NAME — crashes under set -euo pipefail on manual runs without args.
Fixed to fall back to \$SUNRISE_CAM (same fix applied earlier to other scripts).

notify.sh: Mattermost notification guard only checked MM_NOTIFY_CHANNEL_ID,
not mattermost_url or access_token. If those are unset, curl would send a
malformed request silently. Added guards for all three required values.

install.sh: seasons/fullday service units had literal \n in After=/Wants=
lines because bash does not interpret \n in heredoc variable expansions.
Changed to \$'...' syntax so actual newlines are written, making valid
systemd unit files. Also: audio capture timer now uses \$SCHEDULE_SUNRISE
instead of hardcoded 03:00, keeping it in sync if the user changes the
schedule.

sunrise-audio-capture.sh: record_start_sec could theoretically go negative
(sunrise very early + large SUNRISE_TARGET_SECS). Added floor-at-zero guard.

daily_sunrise_video.sh: added comment explaining why audio_offset is always 0.

README.md: fix CAM_RTSP_sunrise example to CAM_RTSP_east.

https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
Claude
2026-04-20 01:01:25 +00:00
parent 64cec6b769
commit 8b9ad74c58
7 changed files with 10 additions and 8 deletions
+4 -3
View File
@@ -144,14 +144,15 @@ EOF
done
# ── Sunrise audio capture ─────────────────────────────────────────────────────
# Triggered at 03:00; waits internally until the right time before recording.
# Uses the same schedule as the sunrise video — both start early and wait
# internally for the right moment, so they don't interfere.
if [ "${AUDIO_ENABLED:-false}" = "true" ]; then
write_service "sky-cam-audio-capture" \
"$SUNRISE_CAM: sunrise audio capture" \
"sunrise-audio-capture.sh"
write_timer "sky-cam-audio-capture" \
"$SUNRISE_CAM: sunrise audio capture" \
"03:00:00"
"$SCHEDULE_SUNRISE"
timers+=("sky-cam-audio-capture")
fi
@@ -166,7 +167,7 @@ for cam in "${CAMERAS[@]}"; do
write_service "sky-cam-seasons-${cam}" \
"${cam}: Four Seasons daily clip" \
"4-seasons.sh ${cam}" \
"After=network-online.target\nWants=network-online.target\n"
$'After=network-online.target\nWants=network-online.target\n'
write_timer "sky-cam-seasons-${cam}" "${cam}: Four Seasons daily clip" \
"${!sched_seasons_var}"
timers+=("sky-cam-seasons-${cam}")