diff --git a/ipk-source/sdxpinn-quecmanager-beta/CONTROL/control b/ipk-source/sdxpinn-quecmanager-beta/CONTROL/control index 7dd66cb..9ded64f 100755 --- a/ipk-source/sdxpinn-quecmanager-beta/CONTROL/control +++ b/ipk-source/sdxpinn-quecmanager-beta/CONTROL/control @@ -1,5 +1,5 @@ Package: sdxpinn-quecmanager-beta -Version: 1.0.5 +Version: 1.0.6 Architecture: aarch64_cortex-a53 Maintainer: Russel Yasol dr-dolomite@github.com Cameron Thompson iamromulan@github.com Description: A custom web UI desgined to run alongside luci for Quectel RM55x modems diff --git a/ipk-source/sdxpinn-quecmanager-beta/CONTROL/postinst b/ipk-source/sdxpinn-quecmanager-beta/CONTROL/postinst index 2dc16af..f7254b9 100755 --- a/ipk-source/sdxpinn-quecmanager-beta/CONTROL/postinst +++ b/ipk-source/sdxpinn-quecmanager-beta/CONTROL/postinst @@ -1,14 +1,52 @@ #!/bin/ash +# Backup the original index.html and replace with login.html mv /www/index.html /www/index.html.old cp /www/login.html /www/index.html -# Check if log_signal_metrics.sh is set to start in rc.local and add if not -grep -qxF "/www/cgi-bin/home/log_signal_metrics.sh &" /etc/rc.local || \ -sed -i '/^exit 0/i /www/cgi-bin/home/log_signal_metrics.sh &' /etc/rc.local +# Define the commands to add to rc.local +COMMANDS="/www/cgi-bin/settings/change_sms_code.sh & +/www/cgi-bin/home/log_signal_metrics.sh &" +# Create a new rc.local with commands correctly placed +TMP_RC_LOCAL=$(mktemp) -# Check if log_signal_metrics.sh is already running +awk -v commands="$COMMANDS" ' +BEGIN { + split(commands, cmdArr, "\n") # Split commands into an array + for (i in cmdArr) alreadyAdded[cmdArr[i]] = 0 + added = 0 +} +{ + if ($0 in alreadyAdded) { + alreadyAdded[$0] = 1 + next + } + if (/^# Put your custom commands here/) { + print + if (!added) { + for (i in cmdArr) if (!alreadyAdded[cmdArr[i]]) { + print cmdArr[i] + alreadyAdded[cmdArr[i]] = 1 + } + print "" + added = 1 + } + } else { + print + } +} +END { + # Add any missing commands at the end of the section + for (i in cmdArr) if (!alreadyAdded[cmdArr[i]]) print cmdArr[i] +} +' /etc/rc.local > "$TMP_RC_LOCAL" + +# Replace the original rc.local with the modified one +mv "$TMP_RC_LOCAL" /etc/rc.local +chmod +x /etc/rc.local + +# Ensure log_signal_metrics.sh is running if ! pgrep -f "/www/cgi-bin/home/log_signal_metrics.sh" > /dev/null; then echo "Starting log_signal_metrics.sh..." /www/cgi-bin/home/log_signal_metrics.sh & @@ -16,5 +54,13 @@ else echo "log_signal_metrics.sh is already running. Skipping start." fi +# Ensure change_sms_code.sh is running +if ! pgrep -f "/www/cgi-bin/settings/change_sms_code.sh" > /dev/null; then + echo "Starting change_sms_code.sh..." + /www/cgi-bin/settings/change_sms_code.sh & +else + echo "change_sms_code.sh is already running. Skipping start." +fi + exit 0 diff --git a/ipk-source/sdxpinn-quecmanager-beta/CONTROL/postrm b/ipk-source/sdxpinn-quecmanager-beta/CONTROL/postrm index d9bed09..ee45a72 100755 --- a/ipk-source/sdxpinn-quecmanager-beta/CONTROL/postrm +++ b/ipk-source/sdxpinn-quecmanager-beta/CONTROL/postrm @@ -2,29 +2,5 @@ mv /www/index.html.old /www/index.html -# Check if log_signal_metrics.sh is in rc.local and remove it -sed -i '/\/www\/cgi-bin\/home\/log_signal_metrics\.sh &/d' /etc/rc.local - - -# Check if log_signal_metrics.sh is running and kill it - -PID=$(pgrep -f "/www/cgi-bin/home/log_signal_metrics.sh") - -if [ -n "$PID" ]; then - echo "Stopping log_signal_metrics.sh (PID: $PID)..." - - # Kill the process - kill -TERM "$PID" - - if [ $? -eq 0 ]; then - echo "Successfully stopped log_signal_metrics.sh." - else - echo "Failed to stop log_signal_metrics.sh." - fi -else - echo "log_signal_metrics.sh is not running. Nothing to stop." -fi - - exit 0 diff --git a/ipk-source/sdxpinn-quecmanager-beta/CONTROL/prerm b/ipk-source/sdxpinn-quecmanager-beta/CONTROL/prerm new file mode 100755 index 0000000..f85f1ee --- /dev/null +++ b/ipk-source/sdxpinn-quecmanager-beta/CONTROL/prerm @@ -0,0 +1,31 @@ +#!/bin/ash + +echo "Stopping QuecManager Services and removing from rc.local..." + +# Remove services from rc.local if present +sed -i '/\/www\/cgi-bin\/home\/log_signal_metrics\.sh &/d' /etc/rc.local +sed -i '/\/www\/cgi-bin\/settings\/change_sms_code\.sh &/d' /etc/rc.local + +# Define an array of scripts to check and stop +SCRIPTS=( + "/www/cgi-bin/home/log_signal_metrics.sh" + "/www/cgi-bin/settings/change_sms_code.sh" +) + +# Loop through each script, check if it's running, and kill it if necessary +for SCRIPT in "${SCRIPTS[@]}"; do + PID=$(pgrep -f "$SCRIPT") + if [ -n "$PID" ]; then + echo "Stopping $SCRIPT (PID: $PID)..." + if kill -TERM "$PID"; then + echo "Successfully stopped $SCRIPT." + else + echo "Failed to stop $SCRIPT." + fi + else + echo "$SCRIPT is not running. Nothing to stop." + fi +done + +exit 0 + diff --git a/ipk-source/sdxpinn-quecmanager-beta/root/www/404.html b/ipk-source/sdxpinn-quecmanager-beta/root/www/404.html index 81bc61b..cbd647a 100644 --- a/ipk-source/sdxpinn-quecmanager-beta/root/www/404.html +++ b/ipk-source/sdxpinn-quecmanager-beta/root/www/404.html @@ -1 +1 @@ -
Enter your password to login
Enter your password to login