From 5ac8c244802174d83e3b29090366c1721d779fc4 Mon Sep 17 00:00:00 2001 From: nagumii Date: Sun, 5 Jan 2025 16:00:46 +0200 Subject: [PATCH] Remove deprecated scripts --- .../usr/local/bin/settime.sh.deprecated | 41 ------------------- .../local/bin/updatemeshtastic.sh.deprecated | 23 ----------- 2 files changed, 64 deletions(-) delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/settime.sh.deprecated delete mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/updatemeshtastic.sh.deprecated diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/settime.sh.deprecated b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/settime.sh.deprecated deleted file mode 100644 index d7ea59e..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/settime.sh.deprecated +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -# Function to log both to the screen and syslog -log_message() { - echo "USB config: $1" # Echo to the screen - logger "USB config: $1" # Log to the system log - echo "$(date +"%Y-%m-%d %H:%M:%S") $1" >> /tmp/femtofox-config.log # Log to file -} - -# Check if the RTC (Real-Time Clock) has a valid time -if [[ $(hwclock -r) ]]; then - log_message "Got time from RTC: $(hwclock -r)" # Output the time obtained from the RTC - time="$(hwclock -r)" # Store the RTC time in the 'time' variable - hwclock -s # Set the system time from the RTC time -fi - -# Check if we can get the time from a network source (e.g., google.com) -if [[ ! $(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g') ]]; then - log_message "Could not get time from network" # If no time is obtained, print an error message -else - # Get the time from the network and store it in the 'time' variable - time="$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g')" - log_message "Got time from network: ${time}" # Output the time obtained from the network - date -s "${time}" # Set the system time from the network time -fi - -# If no time is set yet, fall back to a default date -if [[ -z ${time} ]]; then - log_message "Could not get time from any source. Setting to Jan 1 2024." # Inform the user of the fallback date - date -s "1 JAN 2024 00:00:00" # Set the system time to January 1st, 2024 -fi - -# Check if the RTC device exists -if [[ -z /dev/rtc* ]]; then - log_message "No RTC found" # If no RTC device is found, print an error message -else - log_message "RTC found, setting time from system clock" # If an RTC is found, set its time from the system clock - hwclock -w # Write the system time to the RTC -fi - -exit 0 # Exit the script successfully diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/updatemeshtastic.sh.deprecated b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/updatemeshtastic.sh.deprecated deleted file mode 100644 index bfe619a..0000000 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/updatemeshtastic.sh.deprecated +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -command="$1" -attempts=$2 -ref="$3: " -echo "Submitting to Meshtastic..." -for retries in $(seq 1 $attempts); do - - output=$(meshtastic --host 127.0.0.1 $command) #>&2 lets meshtastic's output display on screen - echo $output - logger $output - if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno"; then - if [ "$retries" -lt $attempts ]; then - msg="${ref:+$ref }Meshtastic update failed, retrying ($(($retries + 1))/$attempts)..." - echo "$msg" - logger "$msg" - sleep 2 # Add a small delay before retrying - fi - else - exit 0 #success - break - fi -done -exit 1 #failed