Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
e91e305
Offer conversion to MultiCam data structure during RMS_FirstRun
Cybis320 Jun 10, 2026
3bfa583
Support CSV-driven station creation in add_GStation.sh
Cybis320 Jun 10, 2026
345c12d
Unify station tooling into a universal add_Station.sh
Cybis320 Jun 10, 2026
0ec29a7
Prompt for station ID and coordinates directly in RMS_FirstRun
Cybis320 Jun 10, 2026
d26f89d
Clean up inherited quirks in the first-run and capture scripts
Cybis320 Jun 10, 2026
78f5893
Add stations_template.csv as a sample for bulk station creation
Cybis320 Jun 10, 2026
9190612
Fix capture startup for FirstRun conversions on PCs
Cybis320 Jun 10, 2026
02f77aa
Move add_Station.sh up to Scripts/
Cybis320 Jun 10, 2026
b679a42
Update Scripts/README.md for the universal station tooling
Cybis320 Jun 10, 2026
65e1889
Make the conversion copy-only: add_Station never modifies ~/source/RMS
Cybis320 Jun 10, 2026
9893722
Auto-detect and expand an undersized root file system in RMS_FirstRun
Cybis320 Jul 28, 2026
a1d321e
Make RMS_StartCapture.sh handle both data structures
Cybis320 Jul 28, 2026
5d50987
Fix the expansion check flagging large cards as unexpanded forever
Cybis320 Aug 3, 2026
bf655e9
Validate station ID entries and harden the prompts against stray input
Cybis320 Aug 3, 2026
b2aae71
Pause for review before the file system expansion reboot
Cybis320 Aug 4, 2026
d7b4e69
Recompute reboot_after_processing from the station count on every run
Cybis320 Aug 4, 2026
d0fe849
Clean up legacy launch entry names and match nonstandard IDs in GRMSU…
Cybis320 Aug 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,6 @@ Catalogs/GMN_StarCatalog_LM12.0.bin

