Massive updates, added install for nc binary

This commit is contained in:
2026-02-27 19:09:47 -06:00
parent 031ad72f59
commit 7cbcf806e4
5 changed files with 53 additions and 24 deletions

View File

@@ -5,14 +5,6 @@
. /recalbox/share/system/config/savesync/savesync.conf
# --- MQTT Publish Function ---
mqtt_publish() {
local msg="$1"
}
# --- Logger Function ---
log() {
local timestamp
@@ -22,20 +14,24 @@ log() {
timestamp=$(date '+%Y-%m-%d %H:%M:%S')
local log_line="[$timestamp] [$level] $msg"
mosquitto_pub -h 127.0.0.1 -p 1883 -t /Recalbox/EmulationStation/Event "SaveLog=${log_line}"
mosquitto_pub -h 127.0.0.1 -p 1883 -t "$TOPIC" "SaveLog=${log_line}"
# printf "%s\n" "$log_line" >> "$LOG_FILE" 2>/dev/null
[ "$DEBUG_MODE" -eq 1 ] && printf "%s\n" "$log_line"
}
# --- Continue message function ---
send_continue() {
mosquitto_pub -h 127.0.0.1 -p 1883 -t /Recalbox/EmulationStation/Event "SaveContinue=1"
}
# --- Sleep to ensure that the logger daemon has started ---
#
log "INFO" "--- ES Event Daemon Started ---"
# --- Main Listener Loop ---
mosquitto_sub -h 127.0.0.1 -p 1883 -t /Recalbox/EmulationStation/Event | while IFS="=" read -r key value
mosquitto_sub -h 127.0.0.1 -p 1883 -t "$TOPIC" | while IFS="=" read -r key value
do
# 1. Clean Carriage Returns from Windows-style line endings
value=$(echo "$value" | tr -d '\r')
@@ -74,6 +70,7 @@ do
rclone update "$remote_full" "$this_save_path"
fi
mosquitto_pub -h 127.0.0.1 -p 1883 -t "$TOPIC" "SaveContinue=0"
elif [ "$this_state" = "endgame" ]; then
log "INFO" "Game Ended. Backing up save..."
filename=$(basename "$this_save_path")
@@ -82,6 +79,8 @@ do
# Push the local save to the cloud if it's newer
rclone update "$this_save_path" "$REMOTE_BASE/$this_system_id/"
log "INFO" "Sync Complete."
mosquitto_pub -h 127.0.0.1 -p 1883 -t "$TOPIC" "SaveContinue=0"
fi
# Reset variables for the next event block