Universal station tooling: multi-camera conversion in FirstRun, unified StartCapture - #948
Open
Cybis320 wants to merge 17 commits into
Open
Universal station tooling: multi-camera conversion in FirstRun, unified StartCapture#948Cybis320 wants to merge 17 commits into
Cybis320 wants to merge 17 commits into
Conversation
RMS_FirstRun now offers a double-confirmed step 5 that converts new installs to the Stations data structure by chaining to add_Pi_Station.sh. add_Pi_Station.sh changes: - Support single-camera platforms (RPi4 and older) with MaxStation=1 instead of refusing to run; skip multi-camera-only tweaks (wayfire cascade, reboot disable, extra_space scaling) on those systems - Migrate camera_settings.json to the station folder and point camera_settings_path at it - Move all existing captured data (including hidden files) with find instead of a hardcoded list, avoiding the mv-into-itself error - Restore pristine defaults via git checkout with a wget fallback so an offline run cannot delete .config without a replacement - Add an Edit_configs desktop helper for editing station configs RMS_StartCapture_MCP.sh starts a single-camera system with a 2 s delay instead of 70 s; the long delay is only needed to serialize first-start updates across multiple stations. Autorun is now enabled only after the optional conversion finishes so an interrupted conversion is not skipped over by the autorun path on the next boot.
Stations can now be created in bulk from a stations.csv file. The header row names the columns: station_id (required), camera_ip (spliced into the rtsp device URL), and any other .config key, which is applied verbatim to the station config. Usage: add_GStation.sh [RMS_data_path] [stations.csv] With no arguments the script uses ~/source/RMS/stations.csv if present (the file is gitignored), otherwise it falls back to the previous interactive prompts, so the GRMSL_Install.sh flow keeps working. Desktop and autostart entries now use gnome-terminal (an optional StartCapture profile customises the windows) instead of installing and configuring lxterminal. Robustness fixes over the old version: config seds are anchored at line start so commented examples are not rewritten, CSV fields are trimmed without xargs (handles CRLF endings and quotes in values), a final CSV row without a trailing newline is not dropped, and the CMNbinViewer icon points at the RMS copy instead of a cmn_binviewer path that only exists via an install-time symlink. The script is also slimmed down to station creation: the GNOME sleep/screen-lock prevention moved to RMS_Installer.sh as one-time machine setup (guarded for headless installs), the duplicated UTC timezone setting is dropped (RMS_Installer.sh already does it), and the interactive optional installs (pcmanfm, mousepad, AnyDesk), cron-based update scheduling, and AnyDesk Wayland workaround are removed.
add_Pi_Station.sh and add_GStation.sh duplicated the same station creation logic with platform assumptions baked in, and the copies had drifted (different extra_space factors, entry names, and bug fixes applied to one but not the other). Both are now thin compatibility wrappers around a single universal Scripts/MultiCamLinux/add_Station.sh that works on any Linux platform, Raspberry Pi included: - Platform detection reads /sys/firmware/devicetree/base/model instead of uname/lscpu, so 32-bit Pi installs are detected and can migrate too - The Pi camera limit (1, or 4 on a Pi5 or later) is now advisory: the script warns that it is the tested ceiling and lets the operator override it, instead of hard-stopping. Future more capable Pis and experiments are not blocked. Generic Linux has no limit, as before - The legacy single-camera relocation is universal, so a PC that was set up as a single camera can convert just like a Pi. Pi image cosmetics (conky, wayfire, image desktop shortcuts) only run when the files exist - Launch entries use whichever of lxterminal/gnome-terminal fits the desktop. On FirstRun-managed systems (the Pi images) captures are started by RMS_StartCapture_MCP.sh as before; elsewhere per-station XDG autostart entries start captures at login - CSV-driven bulk creation and the interactive prompts are available on every platform RMS_FirstRun.sh now offers the conversion on any platform that has not converted yet (the raspi-config step is skipped where raspi-config does not exist, and the config editor falls back to gedit/gnome-text-editor on GNOME), and chains to add_Station.sh, which shows the relocation details and asks the final confirmation. RMS_StartCapture_MCP.sh picks the terminal emulator the same way.
Instead of opening the whole .config in a GUI editor (leafpad, mousepad, or whatever the desktop provides) and grep-checking afterwards that the station ID was changed, FirstRun now asks for the four values it needs - station ID, latitude, longitude, elevation - right at the terminal, validates them (GMN code format with an override, numeric ranges for the coordinates), shows a summary to confirm or re-enter, and writes them into .config with anchored seds. EOF on any prompt aborts the script instead of looping. The RMS_config desktop shortcut remains the way to edit any other setting.
- RMS_FirstRun no longer overwrites an existing SSH key: the public half is already on file with GMN, so regenerating it on a re-run would silently break the data uploads. The Desktop link uses ln -sf so a re-run does not error either - The successful autorun path exits 0 instead of 1 - The updater is invoked directly from Scripts/ instead of through the Desktop symlink (the StartCapture symlink stays, it is retargeted by add_Station.sh on purpose) - The internet check falls back to an HTTP probe of github.com when ping is blocked, since GitHub is what the update needs to reach anyway - The init message no longer promises 10 seconds while sleeping 12 - Prompts that accepted any key to skip no longer claim Q is special - Removed the unused delay_by_station_sequence() from StartCapture.sh
The template shows the CSV format add_Station.sh reads: station_id, camera_ip, and any .config key as further columns (capture_wait_seconds here, which staggers the capture start across cameras). Copy it to ~/source/RMS/stations.csv (gitignored) and edit. The script's usage and error messages point to it.
The XDG-autostart-vs-Desktop-entry choice keyed on the autorun flag alone, but a PC that converts through RMS_FirstRun also carries that flag - and nothing launches FirstRun at boot on a PC, so such systems ended up with no automatic capture start at all. The Pi-image behavior (Desktop entry only, MCP starts captures at boot) now additionally requires Pi hardware; everything else gets autostart entries. The Desktop RMS_StartCapture.sh symlink is retargeted to the multi-camera launcher unconditionally - after any conversion the legacy script it pointed at would read the reset template config. Also create ~/.config/autostart and the Desktop dir inside create_station: the migration path runs before the main-flow mkdirs, so the autostart entry write could fail silently.
A universal tool does not belong in the MultiCamLinux subdirectory; it now sits next to RMS_Installer.sh and RMS_FirstRun.sh. The runtime launchers (StartCapture.sh, LiveStream.sh, RMS_StartCapture_MCP.sh) stay in MultiCamLinux/ because desktop entries on deployed systems reference those paths. Compatibility wrappers and FirstRun updated.
The legacy conversion used to mutate the repo working tree: it deleted the root .config and re-downloaded it from GitHub (leaving no config at all when offline), moved mask.bmp and platepar out, and the camera_settings.json move had been proposed too. None of that is the station tool's business - RMS_Update already owns the lifecycle of the root .config/mask.bmp/camera_settings.json (backup, reset, restore), and camera_settings.json is shared by all stations from the root by default (every station's camera_settings_path points there). The conversion now only COPIES .config, mask.bmp and platepar into ~/source/Stations/<ID> and moves the captured data under ~/RMS_data/<ID>. Nothing in ~/source/RMS is created, modified or deleted - no git commands, no downloads. The root files keep the operator's values and remain the templates for adding further stations.
Instead of walking the user through the raspi-config menus, measure the root file system against the device it lives on and offer a one-key expansion (raspi-config --expand-rootfs) followed by an automatic reboot. If the device is already fully used but below the 64 GB minimum, warn about it instead of offering an expansion that would do nothing. Based on Peter E.'s revised first-run proposal.
RMS_StartCapture.sh now detects the multi-camera structure (station directories under ~/source/Stations) and starts every configured station itself, staggered as before, falling back to the legacy single-camera start otherwise. RMS_StartCapture_MCP.sh becomes a compatibility wrapper for Desktop shortcuts created by older installs, and add_Station.sh no longer needs to retarget the Desktop entry after a conversion. Based on Peter E.'s revised proposal (RMS_StartCapture2.sh).
Contributor
|
I'll review this as soon as i can but not likely to be before 20th Aug as we're on holiday from 11th and i have a bunch of other GMN work to finish this week. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR packages the multi-camera data structure work proposed by Peter E. on the forum, submitted on his behalf. It is the "proper pull request" promised in the June revert (c91ba9e), updated with the improvements from Pete's revised proposal (his
Upgrade.zip).What this does
RMS_FirstRun.shraspi-config --expand-rootfsand reboots — no more navigating raspi-config menus. Warns if the device itself is below the 64 GB minimum.add_Station.sh.Scripts/add_Station.sh(new, universal — replaces the Pi/Linux split)~/source/Stations/<ID>, interactively or in bulk from a CSV (stations_template.csvsample included)..config,mask.bmpandplatepar_cmn2010.calare copied to the station directory and existing data is moved under~/RMS_data/<ID>. Nothing in~/source/RMSis modified — the conversion never deletes, rewrites or re-downloads files in the RMS root.add_Pi_Station.shandadd_GStation.shremain as thin compatibility wrappers, answering the naming concern Pete raised: the tool now lives atScripts/add_Station.sh. Renaming theMultiCamLinux/directory itself is left for later so deployed entry points keep working.Scripts/RMS_StartCapture.shRMS_StartCapture2.shproposed: if station directories exist under~/source/Stationsit starts each one in its own terminal (staggered 70 s on multi-camera systems so concurrent first-start updates cannot collide, 2 s when there is only one station); otherwise it starts the legacy single camera as before.RMS_StartCapture_MCP.shbecomes a compatibility wrapper, andadd_Station.shno longer needs to retarget the Desktop shortcut after a conversion.Testing
$HOMEwith shims) covering the legacy-to-multicam conversion, interactive station creation and the CSV bulk flow.Credits