diff --git a/install.sh b/install.sh index a4bb3a3..9128c20 100755 --- a/install.sh +++ b/install.sh @@ -202,8 +202,16 @@ env_example="$HERE/.env.example" echo "# .env is gitignored and never checked in." echo "" echo "# RTSP stream URLs — one line per camera (variable name = CAM_RTSP_)" + echo "#" + echo "# Use single quotes around the whole value to prevent shell interpretation." + echo "# Special characters in the PASSWORD part of the URL must be URL-encoded:" + echo "# @ -> %40 : -> %3A / -> %2F # -> %23" + echo "# ! -> %21 \$ -> %24 & -> %26 % -> %25" + echo "# + -> %2B = -> %3D space -> %20" + echo "# Example: password p@ss!word becomes p%40ss%21word in the URL." + echo "" for cam in "${CAMERAS[@]}"; do - echo "CAM_RTSP_${cam}=rtsp://admin:PASSWORD@192.168.1.XXX:554/stream1" + echo "CAM_RTSP_${cam}='rtsp://admin:PASSWORD@192.168.1.XXX:554/stream1'" done echo "" echo "# Mattermost upload" @@ -218,6 +226,16 @@ env_example="$HERE/.env.example" } > "$env_example" echo " wrote .env.example (cp .env.example .env then fill in real values)" +# ── User-session prerequisites (non-system installs only) ──────────────────── +if ! $SYSTEM_MODE; then + # Make systemctl --user reachable when run outside a login session + export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}" + # Start user services at boot even without an interactive login + loginctl enable-linger "$USER" \ + && echo " loginctl enable-linger: ok" \ + || echo " WARNING: loginctl enable-linger failed (may need to run manually)" +fi + # ── Reload and enable ───────────────────────────────────────────────────────── echo "" $SC daemon-reload