# Agents
.agents/
skills-lock.json
skills-lock.json
# Station list for Scripts/MultiCamLinux/add_GStation.sh
stations.csv
4 changes: 3 additions & 1 deletion Scripts/MultiCamLinux/GRMSUpdater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,9 @@ fi
mapfile -t RunList < <(
pgrep -f "Scripts/MultiCamLinux/StartCapture.sh" | while read -r pid; do
cmdline=$(ps -p "$pid" -o args= 2>/dev/null || continue)
if [[ "$cmdline" =~ Scripts/MultiCamLinux/StartCapture\.sh[[:space:]]+([[:alnum:]]{6}) ]]; then
# Station IDs are normally 6 alphanumerics, but add_Station.sh
# also accepts underscores/hyphens and other lengths on request
if [[ "$cmdline" =~ Scripts/MultiCamLinux/StartCapture\.sh[[:space:]]+([[:alnum:]_-]+) ]]; then
echo "${BASH_REMATCH[1]}"
fi
done | sort -u
Expand Down
21 changes: 4 additions & 17 deletions Scripts/MultiCamLinux/Pi/RMS_StartCapture_MCP.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
#!/bin/bash

seconds=70
echo " Starting all configured stations post-update..."

loop=0
for Dir in ~/source/Stations/*
do
Station=$(basename $Dir)
echo " Starting camera ${Station}"
lxterminal --title=${Station} -e "$HOME/source/RMS/Scripts/MultiCamLinux/StartCapture.sh ${Station}" &
echo " waiting $seconds seconds..."
sleep ${seconds}
if [[ $loop = 0 ]] ; then
seconds=10
fi
let loop++
done
echo " All cameras started"
# Kept for compatibility with Desktop shortcuts created by older
# installs - RMS_StartCapture.sh now handles the multi-camera data
# structure directly
exec ~/source/RMS/Scripts/RMS_StartCapture.sh "$@"
309 changes: 3 additions & 306 deletions Scripts/MultiCamLinux/Pi/add_Pi_Station.sh
Original file line number Diff line number Diff line change
@@ -1,307 +1,4 @@
#!/bin/bash
# This software is part of the Linux port of RMS
# Copyright (C) 2023 Ed Harman
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Version 1.8 - replaced Desktop link with one that starts all captures
#
# Version 1.7 - changed desktop launcher display names and added conkyrc1 mod
#
# Version 1.6 - added support for RPi-5 platforms that can run max 4 cameras
#
# Version 1.5 - added support for non English locales where user user directories may not include a directory named Desktop
# i.e. this enables support of RMS on a non English distro install
#
# Version 1.4 - moved codebase into RMS/Scripts/MultiCamLinux
#
# Version 1.3 - fixed path to CMN desktop shortcut
#
# Version 1.2 - added a change to the flag reboot_after_processing from true to false
#
# Version 1.1
# Changes - added station arguments to Launch scripts
# - changed desktop links for StartCapture to symbolic links of the scripts within .config/autostart
#
# Version 1.2 - Peter E. took over dev of this script and any blame going forward
# - white space and indents added
#

MaxStation=4 # maximum number of stations allowed on a Pi5

if [[ $(uname -m ) == aarch64 ]]
then
Model=$(lscpu| grep -o 'Cortex.*'|grep -o '[0-9]*')
if [[ $Model -lt 76 ]] # RPi5 uses Cortex A76 - use 72 for script testing on an RPi4
then
echo "This platform will not support multiple cameras, an RPi5 or similar is required"
exit
fi

DefStation=$(awk ' /stationID:/ {print toupper($2)}' ~/source/RMS/.config) # force uppercase
if [[ $DefStation == XX0001 && ! -d ~/source/Stations/ ]]
then
echo "Please run RMS_Firstrun and configure your 1st station"
echo "then if you wish to configure additional stations execute add_Pi_Station again"
exit
fi
if [[ ! -d ~/source/Stations/ ]]
then

cat <<EOF

Multiple cameras are supported by relocating the default camera configuration files -
- .config
- platepar_cmn2010.cal
- mask.bmp

from their default location of ~/source/RMS -to a folder located at -

~/source/Stations/<StationID>

It appears you have already configured your first station - id ${DefStation}
so its config files will now be relocated to -
~/source/Stations/${DefStation}
Captured data from your default station are stored by default in

~/RMS_data

This data will be moved to -
~/RMS_data/${DefStation}
EOF

# First station has been configured, so move it to ~/source/Stations/<station-ID>,
# and move any captured data to ~/RMS_data/<station-ID>.

# tweak conky station title
sed -i 's/\(source\)\/RMS/\1\/Stations\/'"$DefStation"'/g' /home/rms/.conkyrc1
# tweak conky data source path for log data
sed -i "s/\(.*RMS_data\)/\1\/${DefStation}/g" /home/rms/.conkyrc1

mkdir ~/source/Stations/
mkdir ~/source/Stations/${DefStation}
cp ~/source/RMS/.config ~/source/Stations/${DefStation}
cd ~/source/RMS
sed -i "s,data_dir.*$,data_dir: ~/RMS_data/${DefStation},g" ~/source/Stations/${DefStation}/.config
if [[ -e ~/source/RMS/platepar_cmn2010.cal ]]
then
mv ~/source/RMS/platepar_cmn2010.cal ~/source/Stations/${DefStation}/
fi
if [[ -e ~/source/RMS/mask.bmp ]]
then
mv ~/source/RMS/mask.bmp ~/source/Stations/${DefStation}/
#replace with copy from master
cd ~/source/RMS
wget -q https://raw.githubusercontent.com/CroatianMeteorNetwork/RMS/master/mask.bmp
fi
mkdir ~/RMS_data/${DefStation}
cd ~/RMS_data/${DefStation}
mv ../ArchivedFiles .
mv ../CapturedFiles .
mv ../logs .

cat <<- EOF > ~/Desktop/${DefStation}_StartCapture.desktop
[Desktop Entry]
Name=${DefStation}-StartCapture
Type=Application
Exec=lxterminal --title=${DefStation} -e "~/source/RMS/Scripts/MultiCamLinux/StartCapture.sh ${DefStation}"
Hidden=false
NoDisplay=false
Icon=lxterminal
EOF
chmod +x ~/Desktop/${DefStation}_StartCapture.desktop

cat <<- EOF > ~/Desktop/${DefStation}-Show_LiveStream.desktop
[Desktop Entry]
Name=${DefStation}-ShowLiveStream
Type=Application
Exec=lxterminal --title=${DefStation}-LiveStream -e "~/source/RMS/Scripts/MultiCamLinux/LiveStream.sh ${DefStation}"
Hidden=false
NoDisplay=false
Icon=lxterminal
EOF
chmod +x ~/Desktop/${DefStation}-Show_LiveStream.desktop

# Check if the user's desktop directory environment variable is set
if [ -n "$xdg-user-dir DESKTOP" ]
then
Desktop=`xdg-user-dir DESKTOP`
fi

# cleanup erroneous Desktop shortcuts
if [[ -f ~/Desktop/RMS_FirstRun.sh ]]
then
rm ~/Desktop/CMNbinViewer.sh ~/Desktop/RMS_ShowLiveStream.sh ~/Desktop/RMS_StartCapture.sh
rm ~/Desktop/RMS_config.txt ~/Desktop/TunnelIPCamera.sh ~/Desktop/DownloadOpenVPNconfig.sh
fi

# remove comment from last line of wayfire.ini to enable window cascade
sed -i s/#mode/mode/ ~/.config/wayfire.ini

fi # if [[ ! -d ~/source/Stations/ ]]

fi # if [[ $(uname -m ) == aarch64 ]]

# need to count the number of directories under ~/source/Stations and only
# prompt for adding the correct number of new cameras, so subtract that number
# from MaxStation defined above

numdirs=$(find ~/source/Stations/ -maxdepth 1 -type d | wc -l)
numdirs=$((numdirs-1))
Remaining=$((MaxStation-numdirs))
#echo MaxStation:$MaxStation NumDirs:$numdirs Remaining:$Remaining

declare Station
while :
do
if [[ ${#Station[@]} == $Remaining ]]
then
echo ""
echo "Done, This platform has a maximum of $numdirs cameras"
break
fi
read -p "Enter station ID, <cr> to end: " this_Station
this_Station="${this_Station^^}" #uppercase it..
if [[ -z $this_Station ]]
then
break
fi
Station+=("$this_Station")
# echo $Station
done

echo -e "\nNew stations to add -"
printf '%s\n' "${Station[@]}"

# check if ~/${RMS_data} exists and if not create it....
if [[ ! -d "${RMS_data}/" ]]
then
mkdir ${RMS_data}
fi

No_Stations=${#Station[@]}
for item in "${Station[@]}"
do
if [[ -d ~/source/Stations/${item} ]]
then
echo -e "\n\nNot creating station ${item} - it already exists\n"
exit
else
echo "making dir Stations/${item}"
mkdir ~/source/Stations/${item}
if [[ ! -d ${RMS_data}/$item ]]
then
mkdir ~/RMS_data/${item}
fi
fi

cp ~/source/RMS/.config ~/source/Stations/${item}

# create autostart entry for the station
cat <<- EOF > ~/Desktop/${item}_StartCapture.desktop
[Desktop Entry]
Name=${item}-StartCapture
Type=Application
Exec=lxterminal --title=${item} -e "~/source/RMS/Scripts/MultiCamLinux/StartCapture.sh ${item}"
Hidden=false
NoDisplay=false
Icon=lxterminal
EOF
chmod +x ~/Desktop/${item}_StartCapture.desktop

if [[ -e ~/source/RMS/mask.bmp ]]
then
cp ~/source/RMS/mask.bmp ~/source/Stations/${item}/
fi

# create a ShowLiveStream-<station and a desktop shortcut
cat <<- EOF > ~/Desktop/${item}-Show_LiveStream.desktop
[Desktop Entry]
Name=${item}-ShowLiveStream
Type=Application
Exec=lxterminal --title=Stream-${item} -e "~/source/RMS/Scripts/MultiCamLinux/LiveStream.sh ${item}"
Hidden=false
NoDisplay=false
Icon=lxterminal
EOF
chmod +x ~/Desktop/${item}-Show_LiveStream.desktop

# customise each .config
# set the station_id
sed -i "s/D:.*$/D: $item/g" ~/source/Stations/${item}/.config
# set the ${RMS_data} dir
sed -i "s,data_dir.*$,data_dir: ~/RMS_data/${item},g" ~/source/Stations/${item}/.config
echo -e "\n\nAdded station $item\n\n"
# disable daily post processing reboot
sed -i "s/\(reboot_after_processing:\).*/\1 false/g" ~/source/Stations/${item}/.config
done

# check if keys are already present
if [[ -f ~/.ssh/id_rsa ]]
then
if [ ! -z ${Configured} ]
then
echo "SSH keys already exist, not overwriting them"
fi
else
ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -P ""
cp ~/.ssh/id_rsa.pub ~/Desktop
echo "SSH keys successfully generated in ~/.ssh"
echo "your new id_rsa.pub public key file now placed on the Desktop"
echo "Be sure to send a copy of this file to Denis"
fi

if [[ ! -v Model ]]
then
timedatectl set-timezone UTC
fi

echo -e "\n\nStation configuration complete\n\n"
user=`id -u -n`

# Set up shortcut for CMNbinViewer
cat <<- EOF > ~/Desktop/CMNbinViewer.desktop
[Desktop Entry]
Name=CMNbinViewer
Type=Application
Exec=/home/${user}/source/RMS/Scripts/CMNbinViewer_env.sh
Hidden=false
NoDisplay=false
Icon=/home/${user}/source/RMS/Scripts/MultiCamLinux/icon.png
EOF
chmod +x ~/Desktop/CMNbinViewer.desktop

# set the option to allow launching of desktop shortcuts
#sed -i s/quick_exec=0/quick_exec=1/ ~/.config/libfm/libfm.conf

if grep -Fqv "UTC" /etc/timezone
then
sudo timedatectl set-timezone UTC
fi

# set the extra_space for all configured stations -
mult=$(ls -1 /home/${USER}/source/Stations/|wc -l)
for Dir in /home/${USER}/source/Stations/*
do
sed -i "s/extra_space_gb: .*$/extra_space_gb: $(( ${mult} * 30 ))/g" ${Dir}/.config
done

# set up so RMS_FirstRun can autostart all captures
rm -f /home/${USER}/Desktop/RMS_StartCapture.sh
ln -s /home/${USER}/source/RMS/Scripts/MultiCamLinux/Pi/RMS_StartCapture_MCP.sh /home/${USER}/Desktop/RMS_StartCapture.sh

# get a copy of the default .config
cd ~/source/RMS
rm .config #delete potentially modified .config and replace with new..
wget -q https://raw.githubusercontent.com/CroatianMeteorNetwork/RMS/master/.config
# Kept for compatibility with existing documentation and older images.
# The station tooling is now universal - see add_Station.sh.
exec "$(dirname "$0")/../../add_Station.sh" "$@"
13 changes: 0 additions & 13 deletions Scripts/MultiCamLinux/StartCapture.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,6 @@
# second command line arg is optional, can be used to adjust the sleep time in seconds
# so that there can be a delay between starting each station

delay_by_station_sequence() {

# implement a delay based on position of station in directory
# this is not used presently

delay=$(ls /home/$(whoami)/source/Stations/ | grep -n $1 | cut -d':' -f1)
delay=$((delay*30))
echo Additional $delay second delay will be added.
sleep $delay

}


if [[ -z "$1" ]] # called with no args
then
echo " No Station directory specified, quitting now"
Expand Down
Loading