From 5c1107039b4c5fb95d56102f0837bb7b2fa65c28 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 04:51:29 -0600
Subject: [PATCH 01/64] Update allsky.sh: addMessage.sh changes
---
allsky.sh | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/allsky.sh b/allsky.sh
index 0e5834935..6425a69db 100755
--- a/allsky.sh
+++ b/allsky.sh
@@ -74,10 +74,10 @@ if [[ -d ${PRIOR_ALLSKY_DIR} ]]; then
fi
if [[ ${DO_MSG} == "true" ]]; then
MSG="Reminder: your prior Allsky is still in '${PRIOR_ALLSKY_DIR}'."
- MSG+="\nIf you are no longer using it, it can be removed to save disk space:"
- MSG+="\n rm -fr '${PRIOR_ALLSKY_DIR}'
\n"
- "${ALLSKY_SCRIPTS}/addMessage.sh" "info" "${MSG}"
- touch "${OLD_ALLSKY_REMINDER}" # last time we displayed the message
+ MSG+="\nIf you are no longer using it, it can be removed to save disk space."
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --id AM_RM_PRIOR --type info --msg "${MSG}" \
+ --cmd "Click here to remove."
+ touch "${OLD_ALLSKY_REMINDER}" # Sets the last time we displayed the message.
fi
fi
@@ -97,9 +97,8 @@ if [[ -f ${CHECK_ALLSKY_LOG} ]]; then
MSG+="Reminder to make these changes to your settings"
MSG+=""
MSG+="$( < "${CHECK_ALLSKY_LOG}" )"
- MSG+="
rm -f '${CHECK_ALLSKY_LOG}'
\n"
- "${ALLSKY_SCRIPTS}/addMessage.sh" "warning" "${MSG}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --id AM_RM_CHECK --type warning --msg "${MSG}" \
+ --cmd "rm -f '${POST_INSTALLATION_ACTIONS}'
"
PIA="${POST_INSTALLATION_ACTIONS/${ALLSKY_HOME}/}"
- "${ALLSKY_SCRIPTS}/addMessage.sh" "warning" "${MSG}" "${PIA}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --id AM_RM_POST --type warning --msg "${MSG}" --url "${PIA}" \
+ --cmd "\nOnce you perform them, click here to remove this message."
fi
fi
@@ -225,7 +223,7 @@ fi
# Make sure the settings file is linked to the camera-specific file.
if ! MSG="$( check_settings_link "${SETTINGS_FILE}" )" ; then
- "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${MSG}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --cmd "${MSG}"
echo "ERROR: ${MSG}" >&2
fi
@@ -241,7 +239,7 @@ else
sudo chgrp "${WEBSERVER_GROUP}" "${ALLSKY_TMP}"
MSG="Had to create '${ALLSKY_TMP}'."
MSG="${MSG}\nIf this happens again, contact the Allsky developers."
- "${ALLSKY_SCRIPTS}/addMessage.sh" warning "${ME}: ${MSG}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type warning --msg "${ME}: ${MSG}"
fi
rm -f "${ALLSKY_BAD_IMAGE_COUNT}" # Start with no bad images
From 269ba14ecafe16e06176dda6807e54da46b586c2 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 04:52:07 -0600
Subject: [PATCH 02/64] Update install.sh: addMessage.sh changes
---
install.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/install.sh b/install.sh
index a2c8c7e21..961753eb2 100755
--- a/install.sh
+++ b/install.sh
@@ -722,7 +722,7 @@ ask_reboot()
MSG="If you have not already rebooted your Pi, please do so now.\n"
MSG+="You can then connect to the WebUI at:\n"
MSG+="${AT}"
- "${ALLSKY_SCRIPTS}/addMessage.sh" "info" "${MSG}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type info --msg "${MSG}"
fi
}
do_reboot()
@@ -3268,7 +3268,7 @@ display_image()
# Add a message the user will see in the WebUI.
MSG="Actions needed. See ${POST_INSTALLATION_ACTIONS}."
X="${POST_INSTALLATION_ACTIONS/${ALLSKY_HOME}/}"
- "${ALLSKY_SCRIPTS}/addMessage.sh" "warning" "${MSG}" "${X}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type warning "--msg ${MSG}" --url "${X}"
# This tells allsky.sh not to display a message about actions since we just did.
touch "${POST_INSTALLATION_ACTIONS}_initial_message"
From 45ccd8ff318cd8295d599be7002e1691e2d5ecc3 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 04:52:54 -0600
Subject: [PATCH 03/64] Update upload.sh: addMessage.sh changes
---
scripts/upload.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/upload.sh b/scripts/upload.sh
index 22ecf08eb..022e8a434 100755
--- a/scripts/upload.sh
+++ b/scripts/upload.sh
@@ -236,7 +236,7 @@ elif [[ ${PROTOCOL} == "gcs" ]] ; then
else
OUTPUT="${ME}: ERROR: 'gsutil' command not found; cannot upload."
OUTPUT+="\nIt should be in one of these directories: ${PATH}"
- "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${OUTPUT}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --msg "${OUTPUT}"
OUTPUT="${RED}*** ${OUTPUT}${NC}"
RET=1
fi
From 675fac3e8823c8d9e06c01c8547a6143adfc5cde Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 04:53:21 -0600
Subject: [PATCH 04/64] Update testUpload.sh: addMessage.sh changes
---
scripts/testUpload.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/testUpload.sh b/scripts/testUpload.sh
index b3965994d..d3a8d9503 100755
--- a/scripts/testUpload.sh
+++ b/scripts/testUpload.sh
@@ -281,14 +281,14 @@ if [[ -n ${ERR_MSG} ]]; then
if [[ ${ON_TTY} == "true" ]]; then
echo -e "\n${ERR_MSG}" >&2
else
- "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${ERR_MSG}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --msg "${ERR_MSG}"
fi
fi
if [[ -n ${OK_MSG} ]]; then
if [[ ${ON_TTY} == "true" ]]; then
echo -e "\n${OK_MSG}" >&2
else
- "${ALLSKY_SCRIPTS}/addMessage.sh" "success" "${OK_MSG}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type success --msg "${OK_MSG}"
fi
fi
@@ -297,7 +297,7 @@ if [[ -s ${MSG_FILE} ]]; then
if [[ ${ON_TTY} == "true" ]]; then
echo -e "\n${M}"
else
- "${ALLSKY_SCRIPTS}/addMessage.sh" "info" "${M}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type info --msg "${M}"
fi
fi
rm -f "${MSG_FILE}"
From c6980d452e0acb23600df77852810f554f188111 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 04:53:58 -0600
Subject: [PATCH 05/64] Update removeBadImages.sh: addMessage.sh changes
---
scripts/removeBadImages.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/removeBadImages.sh b/scripts/removeBadImages.sh
index 40f3541fa..8edc6bf87 100755
--- a/scripts/removeBadImages.sh
+++ b/scripts/removeBadImages.sh
@@ -256,7 +256,7 @@ else
MSG+="\nCheck the values of 'Remove Bad Images Threshold Low',"
MSG+=" 'Remove Bad Images Threshold High',"
MSG+=" and 'Max Auto-Exposure' in the WebUI."
- "${ALLSKY_SCRIPTS}/addMessage.sh" "warning" "${MSG}" >&2
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type warning --msg "${MSG}" >&2
fi
if [[ ${BAD_COUNT} -ge "${BAD_LIMIT}" ]]; then
# Split the long file name so it fits in the message.
From bd4ca2c719698741bb8aabc8587aad220c3b6d9f Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 04:54:38 -0600
Subject: [PATCH 06/64] Update postToMap.sh: addMessage.sh changes
---
scripts/postToMap.sh | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/scripts/postToMap.sh b/scripts/postToMap.sh
index e33a5cc54..44b57eda7 100755
--- a/scripts/postToMap.sh
+++ b/scripts/postToMap.sh
@@ -174,7 +174,7 @@ if [[ -z ${MACHINE_ID} ]]; then
if [[ -z ${MACHINE_ID} ]]; then
E="ERROR: Unable to get 'machine_id': check /etc/machine-id."
echo -e "${ERROR_MSG_START}${E}${wNC}"
- [[ ${ENDOFNIGHT} == "true" ]] && "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${ME}: ${E}"
+ [[ ${ENDOFNIGHT} == "true" ]] && "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --msg "${ME}: ${E}"
exit 3
fi
fi
@@ -279,7 +279,7 @@ else
if [[ ${ENDOFNIGHT} == "true" ]]; then
echo "${W}" | while read -r MSG
do
- "${ALLSKY_SCRIPTS}/addMessage.sh" "warning" "${ME}: ${MSG}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type warning --msg "${ME}: ${MSG}"
done
fi
fi
@@ -288,7 +288,7 @@ else
if [[ ${ENDOFNIGHT} == "true" ]]; then
echo "${E}" | while read -r MSG
do
- "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${ME}: ${MSG}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --msg "${ME}: ${MSG}"
done
fi
exit 2
@@ -352,7 +352,7 @@ if [[ ${UPLOAD} == "true" ]]; then
E="ERROR while uploading map data with curl: ${RETURN}, CMD=${CMD}."
if [[ ${ENDOFNIGHT} == "true" ]]; then
echo -e "${ME}: ${E}" # goes in log file
- "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${ME}: ${E}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --msg "${ME}: ${E}"
else
echo -e "${ERROR_MSG_START}${E}${wNC}"
fi
@@ -383,25 +383,25 @@ if [[ ${UPLOAD} == "true" ]]; then
elif [[ -z ${RET} ]]; then
E="ERROR: Unknown reply from server: ${RETURN}."
echo -e "${ERROR_MSG_START}${E}${wNC}"
- [[ ${ENDOFNIGHT} == "true" ]] && "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${ME}: ${E}"
+ [[ ${ENDOFNIGHT} == "true" ]] && "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --msg "${ME}: ${E}"
RETURN_CODE=2
elif [[ ${RET:0:6} == "ERROR " ]]; then
E="ERROR returned while uploading map data: ${RET:6}."
echo -e "${ERROR_MSG_START}${E}${wNC}"
- [[ ${ENDOFNIGHT} == "true" ]] && "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${ME}: ${E}"
+ [[ ${ENDOFNIGHT} == "true" ]] && "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --msg "${ME}: ${E}"
RETURN_CODE=2
elif [[ ${RET:0:15} == "ALREADY UPDATED" ]]; then
MAX_UPDATES=${RET:16}
W="NOTICE: You have already updated your map data the maximum of ${MAX_UPDATES} times per day. Try again tomorrow."
echo -e "${WARNING_MSG_START}${W}${wNC}"
- [[ ${ENDOFNIGHT} == "true" ]] && "${ALLSKY_SCRIPTS}/addMessage.sh" "warning" "${ME}: ${W}"
+ [[ ${ENDOFNIGHT} == "true" ]] && "${ALLSKY_SCRIPTS}/addMessage.sh" --type warning --msg "${ME}: ${W}"
else
E="ERROR returned while uploading map data: ${RET}."
echo -e "${ERROR_MSG_START}${E}${wNC}"
- [[ ${ENDOFNIGHT} == "true" ]] && "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${ME}: ${E}"
+ [[ ${ENDOFNIGHT} == "true" ]] && "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --msg "${ME}: ${E}"
RETURN_CODE=2
fi
From e78fde91be5f17beb7f12605201a32ee00dacce1 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 04:55:01 -0600
Subject: [PATCH 07/64] Update postData.sh: addMessage.sh changes
---
scripts/postData.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/postData.sh b/scripts/postData.sh
index a6274ae6e..9dbedac41 100755
--- a/scripts/postData.sh
+++ b/scripts/postData.sh
@@ -37,7 +37,7 @@ function upload_file()
local MSG="File to upload '${FILE_TO_UPLOAD}' - file not found."
echo -e "${RED}${ME}: ERROR: ${MSG}.${NC}" >&2
if [[ ${FROM_WEBUI} == "false" ]]; then
- "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${ME}: ${MSG}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --msg "${ME}: ${MSG}"
fi
return 1
fi
@@ -128,14 +128,14 @@ if [[ ${SETTINGS_ONLY} == "false" ]]; then
OK="false"
echo -e "${RED}${ME}: ERROR: ${latitude}" >&2
if [[ ${FROM_WEBUI} == "false" ]]; then
- "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${ME}: ${latitude}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --msg "${ME}: ${latitude}"
fi
fi
if ! longitude="$( convertLatLong "$( settings ".longitude" )" "longitude" 2>&1 )" ; then
OK="false"
echo -e "${RED}${ME}: ERROR: ${longitude}" >&2
if [[ ${FROM_WEBUI} == "false" ]]; then
- "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${ME}: ${longitude}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --msg "${ME}: ${longitude}"
fi
fi
[[ ${OK} == "false" ]] && exit 1
From 9d171cea1f29f9884a083a3918bc83392573f7af Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 04:55:30 -0600
Subject: [PATCH 08/64] Update functions.sh: addMessage.sh changes
---
scripts/functions.sh | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/scripts/functions.sh b/scripts/functions.sh
index f7bc21e71..914a52447 100644
--- a/scripts/functions.sh
+++ b/scripts/functions.sh
@@ -84,7 +84,7 @@ function doExit()
OUTPUT_A_MSG="false"
if [[ -n ${WEBUI_MESSAGE} ]]; then
- "${ALLSKY_SCRIPTS}/addMessage.sh" "${MSG_TYPE}" "${WEBUI_MESSAGE}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type "${MSG_TYPE}" --msg "${WEBUI_MESSAGE}"
echo -e "Stopping Allsky: ${WEBUI_MESSAGE}" >&2
OUTPUT_A_MSG="true"
fi
@@ -274,13 +274,13 @@ function get_connected_cameras_info()
if [[ -n ${CMD_TO_USE_} ]]; then
if [[ ${CMD_TO_USE_} == "raspistill" ]]; then
# Only supported camera with raspistill
- echo -e "RPi\t0\timx477"
+ echo -e "RPi\t0\timx477\t[4056x3040]"
else
# Input:
# camera_number : sensor [other stuff]
LIBCAMERA_LOG_LEVELS=FATAL "${CMD_TO_USE_}" --list-cameras 2>&1 |
- gawk '/^[0-9]/ { printf("%s\t%d\t%s\n", "RPi", $1, $3); }'
+ gawk '/^[0-9]/ { printf("%s\t%d\t%s\n", "RPi", $2, $3); }'
fi
fi
@@ -421,7 +421,7 @@ function validate_camera()
echo -e "\n${RED}${MSG}${NC}\n"
else
URL="/index.php?page=configuration"
- "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${MSG}" "${URL}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --msg "${MSG}" --url "${URL}"
fi
RET=1
elif [[ ${SETTINGS_CM} != "${CM}" ]]; then
@@ -432,7 +432,7 @@ function validate_camera()
echo -e "\n${RED}${MSG}${NC}\n"
else
URL="/index.php?page=configuration"
- "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${MSG}" "${URL}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --msg "${MSG}" --url "${URL}"
fi
RET=1
elif [[ ${SETTINGS_CN} != "${CN}" ]]; then
@@ -443,7 +443,7 @@ function validate_camera()
echo -e "\n${RED}${MSG}${NC}\n"
else
URL="/index.php?page=configuration"
- "${ALLSKY_SCRIPTS}/addMessage.sh" "error" "${MSG}" "${URL}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type error --msg "${MSG}" --url "${URL}"
fi
RET=1
fi
@@ -468,7 +468,8 @@ function validate_camera()
else
MSG+="\n\nClick this message to ask that Allsky support this camera."
URL="/documentation/explanations/requestCameraSupport.html";
- "${ALLSKY_SCRIPTS}/addMessage.sh" "warning" "${MSG}" "${URL}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --id AM_NOT_SUPPORTED --type warning --msg "${MSG}" --url "${URL}" \
+ --cmd "${CT}:Click here to see the list of supported ${CT} cameras."
fi
return 2
@@ -1108,7 +1109,7 @@ function one_instance()
SEVERITY="warning"
MSG+="\nOnce you have resolved the cause, reset the aborted counter:"
MSG+="\n rm -f '${AF}'
"
- "${ALLSKY_SCRIPTS}/addMessage.sh" "${SEVERITY}" "${MSG}"
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --type ${SEVERITY} --msg "${MSG}"
fi
return 2
From 64eedba2d45a4cf79ba941332de89e706e55f0ee Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 04:58:37 -0600
Subject: [PATCH 09/64] Update allsky_common.cpp: addMessage.sh change
---
src/allsky_common.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/allsky_common.cpp b/src/allsky_common.cpp
index a252560f6..e487005b9 100644
--- a/src/allsky_common.cpp
+++ b/src/allsky_common.cpp
@@ -64,7 +64,7 @@ void Log(int required_level, const char *fmt, ...)
}
char command[sizeof(msg) + 100];
- snprintf(command, sizeof(command)-1, "%s/scripts/addMessage.sh %s '%s'",
+ snprintf(command, sizeof(command)-1, "%s/scripts/addMessage.sh --type %s '%s'",
CG.allskyHome, severity, msg);
Log(4, "Executing %s\n", command);
(void) system(command);
From 4f619e4374a16c4f1b529b1ce73acb6e222a28e2 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 04:59:43 -0600
Subject: [PATCH 10/64] Update variables.sh: add message numbers
---
variables.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/variables.sh b/variables.sh
index 10911885b..f7ff70f55 100644
--- a/variables.sh
+++ b/variables.sh
@@ -209,6 +209,12 @@ if [[ -z "${ALLSKY_VARIABLE_SET}" ]]; then
EXIT_ERROR_STOP=100 # unrecoverable error - need user action so stop service
EXIT_NO_CAMERA=101 # cannot find camera
+ # addMessage.sh message numbers.
+ AM_RM_PRIOR=1
+ AM_RM_CHECK=2
+ AM_RM_POST=3
+ AM_NOT_SUPPORTED=4
+
# Name of the Pi's OS in lowercase.
PI_OS="$( grep VERSION_CODENAME /etc/os-release )"; PI_OS="${PI_OS/VERSION_CODENAME=/}"
PI_OS="${PI_OS,,}"
From d02cecd0cc33a348f28d2cb5d3385767a9298932 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 05:33:28 -0600
Subject: [PATCH 11/64] Update variables.sh: decided not to use AM_* variables
---
variables.sh | 6 ------
1 file changed, 6 deletions(-)
diff --git a/variables.sh b/variables.sh
index f7ff70f55..10911885b 100644
--- a/variables.sh
+++ b/variables.sh
@@ -209,12 +209,6 @@ if [[ -z "${ALLSKY_VARIABLE_SET}" ]]; then
EXIT_ERROR_STOP=100 # unrecoverable error - need user action so stop service
EXIT_NO_CAMERA=101 # cannot find camera
- # addMessage.sh message numbers.
- AM_RM_PRIOR=1
- AM_RM_CHECK=2
- AM_RM_POST=3
- AM_NOT_SUPPORTED=4
-
# Name of the Pi's OS in lowercase.
PI_OS="$( grep VERSION_CODENAME /etc/os-release )"; PI_OS="${PI_OS/VERSION_CODENAME=/}"
PI_OS="${PI_OS,,}"
From 7c0a31be996fad68fe021058911ed08d9d8f442e Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 05:34:18 -0600
Subject: [PATCH 12/64] Create execute.sh
---
scripts/utilities/execute.sh | 121 +++++++++++++++++++++++++++++++++++
1 file changed, 121 insertions(+)
create mode 100644 scripts/utilities/execute.sh
diff --git a/scripts/utilities/execute.sh b/scripts/utilities/execute.sh
new file mode 100644
index 000000000..f90f1c134
--- /dev/null
+++ b/scripts/utilities/execute.sh
@@ -0,0 +1,121 @@
+#!/bin/bash
+# variables.sh
+# addMessage.sh
+# execute.sh (needs to be 755).
+
+# Execute the specified command.
+# Normally the command is built-in, but allow for an arbitrary command.
+# Many commands are referenced in addMessage.sh and the command name
+# is one of its IDs, e.g., ${AM_...}.
+
+# Allow this script to be executed manually, which requires several variables to be set.
+[[ -z ${ALLSKY_HOME} ]] && export ALLSKY_HOME="$( realpath "$( dirname "${BASH_ARGV0}" )/.." )"
+ME="$( basename "${BASH_ARGV0}" )"
+
+#shellcheck source-path=.
+source "${ALLSKY_HOME}/variables.sh" || exit "${EXIT_ERROR_STOP}"
+#shellcheck source-path=scripts
+source "${ALLSKY_SCRIPTS}/functions.sh" || exit "${EXIT_ERROR_STOP}"
+
+OK="true"
+DO_HELP="false"
+while [[ $# -gt 0 ]]; do
+ ARG="${1}"
+ case "${ARG,,}" in
+ --help)
+ DO_HELP="true"
+ ;;
+ -*)
+ echo -e "${RED}Unknown argument '${ARG}' ignoring.${NC}" >&2
+ OK="false"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+done
+
+usage_and_exit()
+{
+ local RET=${1}
+ {
+ echo
+ [[ ${RET} -ne 0 ]] && echo -en "${RED}"
+ echo "Usage: ${ME} [--help] command [arguments...]"
+ [[ ${RET} -ne 0 ]] && echo -en "${NC}"
+ } >&2
+ exit "${RET}"
+}
+
+[[ ${DO_HELP} == "true" ]] && usage_and_exit 0
+[[ ${OK} == "false" || $# -eq 0 ]] && usage_and_exit 1
+
+
+function rm_msg()
+{
+ local FILE="$1"
+
+ local R RET_CODE
+
+ R="$( rm -r "${FILE}" 2>&1 )" # -r in case it's a directory
+ RET_CODE=$?
+
+ if [[ ${RET_CODE} -eq 0 ]]; then
+ echo "Removed '${FILE}'"
+ else
+ echo "Unable to remove '${FILE}': ${R}" >&2
+ fi
+ return ${RET_CODE}
+}
+
+RET=0
+CMD="${1}"
+case "${CMD}" in
+ "AM_RM_PRIOR") # Remove prior version of Allsky
+ rm_msg "${PRIOR_ALLSKY_DIR}"
+ RET=$?
+ rm -f "${OLD_ALLSKY_REMINDER}"
+
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --id "${CMD}" --delete
+ ;;
+
+ "AM_RM_CHECK") # Remove log from checkAllsky.sh
+ rm_msg "${CHECK_ALLSKY_LOG}"
+ RET=$?
+
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --id "${CMD}" --delete
+ ;;
+
+ "AM_RM_POST") # Remove log from checkAllsky.sh
+ rm_msg "${POST_INSTALLATION_ACTIONS}"
+ RET=$?
+
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --id "${CMD}" --delete
+ ;;
+
+ "AM_NOT_SUPPORTED") # Not supported camera
+ CT="$2"
+ shift
+ "${ALLSKY_UTILITIES}/show_supported_cameras.sh" --${CT}
+
+ "${ALLSKY_SCRIPTS}/addMessage.sh" --id "${CMD}" --delete
+ ;;
+
+ AM_*)
+ echo "${ME}: ERROR: Unknown error ID: '${CMD}'." >&2
+ exit 1
+ ;;
+
+ *) # Arbitrary command
+ eval "${*}"
+ RET=$?
+ if [[ ${RET} -eq 0 ]]; then
+ echo "Executed ${*}"
+ else
+ echo "Unable to execute ${*}"
+ fi
+ ;;
+esac
+
+exit ${RET}
From 1d9a9c85a2a352b476bde123094734e73266fef1 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 05:49:26 -0600
Subject: [PATCH 13/64] Update allskyDefines.inc.repo: add
XX_ALLSKY_UTILITIES_XX
---
config_repo/allskyDefines.inc.repo | 1 +
1 file changed, 1 insertion(+)
diff --git a/config_repo/allskyDefines.inc.repo b/config_repo/allskyDefines.inc.repo
index 2c1978ed9..54b1b1da7 100644
--- a/config_repo/allskyDefines.inc.repo
+++ b/config_repo/allskyDefines.inc.repo
@@ -5,6 +5,7 @@ define('HOME', 'XX_HOME_XX');
define('ALLSKY_HOME', 'XX_ALLSKY_HOME_XX');
define('ALLSKY_CONFIG', 'XX_ALLSKY_CONFIG_XX');
define('ALLSKY_SCRIPTS', 'XX_ALLSKY_SCRIPTS_XX');
+define('ALLSKY_UTILITIES', 'XX_ALLSKY_UTILITIES_XX');
define('ALLSKY_TMP', 'XX_ALLSKY_TMP_XX');
define('ALLSKY_IMAGES', 'XX_ALLSKY_IMAGES_XX');
define('ALLSKY_MESSAGES', 'XX_ALLSKY_MESSAGES_XX');
From f2c91e1c98e98fe172424ed7d4f63368cb0da86c Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 05:50:40 -0600
Subject: [PATCH 14/64] Update install.sh: add XX_ALLSKY_UTILITIES_XX
---
install.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/install.sh b/install.sh
index 961753eb2..1d0af57fa 100755
--- a/install.sh
+++ b/install.sh
@@ -611,6 +611,7 @@ update_php_defines()
-e "s;XX_ALLSKY_HOME_XX;${ALLSKY_HOME};g" \
-e "s;XX_ALLSKY_CONFIG_XX;${ALLSKY_CONFIG};g" \
-e "s;XX_ALLSKY_SCRIPTS_XX;${ALLSKY_SCRIPTS};g" \
+ -e "s;XX_ALLSKY_UTILITIES_XX;${ALLSKY_UTILITIES};g" \
-e "s;XX_ALLSKY_TMP_XX;${ALLSKY_TMP};g" \
-e "s;XX_ALLSKY_IMAGES_XX;${ALLSKY_IMAGES};g" \
-e "s;XX_ALLSKY_MESSAGES_XX;${ALLSKY_MESSAGES};g" \
From 3e23b8a67fe5534f5af1d84eeb8ee4078f82f8b7 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 27 Nov 2024 06:46:23 -0600
Subject: [PATCH 15/64] Update index.php: handle new format for messages.txt
file
---
html/index.php | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/html/index.php b/html/index.php
index 85a988374..6699ac539 100644
--- a/html/index.php
+++ b/html/index.php
@@ -333,21 +333,31 @@ function DisplayTorProxyConfig() {}
echo "showMessages(); ?>
- -showMessages(); ?>
+ +No configuration files could be found to edit.
+";
$retMsg .= "The '$configurationFileName' file needs to be updated via";
$retMsg .= " the 'Editor' page in the WebUI.";
- $retMsg .= "
Update fields with '$needToUpdateString'";
+ $retMsg .= "
Update fields with '".CONFIG_UPDATE_STRING."'";
$retMsg .= " and check all other entries.";
$retMsg .= "
This Allsky Website will not work until updated.";
$retMsg .= "
@@ -1197,4 +1226,4 @@0.1