Consistent Delays Between Images |
Yes |
Enable this to force the time between the start of exposures to be a consistent length
From 583356e0f278ff65f3282fa2ff40425a5e9bf268 Mon Sep 17 00:00:00 2001
From: Alex
Date: Thu, 5 Dec 2024 22:36:28 +0000
Subject: [PATCH 027/108] Resolve merge conflicts
---
scripts/modules/allsky_clearsky.py | 61 +++++++++++++++++++++++++++---
1 file changed, 56 insertions(+), 5 deletions(-)
diff --git a/scripts/modules/allsky_clearsky.py b/scripts/modules/allsky_clearsky.py
index 9ee324d8c..af1ec485e 100755
--- a/scripts/modules/allsky_clearsky.py
+++ b/scripts/modules/allsky_clearsky.py
@@ -24,7 +24,7 @@
"name": "Clear Sky Alarm",
"description": "Clear Sky Alarm",
"module": "allsky_clearsky",
- "version": "v1.0.0",
+ "version": "v1.0.1",
"events": [
"day",
"night"
@@ -41,8 +41,10 @@
"roi": "",
"roifallback": 5,
"mqttenable": "False",
+ "mqttusesecure": "true",
"mqttbroker": "",
"mqttport": 1883,
+ "mqttloopdelay": "5",
"mqttusername": "",
"mqttpassword": "",
"mqtttopic": "SKYSTATE",
@@ -153,6 +155,14 @@
"fieldtype": "checkbox"
}
},
+ "mqttusesecure": {
+ "required": "false",
+ "description": "Use Secure Connection",
+ "tab": "MQTT",
+ "type": {
+ "fieldtype": "checkbox"
+ }
+ },
"mqttbroker" : {
"required": "false",
"description": "MQTT Broker address",
@@ -171,6 +181,18 @@
"step": 1
}
},
+ "mqttloopdelay": {
+ "required": "false",
+ "description": "Loop Delay(s)",
+ "help": "The loop delay, only increase this if you experience issues with messages missing in the broker",
+ "tab": "MQTT",
+ "type": {
+ "fieldtype": "spinner",
+ "min": 0.5,
+ "max": 10,
+ "step": 0.5
+ }
+ },
"mqttusername" : {
"required": "false",
"description": "MQTT Username",
@@ -193,6 +215,12 @@
"enabled": "false"
}
+def MQTTonConnect(client, userdata, flags, rc, properties=None):
+ s.log(4, f"INFO: MQTT - CONNACK received with code {rc}.")
+
+def MQTTonPublish(client, userdata, mid, properties=None):
+ s.log(4, f"INFO: MQTT - Message published {mid}.")
+
def onPublish(client, userdata, mid, properties=None):
s.log(4,"INFO: Sky state published to MQTT Broker mid {0}".format(mid))
@@ -211,11 +239,13 @@ def clearsky(params, event):
fallback = s.int(params["roifallback"])
mqttenable = params["mqttenable"]
+ mqttusesecure = params["mqttusesecure"]
mqttbroker = params["mqttbroker"]
mqttport = s.int(params["mqttport"])
mqttusername = params["mqttusername"]
mqttpassword = params["mqttpassword"]
mqtttopic = params["mqtttopic"]
+ mqttloopdelay = params["mqttloopdelay"]
starCount = ""
@@ -335,12 +365,33 @@ def clearsky(params, event):
if mqttenable:
s.log(4,"INFO: Sending sky state {0} to MQTT Broker {1} using topic {2}".format(skyState, mqttbroker, mqtttopic))
+
+ channel_topic = mqtttopic
+ if channel_topic == "":
+ s.log(0, "ERROR:MQTT - Please specify a topic to publish")
+ return
+
client = paho.Client(client_id="", userdata=None, protocol=paho.MQTTv5)
- client.on_publish = onPublish
- client.tls_set(tls_version=mqtt.client.ssl.PROTOCOL_TLS)
- client.username_pw_set(mqttusername, mqttpassword)
+ client.on_connect = MQTTonConnect
+ client.on_publish = MQTTonPublish
+ if mqttusername != "" and mqttpassword!= "":
+ client.username_pw_set(mqttusername, mqttpassword)
+
+ if mqttbroker== "":
+ s.log(0, "ERROR: MQTT - Please specify a MQTT host to publish to")
+ return
+
+ if mqttusesecure:
+ client.tls_set(tls_version=mqtt.client.ssl.PROTOCOL_TLS)
+
client.connect(mqttbroker, mqttport)
- result = client.publish(mqtttopic, skyState)
+
+ client.publish(mqtttopic, skyState ,qos=1)
+ s.log(1, f"INFO: MQTT - Published to MQTT on channel: {channel_topic}")
+ delay = int(mqttloopdelay)
+ client.loop(delay)
+ client.disconnect()
+
else:
s.log(4,"INFO: MQTT disabled")
From 01764fa73eabbfcf33de79886875adeaf34f1dd6 Mon Sep 17 00:00:00 2001
From: Alex
Date: Thu, 5 Dec 2024 23:00:29 +0000
Subject: [PATCH 028/108] Resolve merge conflicts
---
html/includes/moduleutil.php | 36 ------------------------------------
1 file changed, 36 deletions(-)
diff --git a/html/includes/moduleutil.php b/html/includes/moduleutil.php
index 306ca6933..5c530f614 100644
--- a/html/includes/moduleutil.php
+++ b/html/includes/moduleutil.php
@@ -385,42 +385,6 @@ public function deleteModules() {
}
}
- public function postUpload() {
- $data = $_FILES['module-file'];
- $sourcePath = $_FILES['module-file']['tmp_name'];
- $scriptName = str_replace("zip","py",$_FILES['module-file']['name']);
-
- $targetPath = $this->userModules . '/' . $scriptName ;
-
- $zipArchive = new ZipArchive();
- $zipArchive->open($sourcePath);
- for ($i = 0; $i < $zipArchive->numFiles; $i++) {
- $stat = $zipArchive->statIndex($i);
-
- $nameInArchive = $stat['name'];
-
- if ($scriptName == $nameInArchive) {
- $fp = $zipArchive->getStream($nameInArchive);
- if (!$fp) {
- $this->send500('Unable to extract module from zip file');
- }
-
- $contents = '';
- while (!feof($fp)) {
- $contents .= fread($fp, 1024);
- }
- fclose($fp);
-
- $file = fopen($targetPath, 'wb');
- fwrite($file, $contents);
- fclose($file);
- $this->sendResponse();
- break;
- }
- }
- $this->send500('Unable to locate module in zip file');
- }
-
public function getReset() {
$flow = $_GET['flow'];
From 8285e4de65414287df8065a04f46ceada362cc34 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Fri, 6 Dec 2024 14:04:29 -0600
Subject: [PATCH 029/108] Rename remote_website_install.sh to
remoteWebsiteInstall.sh
---
remote_website_install.sh => remoteWebsiteInstall.sh | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename remote_website_install.sh => remoteWebsiteInstall.sh (100%)
diff --git a/remote_website_install.sh b/remoteWebsiteInstall.sh
similarity index 100%
rename from remote_website_install.sh
rename to remoteWebsiteInstall.sh
From de42bc5a72ad28d47931f685d099da595ba8345a Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Fri, 6 Dec 2024 14:06:36 -0600
Subject: [PATCH 030/108] Update AllskyWebsite.html: rename to
remoteWebsiteInstall.sh
---
html/documentation/installations/AllskyWebsite.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/documentation/installations/AllskyWebsite.html b/html/documentation/installations/AllskyWebsite.html
index 576fea5fc..675afe30b 100644
--- a/html/documentation/installations/AllskyWebsite.html
+++ b/html/documentation/installations/AllskyWebsite.html
@@ -98,7 +98,7 @@ Install a remote Allsky Website
subsection.
Make sure to enable Use Remote Website
as well as enough other settings so Allsky can upload a file to the Website.
- Run cd ~/allsky; ./remote_website_install.sh
+ Run cd ~/allsky; ./remoteWebsiteInstall.sh
to upload a default configuration file to your server,
leaving the master copy on the Pi.
From 82c575cd6131a8e01b631d3d69c391ed945fc79f Mon Sep 17 00:00:00 2001
From: Alex
Date: Fri, 6 Dec 2024 20:07:10 +0000
Subject: [PATCH 031/108] Rename for release
---
remoteWebsiteInstall.sh | 838 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 838 insertions(+)
create mode 100755 remoteWebsiteInstall.sh
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
new file mode 100755
index 000000000..6115f5646
--- /dev/null
+++ b/remoteWebsiteInstall.sh
@@ -0,0 +1,838 @@
+#!/bin/bash
+
+# shellcheck disable=SC2317
+
+# Install or upgrade a remote Allsky Website.
+
+# TODO: handle interrupts like in install.sh
+
+# shellcheck disable=SC2155
+[[ -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}"
+#shellcheck source-path=scripts
+source "${ALLSKY_SCRIPTS}/installUpgradeFunctions.sh" || exit "${EXIT_ERROR_STOP}"
+
+# display_msg() sends log entries to this file.
+# shellcheck disable=SC2034
+DISPLAY_MSG_LOG="${ALLSKY_LOGS}/${ME/.sh/}.log"
+
+# Config variables
+HAVE_NEW_CONFIG="false"
+HAVE_PRIOR_CONFIG="false"
+HAVE_NEW_REMOTE_CONFIG="false"
+HAVE_REALLY_OLD_REMOTE_CONFIG="false"
+CONFIG_TO_USE="" # which Website configuration file to use?
+CONFIG_MESSAGE=""
+REMOTE_WEBSITE_EXISTS="false"
+
+# Dialog size variables
+DIALOG_WIDTH="$( tput cols )"; ((DIALOG_WIDTH -= 10 ))
+DIALOG_HEIGHT=25
+
+# Remote connectivity variables
+REMOTE_URL="$( settings ".remotewebsiteurl" "${SETTINGS_FILE}" )"
+REMOTE_USER="$( settings ".REMOTEWEBSITE_USER" "${ALLSKY_ENV}" )"
+REMOTE_HOST="$( settings ".REMOTEWEBSITE_HOST" "${ALLSKY_ENV}" )"
+REMOTE_PORT="$( settings ".REMOTEWEBSITE_PORT" "${ALLSKY_ENV}" )"
+REMOTE_PASSWORD="$( settings ".REMOTEWEBSITE_PASSWORD" "${ALLSKY_ENV}" )"
+REMOTE_DIR="$( settings ".remotewebsiteimagedir" "${SETTINGS_FILE}" )"
+REMOTE_PROTOCOL="$( settings ".remotewebsiteprotocol" "${SETTINGS_FILE}" )"
+REMOTE_PROTOCOL="${REMOTE_PROTOCOL,,}" # convert to lowercase
+
+#### TODO: this script needs to support ALL protocols, not just *ftp*.
+# When it does, remove this check.
+if [[ ${REMOTE_PROTOCOL} != "sftp" && ${REMOTE_PROTOCOL} != "ftp" && ${REMOTE_PROTOCOL} != "ftps" ]]; then
+ echo -e "\n\n"
+ echo "************* NOTICE *************"
+ echo "This script currently only supports ftp protocols."
+ echo "Support for the '${REMOTE_PROTOCOL}' protocol will be added in"
+ echo "the first point release."
+ echo -e "\n"
+ echo "In the meantime, if you have an existing remote Allsky Website,"
+ echo "it should continue to work."
+ echo -e "\n"
+
+ exit 0
+fi
+
+# Titles for various dialogs
+# don't use: DIALOG_BACK_TITLE="Allsky Remote Website Installer"
+DIALOG_WELCOME_TITLE="Allsky Remote Website Installer"
+DIALOG_PRE_CHECK="${DIALOG_WELCOME_TITLE} - Pre Installation Checks"
+DIALOG_INSTALL="Installing Remote Website"
+DIALOG_DONE="Remote Website Installation Completed"
+DIALOG_TITLE_LOG="Allsky Remote Website Installation Log"
+
+# Old Allksy Website files that should be removed if they exist.
+OLD_CONFIG_NAME="config.js"
+OLD_FILES_TO_REMOVE=( \
+ "${OLD_CONFIG_NAME}" \
+ "${ALLSKY_WEBSITE_CONFIGURATION_NAME}" \
+ "getTime.php" \
+ "virtualsky.json" \
+ "README.md" \
+ "myImages")
+
+############################################## functions
+
+# Prompt the user to enter (y)/(yes) or (n)/(no).
+# This function is only used when running in text (--text) mode.
+function enter_yes_no()
+{
+ local TEXT="${1}"
+ local RESULT=1
+ local ANSWER
+
+ while true; do
+ echo -e "${TEXT}"
+ read -r -p "Do you want to continue? (y/n): " ANSWER
+ ANSWER="${ANSWER,,}" # convert to lowercase
+
+ if [[ ${ANSWER} == "y" || ${ANSWER} == "yes" ]]; then
+ return 0
+ elif [[ ${ANSWER} == "n" || ${ANSWER} == "no" ]]; then
+ return 1
+ else
+ echo -e "\nInvalid response. Please enter y/yes or n/no."
+ fi
+ done
+
+ return ${RESULT}
+}
+
+# prompt the user to press any key.
+# This function is only used when running in text (--text) mode.
+function press_any_key()
+{
+ echo -e "${1}\nPress any key to continue..."
+ read -r -n1 -s
+}
+
+# Add a common heading to the dialog text.
+function add_dialog_heading()
+{
+ local DIALOG_TEXT="${1}"
+
+ ## We no longer add the remote URL but have left this code in case we want
+ ## to add something else in the future.
+ ## Only the: ITEM_TO_ADD=xxx line should need changing.
+ echo "${DIALOG_TEXT}"
+ return
+
+ if [[ ${TEXT_ONLY} == "true" ]]; then
+ DIALOG_RED="${RED}"
+ DIALOG_NORMAL="${NC}"
+ fi
+
+ local ITEM_TO_ADD="${REMOTE_URL}"
+ local PADDING=$(( ((DIALOG_WIDTH-6) - ${#ITEM_TO_ADD}) / 2 ))
+ local ITEM_TO_ADD="$( printf "%${PADDING}s%s" "" "${ITEM_TO_ADD}" )"
+
+ echo -e "\n${DIALOG_RED}${ITEM_TO_ADD}${DIALOG_NORMAL}\n${DIALOG_TEXT}"
+}
+
+# Displays the specified type of Dialog, or in text mode just displays the text.
+# ${1} - The box type
+# ${2} - The title for the dialog
+# ${3} - The text to disply in the dialog
+# ${4} - Optional additional arguments to dialog
+#
+# Return - 1 if the user selected "No"; 0 otherwise
+function display_box()
+{
+ local DIALOG_TYPE="${1}"
+ local DIALOG_TITLE="${2}"
+ local DIALOG_TEXT="${3}"
+ local MORE_ARGS="${4}"
+
+ DIALOG_TEXT="$( add_dialog_heading "${DIALOG_TEXT}" )"
+ if [[ ${TEXT_ONLY} == "true" ]]; then
+ local RET=0
+ if [[ ${DIALOG_TYPE} == "--msgbox" ]]; then
+ press_any_key "${DIALOG_TEXT}"
+ elif [[ ${DIALOG_TYPE} == "--yesno" ]]; then
+ enter_yes_no "${DIALOG_TEXT}"
+ RET=$?
+ else
+ echo -e "${DIALOG_TEXT}"
+ fi
+ return ${RET}
+ fi
+
+ # Don't use: it's redundant most of the time --backtitle "${DIALOG_BACK_TITLE}" \
+ # shellcheck disable=SC2086
+ dialog \
+ --colors \
+ --title "${DIALOG_TITLE}" \
+ ${MORE_ARGS} \
+ "${DIALOG_TYPE}" "${DIALOG_TEXT}" ${DIALOG_HEIGHT} ${DIALOG_WIDTH}
+ return $?
+}
+
+# Displays a file Dialog, or in text mode just displays the file.
+# ${1} - The title for the dialog
+# ${2} - The filename to display
+#
+# Returns - Nothing
+function display_log_file()
+{
+ local DIALOG_TITLE="${1}"
+ local FILENAME="${2}"
+
+ if [[ ${TEXT_ONLY} == "true" ]]; then
+ cat "${FILENAME}"
+ return
+ fi
+
+ dialog \
+ --clear \
+ --colors \
+ --title "${DIALOG_TITLE}" \
+ --textbox "${FILENAME}" 22 77
+}
+
+# Runs the pre installation checks to determine the following:
+# - Is there a remote Website?
+# - Which configuration file to use for the remote Website?
+#
+# The configuration file to use is decided using the following, in order:
+#
+# 1a. If ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} exists, use it.
+#
+# 1b. If ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE} exists,
+# copy it to ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} and use it.
+#
+# 2a. If there's a remote Website with a ${ALLSKY_WEBSITE_CONFIGURATION_NAME} file,
+# save it locally as ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} and use it.
+#
+# 2b. If there is a remote Website with an old-style configuration file (${OLD_CONFIG_NAME}),
+# create a NEW ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} and use it.
+# Don't bother trying to convert from old-style files.
+function pre_install_checks()
+{
+ display_msg --logonly info "Start pre installation checks."
+
+ local MSG=""
+ local DIALOG_TEXT DT
+ DIALOG_TEXT="\nWelcome to the Allsky Remote Website Installer!\n\n"
+ DIALOG_TEXT+="\nRunning pre installation checks.\n\n"
+
+ DIALOG_TEXT+="\n1 - Checking for remote Website configuration file on Pi: "
+ display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+
+ if [[ -f ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} ]]; then
+ # 1a.
+ DT="FOUND"
+ MSG="Found ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}."
+ display_msg --logonly info "${MSG}"
+ HAVE_NEW_CONFIG="true"
+
+### FIX / TODO: Should this be used?
+# During Allsky upgrades, if the OLD directory exists users are asked if
+# it should be used. If "yes", then the prior remote Website config file was
+# copied to the new Allsky, so 1a should match.
+# If the user answered "no", don't use OLD Allsky, we probably shouldn't either.
+ elif [[ -f ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE} ]]; then
+ # 1b.
+ DT="FOUND ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} in '${PRIOR_CONFIG_DIR}'"
+ MSG="Found ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE}."
+ display_msg --logonly info "${MSG}"
+ HAVE_PRIOR_CONFIG="true"
+
+ else
+ DT="NOT FOUND"
+ display_msg --logonly info "No local config files found."
+ fi
+ DIALOG_TEXT+="${DT}."
+ display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+
+ DIALOG_TEXT+="\n2 - Checking for existing remote Website: "
+ display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+ local INDENT=" "
+ REMOTE_WEBSITE_EXISTS="$( check_if_website_exists )"
+ if [[ ${REMOTE_WEBSITE_EXISTS} == "true" ]]; then
+
+ # If we didn't find a remote Website configuration file on the Pi,
+ # it's "should be" an old-style Website since the user wasn't
+ # using the WebUI to configure it.
+
+ DIALOG_TEXT+="FOUND."
+ display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+
+ # 2a.
+ DIALOG_TEXT+="\n${INDENT}* Checking it for new-style configuration file: "
+ display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+ local NEW_CONFIG_FILES=("${ALLSKY_WEBSITE_CONFIGURATION_NAME}")
+ if check_if_files_exist "${REMOTE_URL}" "or" "${NEW_CONFIG_FILES[@]}" ; then
+ HAVE_NEW_REMOTE_CONFIG="true"
+ DIALOG_TEXT+="Found."
+ display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+ MSG="Found a current configuration file on the remote server."
+ display_msg --logonly info "${MSG}"
+ else
+ # 2b.
+ DIALOG_TEXT+="Not found."
+ display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+
+ DIALOG_TEXT+="\n${INDENT}* Checking it for old-style configuration file:"
+ display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+ local REALLY_OLD_CONFIG_FILES=("${OLD_CONFIG_NAME}")
+ if check_if_files_exist "${REMOTE_URL}" "or" "${REALLY_OLD_CONFIG_FILES[@]}" ; then
+ HAVE_REALLY_OLD_REMOTE_CONFIG="true"
+ DT="FOUND"
+ MSG="Found old-style ${OLD_CONFIG_NAME} file on the remote Website."
+ display_msg --logonly info "${MSG}"
+ else
+ # This "shouldn't" happen - the remote Website should have SOME type
+ # of configuration file.
+ DT="NOT FOUND"
+ fi
+ DIALOG_TEXT+="${DT}."
+ display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+ fi
+ else
+ # No remote Website found.
+ DIALOG_TEXT+="NOT FOUND."
+ display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+
+ if [[ ${HAVE_NEW_CONFIG} == "true" || ${HAVE_PRIOR_CONFIG} == "true" ]]; then
+ DIALOG_TEXT+="${DIALOG_RED}"
+ DIALOG_TEXT+="\n${INDENT}WARNING: a remote configuration file exists"
+ DIALOG_TEXT+="\n${INDENT}but a remote Website wasn't found."
+ DIALOG_TEXT+="\n${INDENT}What is the configuration file for?"
+ DIALOG_TEXT+="${DIALOG_NORMAL}"
+ display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+ fi
+
+ fi
+
+ if [[ ${HAVE_NEW_CONFIG} == "true" ]]; then
+ if [[ ${HAVE_NEW_REMOTE_CONFIG} == "true" ]]; then
+ MSG="A remote configuration file was found but using the local version instead."
+ else
+ MSG="Using the local remote configuration file (no remote file found)."
+ fi
+ display_msg --logonly info "${MSG}"
+ CONFIG_TO_USE="local" # it may be old or current format
+ CONFIG_MESSAGE="the current remote"
+
+ elif [[ ${HAVE_PRIOR_CONFIG} == "true" ]]; then
+ local B="$( basename "${PRIOR_ALLSKY_DIR}" )"
+ MSG="Using the ${B} configuration file."
+ display_msg --logonly info "${MSG}"
+ CONFIG_TO_USE="prior" # it may be old or current format
+ CONFIG_MESSAGE="the ${B}"
+
+ elif [[ ${HAVE_NEW_REMOTE_CONFIG} == "true" ]]; then
+ MSG="Using new-style Website configuration file on the remote Website;"
+ MSG+=" it will be downloaded and saved locally."
+ display_msg --logonly info "${MSG}"
+ CONFIG_TO_USE="remoteNew"
+ CONFIG_MESSAGE="the remote Website's"
+
+ elif [[ ${HAVE_REALLY_OLD_REMOTE_CONFIG} == "true" ]]; then
+ MSG="Old ${OLD_CONFIG_NAME} found."
+ MSG+=" Creating a new configuration file that the user must manually update."
+ display_msg --logonly info "${MSG}"
+ CONFIG_TO_USE="remoteReallyOld"
+ CONFIG_MESSAGE="a new"
+
+ else
+ MSG="Unable to determine the configuration file to use. A new one will be created."
+ display_msg --logonly info "${MSG}"
+ CONFIG_TO_USE="new"
+ fi
+
+ DIALOG_TEXT+="\n * Checking ability to upload to it: "
+ display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+ display_msg --logonly info "Checking remote Website connectivity."
+ local ERR="$( check_connectivity )"
+ if [[ -z ${ERR} ]]; then
+ DIALOG_TEXT+="PASSED."
+ display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+ show_debug_message "The remote Website connectivity test succeeded."
+ else
+ local ERROR_MSG="\nERROR: The remote Website connectivity check failed."
+ display_aborted "${ERROR_MSG}" "${ERR}"
+ fi
+
+ display_msg --logonly info "Completed pre installation checks."
+
+ # Prompt the user to continue. This is so they can see the above messages.
+ DIALOG_TEXT+="\n\n\n${DIALOG_UNDERLINE}Press OK to continue${DIALOG_NORMAL}"
+ display_box "--msgbox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+}
+
+# Displays the welcome dialog indicating what steps will be taken
+function display_welcome()
+{
+ if [[ ${TEXT_ONLY} == "true" ]]; then
+ DIALOG_RED="${RED}"
+ DIALOG_NORMAL="${NC}"
+ fi
+
+ if [[ ${AUTO_CONFIRM} == "false" ]]; then
+ display_msg --logonly info "Displaying the welcome dialog."
+ local DIALOG_TEXT="\n\
+ This script will now:\n\n\
+ \
+ 1) Use ${CONFIG_MESSAGE} configuration file.\n\
+ 2) Upload the new remote Website code.\n\
+ 3) Upload the remote Website configuration file.\n\
+ 4) Enable the remote Website.\n\n\
+ \
+ ${DIALOG_RED}WARNING! This will:${DIALOG_NORMAL}\n\
+ - Overwrite the old Allsky web files on the remote server.\n\
+ - Remove any old Allsky files from the remote server.\n\n\n\
+ ${DIALOG_UNDERLINE}Are you sure you wish to continue?${DIALOG_NORMAL}"
+
+ if ! display_box "--yesno" "${DIALOG_WELCOME_TITLE}" "${DIALOG_TEXT}" ; then
+ display_aborted "--user" "at the Welcome dialog" ""
+ fi
+ else
+ display_msg --logonly info "Ignored welcome prompt as auto confirm option specified."
+ fi
+}
+
+# Displays the aborted dialog. This is used when an error is encountered or the user cancels.
+# ${1} - Extra text to display in the dialog
+# ${2} - Error message (or "" if no error)
+function display_aborted()
+{
+ if [[ ${1} == "--user" ]]; then
+ local ABORT_MSG="USER ABORTED INSTALLATION"
+ shift
+ else
+ local ABORT_MSG="INSTALLATION ABORTED"
+ fi
+ local EXTRA_TEXT="${1}"
+ local ERROR_MSG="${2}"
+
+ display_msg --logonly info "${ABORT_MSG} ${EXTRA_TEXT}.\n"
+ local MSG="\nInstallation of the remote Website aborted ${EXTRA_TEXT}."
+
+ if [[ -n ${ERROR_MSG} ]]; then
+ local DIALOG_PROMPT="${MSG}\n\n"
+ DIALOG_PROMPT+="${DIALOG_UNDERLINE}Would you like to view the error message?${DIALOG_NORMAL}"
+ if display_box "--yesno" "${DIALOG_INSTALL}" "${DIALOG_PROMPT}" ; then
+ display_box "--msgbox" "${DIALOG_TITLE_LOG}" "${ERROR_MSG}" "--scrollbar"
+if false; then
+ display_log_file "${DIALOG_TITLE_LOG}" "${DISPLAY_MSG_LOG}"
+fi
+ fi
+ fi
+
+ clear # Gets rid of background color from last 'dialog' command.
+ # Not needed: display_msg info "${ERROR_MSG}"
+
+ exit 1
+}
+
+# Displays the completed dialog, used at the end of the installation process.
+function display_complete()
+{
+ local EXTRA_TEXT=""
+ local E=" Please use the WebUI's 'Editor' page to replace any '${NEED_TO_UPDATE}' with the correct values."
+ if [[ ${CONFIG_TO_USE} == "new" ]]; then
+ EXTRA_TEXT="\nA new configuration file was created for your remote Website."
+ EXTRA_TEXT+="${E}"
+ elif [[ ${CONFIG_TO_USE} == "remoteReallyOld" ]]; then
+ EXTRA_TEXT="\nYou have a very old remote Allsky Website so a new configuration file was created."
+ EXTRA_TEXT+="${E}"
+ fi
+
+ display_msg --logonly info "INSTALLATION COMPLETED.\n"
+
+ local DIALOG_TEXT="\n\
+ The installation of the remote Website is complete\n\
+ and the remote Website should be working.\n\n\
+ Please check it.\n\n\
+ Use the WebUI's 'Editor' page to change settings for your Website.${EXTRA_TEXT}"
+ display_box "--msgbox" "${DIALOG_DONE}" "${DIALOG_TEXT}"
+
+ clear # Gets rid of background color from last 'dialog' command.
+ display_msg info "\nEnjoy your remote Allsky Website!\n"
+}
+
+# Check connectivity to the remote Website by trying to upload a file to it.
+# Return "" for success, else the error message.
+function check_connectivity()
+{
+ local TEST_FILE="${ME}.txt"
+ local ERR
+
+ if ERR="$( "${ALLSKY_SCRIPTS}/testUpload.sh" --website --silent --file "${TEST_FILE}" 2>&1 )" ; then
+ remove_remote_file "${TEST_FILE}" "do not check"
+ echo ""
+ else
+ echo "${ERR}"
+ fi
+}
+
+# Displays a debug message in the log if the debug flag has been specified on the command line.
+function show_debug_message()
+{
+ if [[ ${DEBUG} == "true" ]]; then
+ display_msg --logonly debug "${1}"
+ fi
+}
+
+# Update a Website config file if it's an old version.
+function update_old()
+{
+ local FILE="${1}"
+
+ local PRIOR_VERSION="$( settings ".${WEBSITE_CONFIG_VERSION}" "${FILE}" )"
+ local NEW_VERSION="$( settings ".${WEBSITE_CONFIG_VERSION}" "${REPO_WEBCONFIG_FILE}" )"
+ if [[ ${PRIOR_VERSION} < "${NEW_VERSION}" ]]; then
+ # Old version, so update to format of the current version.
+ update_old_website_config_file "${FILE}" "${PRIOR_VERSION}" "${NEW_VERSION}"
+ return 0
+ fi
+ return 1
+}
+
+# Creates the remote Website configuration file if needed.
+# See 'pre_install_checks' for details on which configuration file is used.
+function create_website_config()
+{
+ local MSG="Creating configuration file from ${CONFIG_MESSAGE}"
+ display_msg --logonly info "${MSG}"
+
+ if [[ ${CONFIG_TO_USE} == "new" || ${CONFIG_TO_USE} == "remoteReallyOld" ]]; then
+ # Need a new config file so copy it from the repo and replace as many
+ # placeholders as we can.
+ local DEST_FILE="${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}"
+ cp "${REPO_WEBCONFIG_FILE}" "${DEST_FILE}"
+ replace_website_placeholders "remote"
+
+ MSG="Created a new ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME}"
+ MSG+=" from repo and updated placeholders."
+ display_msg --logonly info "${MSG}"
+
+ elif [[ ${CONFIG_TO_USE} == "local" ]]; then
+ # Using the remote config file on the Pi which may be new or old format.
+ MSG="Using existing ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME}"
+ if update_old "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" ; then
+ MSG+=" and converting to newest format."
+ fi
+ display_msg --logonly info "${MSG}"
+
+ elif [[ ${CONFIG_TO_USE} == "prior" ]]; then
+ # Use the config file from the prior Allsky, replacing as many placeholders as we can.
+ # If the file is an older version, convert to the newest format.
+ cp "${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE}" "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}"
+ replace_website_placeholders "remote"
+ update_old "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}"
+
+ MSG="Copied ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} from the"
+ MSG+=" $( basename "${PRIOR_ALLSKY_DIR}" ) directory and updated placeholders."
+ display_msg --logonly info "${MSG}"
+
+ elif [[ ${CONFIG_TO_USE} == "remoteNew" ]]; then
+ # Use the new remote config file since none were found locally.
+ # Replace placeholders and convert it to the newest format.
+ # Remember that the remote file name is different than what we store on the Pi.
+ if ERR="$( wget -O "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" "${REMOTE_URL}/${ALLSKY_WEBSITE_CONFIGURATION_FILE}" 2>&1 )"; then
+ replace_website_placeholders "remote"
+ update_old "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}"
+
+ MSG="Downloaded ${ALLSKY_WEBSITE_CONFIGURATION_FILE} from ${REMOTE_URL},"
+ MSG+=" to ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}."
+ display_msg --logonly info "${MSG}"
+ else
+ # This "shouldn't" happen since we either already checked the file exists,
+ # or we uploaded it.
+ MSG="Failed to download ${ALLSKY_WEBSITE_CONFIGURATION_FILE} from ${REMOTE_URL}."
+ MSG+=" Where did it go?"
+ display_aborted "${MSG}" "${ERR}"
+ fi
+ fi
+}
+
+# Check if a remote file, or array of files, exist.
+# ${1} - The base url
+# ${2} - "and"/"or" If "and" then all files must exist, if "or" then any of the files can exist.
+# ${3}... - the files
+#
+# Returns - 0 if the file(s) exist, 1 if ANY file doesn't exist.
+function check_if_files_exist()
+{
+ local URL="${1}"
+ local AND_OR="${2}"
+ shift 2
+ local RET_CODE=1
+
+ for FILE in "$@"; do
+ url="${URL}/${FILE}"
+ HTTP_STATUS="$( curl -o /dev/null --head --silent --write-out "%{http_code}" "$url" )"
+
+ local PRE_MSG="File ${FILE} ${url}"
+ if [[ ${HTTP_STATUS} == "200" ]] ; then
+ show_debug_message "${PRE_MSG} exists on the remote server"
+ RET_CODE=0
+ else
+ show_debug_message "${PRE_MSG} does not exists on the remote server"
+ if [[ ${AND_OR} == "and" ]]; then
+ return 1
+ fi
+ fi
+ done
+
+ return ${RET_CODE}
+}
+
+# Deletes a file from the remote server.
+# ${1} - The name of the file to delete
+# ${2} - If set to "check", first check if the file exists
+#
+# Returns - Nothing
+function remove_remote_file()
+{
+ local FILENAME="${1}"
+ local CHECK="${2}"
+
+ if [[ ${CHECK} == "check" ]]; then
+ if ! check_if_files_exist "${REMOTE_URL}" "or" "${FILENAME}" ; then
+ show_debug_message "===== not on server"
+ return
+ fi
+ fi
+
+# TODO: This assumes ftp is used to upload files
+# upload.sh should accept "--remove FILE" option.
+ local CMDS="" ERR
+ [[ -n ${REMOTE_DIR} ]] && CMDS="cd '${REMOTE_DIR}' ;"
+ CMDS+=" rm -r '${FILENAME}' ; bye"
+
+ ERR="$( lftp -u "${REMOTE_USER},${REMOTE_PASSWORD}" \
+ "${REMOTE_PORT}" \
+ "${REMOTE_PROTOCOL}://${REMOTE_HOST}" \
+ -e "${CMDS}" 2>&1 )"
+ if [[ $? -eq 0 ]] ; then
+ MSG="Deleted remote file '${FILENAME}'"
+ else
+ MSG="Unable to delete remote file '${FILENAME}': ${ERR}"
+ fi
+
+ display_msg --logonly info "${MSG}"
+}
+
+# Check if a remote Website exists.
+# The check is done by looking for the following files:
+# If any of the ${CONFIG_FILES} files exist AND
+# all of the ${WEBSITE_FILES} exist then assume we have a remote Website.
+#
+# Returns - echo "true" if it exists, else "false"
+function check_if_website_exists()
+{
+ local CONFIG_FILES=("${OLD_CONFIG_NAME}" "${ALLSKY_WEBSITE_CONFIGURATION_NAME}")
+ local WEBSITE_FILES=("index.php" "functions.php")
+
+ if check_if_files_exist "${REMOTE_URL}" "or" "${CONFIG_FILES[@]}" ; then
+ show_debug_message "Found a remote Website config file"
+
+ if check_if_files_exist "${REMOTE_URL}" "and" "${WEBSITE_FILES[@]}" ; then
+ display_msg --logonly info "Found a remote Allsky Website at ${REMOTE_URL}"
+ echo "true"
+ return 0
+ fi
+ fi
+ echo "false"
+ return 1
+}
+
+# Uploads the Website code from ${ALLSKY_WEBSITE} and removes any old Allsky
+# files that are no longer used.
+function upload_remote_website()
+{
+ if [[ ${SKIP_UPLOAD} == "true" ]]; then
+ display_msg --logonly info "Skipping upload per user request.\n"
+ return
+ fi
+
+ local EXTRA_TEXT="" EXCLUDE_FOLDERS="" MSG
+
+ if [[ -n ${REMOTE_PORT} ]]; then
+ REMOTE_PORT="-p ${REMOTE_PORT}"
+ fi
+
+ MSG="Starting upload to the remote Website"
+ [[ -n ${REMOTE_DIR} ]] && MSG+=" in ${REMOTE_DIR}"
+ if [[ ${REMOTE_WEBSITE_EXISTS} == "true" ]]; then
+
+ # Don't upload images if the remote Website exists (we assume it already
+ # has the images).
+ # However, we must upload the index.php files.
+ EXCLUDE_FOLDERS="--exclude keograms --exclude startrails --exclude videos"
+
+# FIX: the --include doesn't work - the files aren't uploaded.
+# Do we need to do a second lftp mirror to upload them?
+ EXCLUDE_FOLDERS+=" --include keograms/index.php"
+ EXCLUDE_FOLDERS+=" --include startrails/index.php"
+ EXCLUDE_FOLDERS+=" --include videos/index.php"
+ MSG+=" (without videos, images, and their thumbnails)."
+ fi
+ display_msg --logonly info "${MSG}${EXTRA_TEXT}."
+
+ MSG="\n${MSG}\n\nThis may take several minutes..."
+ display_box "--infobox" "${DIALOG_INSTALL}" "${MSG}"
+
+# TODO: upload.sh should have a "--mirror from_directory to_directory" option.
+# This would also fix the problem that we're assuming the "ftp" protocol is used.
+ local NL="$( echo -e "\n " )" # Need space otherwise it doesn't work - not sure why
+ local CMDS=" lcd '${ALLSKY_WEBSITE}'"
+ CMDS+="${NL}set dns:fatal-timeout 10; set net:max-retries 2; set net:timeout 10"
+ # shellcheck disable=SC2086
+ if [[ -n "${REMOTE_DIR}" ]]; then
+ CMDS+="${NL}cd '${REMOTE_DIR}'"
+ else
+ CMDS+="${NL}cd ." # for debugging
+ fi
+ CMDS+="${NL}mirror --reverse --no-perms --verbose --overwrite --ignore-time --transfer-all"
+ [[ -n ${EXCLUDE_FOLDERS} ]] && CMDS+=" ${EXCLUDE_FOLDERS}"
+ CMDS+="${NL}bye"
+
+ local TMP="${ALLSKY_TMP}/remote_upload.txt"
+ echo -e "CMDS=${CMDS}\n======" > "${TMP}"
+ # shellcheck disable=SC2086
+ lftp -u "${REMOTE_USER},${REMOTE_PASSWORD}" \
+ ${REMOTE_PORT} "${REMOTE_PROTOCOL}://${REMOTE_HOST}" -e "${CMDS}" >> "${TMP}" 2>&1
+ local RET_CODE=$?
+
+ # Ignore stuff not supported by all FTP servers and stuff we don't want to see.
+ local IGNORE="operation not supported|command not understood|hostname checking disabled|Overwriting old file"
+ MSG="$( grep -v -i -E "${IGNORE}" "${TMP}" )"
+ # If the "mirror" command causes any of the messages above,
+ # they are counted as errors.
+ if [[ ${RET_CODE} -ne 0 ]]; then
+ MSG="$( echo -e "RET_CODE=${RET_CODE}\nCMDS=${CMDS}\n${MSG}" | sed -e 's/$/\\n/' )"
+ display_aborted "while uploading Website" "${MSG}"
+ fi
+
+ display_msg --logonly info "$( indent --spaces "${MSG}" )"
+
+ # Remove any old core files no longer required
+ for FILE_TO_DELETE in "${OLD_FILES_TO_REMOVE[@]}"; do
+ remove_remote_file "${FILE_TO_DELETE}" "check"
+ done
+
+ display_msg --logonly info "Website upload complete"
+}
+
+# Uploads the configuration file for the remote Website.
+function upload_config_file()
+{
+ local MSG="\nUploading remote Allsky configuration file"
+ display_box "--infobox" "${DIALOG_INSTALL}" "${MSG}"
+ display_msg --logonly info "Uploading Website configuration file."
+
+ local ERR="$( "${ALLSKY_SCRIPTS}/upload.sh" --remote-web \
+ "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" "${REMOTE_DIR}" \
+ "${ALLSKY_WEBSITE_CONFIGURATION_NAME}" 2>&1 )"
+ if [[ $? -eq 0 ]]; then
+ MSG="${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} uploaded to"
+ MSG+="${REMOTE_DIR}/${ALLSKY_WEBSITE_CONFIGURATION_NAME}"
+ show_debug_message "${MSG}"
+ else
+ display_msg --logonly info " Failed: ${ERR}"
+ display_aborted "at the configuration file upload" "${ERR}"
+ fi
+}
+
+# Displays the script's help.
+usage_and_exit()
+{
+ local RET C MSG
+
+ RET=${1}
+ if [[ ${RET} -eq 0 ]]; then
+ C="${YELLOW}"
+ else
+ C="${RED}"
+ fi
+ MSG="Usage: ${ME} [--help] [--debug] [--skipupload] [-auto] [--text]"
+ {
+ echo -e "\n${C}${MSG}${NC}"
+ echo
+ echo "'--help' displays this message and exits."
+ echo
+ echo "'--debug' adds addtional debugging information to the installation log."
+ echo
+ echo "'--skipupload' Skips uploading of the remote Website code."
+ echo " Must only be used if advised by Allsky support."
+ echo
+ echo "'--auto' Accepts all prompts by default"
+ echo
+ echo "'--text' Text only mode, do not use any dialogs"
+ echo
+ } >&2
+ exit "${RET}"
+}
+
+# Disable the remote Website.
+function disable_remote_website()
+{
+ update_json_file ".useremotewebsite" "false" "${SETTINGS_FILE}"
+ display_msg --logonly info "Remote Website temporarily disabled."
+}
+# Enable the remote Website.
+function enable_remote_website()
+{
+ update_json_file ".useremotewebsite" "true" "${SETTINGS_FILE}"
+ display_msg --logonly info "Remote Website enabled."
+}
+
+############################################## main body
+OK="true"
+HELP="false"
+SKIP_UPLOAD="false"
+AUTO_CONFIRM="false"
+TEXT_ONLY="false"
+DEBUG="false"
+
+while [[ $# -gt 0 ]]; do
+ ARG="${1}"
+ case "${ARG,,}" in
+ --help)
+ HELP="true"
+ ;;
+ --debug)
+ DEBUG="true"
+ ;;
+ --skipupload)
+ SKIP_UPLOAD="true"
+ ;;
+ --auto)
+ AUTO_CONFIRM="true"
+ ;;
+ --text)
+ TEXT_ONLY="true"
+ LOG_TYPE="--log"
+ ;;
+ *)
+ display_msg --log error "Unknown argument: '${ARG}'."
+ OK="false"
+ ;;
+ esac
+ shift
+done
+
+[[ ${HELP} == "true" ]] && usage_and_exit 0
+[[ ${OK} == "false" ]] && usage_and_exit 1
+
+display_msg --logonly info "STARTING INSTALLATION.\n"
+
+pre_install_checks
+display_welcome
+create_website_config
+disable_remote_website
+upload_remote_website
+upload_config_file
+enable_remote_website
+display_complete
From 06024bfae22f799c27add38333d3c23482e753bd Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Fri, 6 Dec 2024 14:11:47 -0600
Subject: [PATCH 032/108] Update changeLog.html: rename
remote_website_install.sh
---
html/documentation/changeLog.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/html/documentation/changeLog.html b/html/documentation/changeLog.html
index cd7dc6399..aaa6240fa 100644
--- a/html/documentation/changeLog.html
+++ b/html/documentation/changeLog.html
@@ -123,11 +123,11 @@ Enhancements / Changes
Image Directory in the WebUI.
Installing a Website on a remote server is significantly easier as well.
- Use the new remote_website_install.sh command;
+ Use the new remoteWebsiteInstall.sh command;
it will upload the Allsky Website files for you and remove any
old, unneeded files.
If this is a new remote Website,
- remote_website_install.sh will ask you whether or not to
+ remoteWebsiteInstall.sh will ask you whether or not to
also upload any startrails, keograms, and timelapse videos on your Pi.
Images, timelapse, keograms, and startrails can now be written
From 66e703199cc04b56921f3423b576c81aa6a517e5 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Fri, 6 Dec 2024 14:12:45 -0600
Subject: [PATCH 033/108] Update layout.html: rename remote_website_install.sh
---
html/documentation/explanations/layout.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/documentation/explanations/layout.html b/html/documentation/explanations/layout.html
index 4dbfe8d8a..1077e3977 100644
--- a/html/documentation/explanations/layout.html
+++ b/html/documentation/explanations/layout.html
@@ -157,7 +157,7 @@
You'll normally view the Allsky Documentation via the WebUI's
Documentation link instead of this file.
- remote_website_install.sh
+ remoteWebsiteInstall.sh
The program used to prepare an optional remote Allsky Website.
This should only be run after viewing the
From 4bb34c9fd5ce68171e366caf89b7f2cf48726d17 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Fri, 6 Dec 2024 14:14:17 -0600
Subject: [PATCH 034/108] Update install.sh: rename remote_website_install.sh
---
install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install.sh b/install.sh
index a2c8c7e21..c54b4c2f0 100755
--- a/install.sh
+++ b/install.sh
@@ -2503,7 +2503,7 @@ restore_prior_files()
MSG="Your remote Website needs to be updated to this newest version."
MSG+="\nIt is at version ${PRIOR_V}"
# This command will update the version.
- MSG+="\n\nRun: cd ~/allsky; ./remote_website_install.sh"
+ MSG+="\n\nRun: cd ~/allsky; ./remoteWebsiteInstall.sh"
display_msg --log notice "${MSG}"
fi
else
From 9935303bd324f1a22c1e7531088ca837105622c7 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Fri, 6 Dec 2024 14:15:05 -0600
Subject: [PATCH 035/108] Update checkAllsky.sh: rename
remote_website_install.sh
---
scripts/checkAllsky.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkAllsky.sh b/scripts/checkAllsky.sh
index f29d3a82e..ed3a0cb6e 100755
--- a/scripts/checkAllsky.sh
+++ b/scripts/checkAllsky.sh
@@ -786,7 +786,7 @@ if [[ ${CHECK_ERRORS} == "true" ]]; then
if [[ ${S_useremotewebsite} == "true" && ! -f ${f} ]]; then
heading "Error"
echo "${WSNs}${S_useremotewebsite_label}${WSNe} is enabled but '${f}' does not exist."
- echo "FIX: Either disable ${WSNs}${S_useremotewebsite_label}${WSNe} or run 'cd ~/allsky; ./remote_website_install.sh'."
+ echo "FIX: Either disable ${WSNs}${S_useremotewebsite_label}${WSNe} or run 'cd ~/allsky; ./remoteWebsiteInstall.sh'."
fi
##### Check dark frames
From ac2e4e484f77a4dad08bb7627023c88571ec8db3 Mon Sep 17 00:00:00 2001
From: Alex
Date: Sat, 7 Dec 2024 23:56:42 +0000
Subject: [PATCH 036/108] #4014 Hotfix for missing dialog installation
---
install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install.sh b/install.sh
index 87ae62db1..0bcb6ceb4 100755
--- a/install.sh
+++ b/install.sh
@@ -3516,7 +3516,7 @@ install_installer_dependencies()
display_msg --log progress "Installing installer dependencies."
TMP="${ALLSKY_LOGS}/installer.dependencies.log"
{
- sudo apt-get update && run_aptGet gawk jq
+ sudo apt-get update && run_aptGet gawk jq dialog
} > "${TMP}" 2>&1
check_success $? "gawk,jq installation failed" "${TMP}" "${DEBUG}" ||
exit_with_image 1 "${STATUS_ERROR}" "gawk,jq install failed."
From 1aec341cfff328cc98b52958119ef210d42a7a4e Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sat, 7 Dec 2024 21:19:16 -0600
Subject: [PATCH 037/108] Update functions.php
---
html/includes/functions.php | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/html/includes/functions.php b/html/includes/functions.php
index e380b18ec..10e692898 100644
--- a/html/includes/functions.php
+++ b/html/includes/functions.php
@@ -10,12 +10,21 @@
// This file sets all the define() variables.
$defs = 'allskyDefines.inc';
if ((include $defs) == false) {
- echo "
";
- echo "The installation of the WebUI is incomplete. ";
+ echo " ";
+ echo "The installation of Allsky is incomplete. ";
echo "File '$defs' not found. ";
- echo "Please run the following to fix:";
+ echo " ";
+
echo " ";
- echo " cd ~/allsky; ./install.sh --function create_webui_defines ";
+ echo " ";
+ echo "If you have NOT installed Allsky please install it by running:";
+ echo " ";
+ echo " cd ~/allsky; ./install.sh ";
+ echo "The WebUI will not work until Allsky is installed.";
+
+ echo " ";
+ echo "If you HAVE successfully installed Allsky, run the following to fix this problem:";
+ echo " cd ~/allsky; ./install.sh --function create_webui_defines ";
echo " ";
exit(1);
}
From abfd1e852203560f1cd34533e79e7e8a3a676549 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sat, 7 Dec 2024 21:50:32 -0600
Subject: [PATCH 038/108] Update viewSettings.php: improve message
If a user goes to a Website that has never been enabled, the files in the "viewSettings/" directory won't exist, and they'll get a somewhat useless message.
Improve the message by telling them how to fix the problem.
---
html/allsky/viewSettings.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/html/allsky/viewSettings.php b/html/allsky/viewSettings.php
index 9725d42c2..a5ab83b6c 100644
--- a/html/allsky/viewSettings.php
+++ b/html/allsky/viewSettings.php
@@ -9,6 +9,9 @@
echo " ";
echo "This Allsky Website is not fully configured so its settings cannot be displayed.";
echo " It is missing the '$settingsScript' file.";
+ echo "
";
+ echo "To fix: make sure the Website is enabled in the Websites and Remote Server Settings";
+ echo "section of the WebUI's Allsky Settings page.";
echo " ";
exit(1);
}
From e5e40529d60a79988008611874378ae74026b2a6 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sat, 7 Dec 2024 23:09:47 -0600
Subject: [PATCH 039/108] Update checkAllsky.sh: Separate messages when in
WebUI
When checkAllsky.sh output is displayed in the WebUI there is no space between messages so it's hard to read.
Fix by adding a blank line between messages.
---
scripts/checkAllsky.sh | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/checkAllsky.sh b/scripts/checkAllsky.sh
index ed3a0cb6e..b870c711c 100755
--- a/scripts/checkAllsky.sh
+++ b/scripts/checkAllsky.sh
@@ -119,14 +119,19 @@ function heading()
if [[ ${FROM_WEBUI} == "true" ]]; then
# Don't display the header when run from the WebUI.
- return
+ DISPLAY_HEADER="false"
fi
if [[ ${DISPLAY_HEADER} == "true" ]]; then
[[ ${NUM_HEADER_CALLS} -gt 1 ]] && echo -e "${NL}"
echo -e "${STRONGs}---------- ${HEADER}${SUB_HEADER} ----------${STRONGe}${NL}"
else
- echo "${STRONGs}-----${STRONGe}" # Separates lines within a header group
+ # Separate entries within a header group
+ if [[ ${FROM_WEBUI} == "true" ]]; then
+ echo
+ else
+ echo "${STRONGs}-----${STRONGe}"
+ fi
fi
}
From f320dd96499800f8191cc13198cfb6903eeead85 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sat, 7 Dec 2024 23:11:57 -0600
Subject: [PATCH 040/108] Update custom.css: add noChanges class
---
html/documentation/css/custom.css | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/html/documentation/css/custom.css b/html/documentation/css/custom.css
index 21fbf7d5b..323bb12ab 100644
--- a/html/documentation/css/custom.css
+++ b/html/documentation/css/custom.css
@@ -269,6 +269,12 @@ body.dark {
vertical-align: top;
}
+.noChanges {
+ font-weight: bold;
+ font-size: 110%;
+ padding: 5px 0 5px 2px;
+}
+
.alert {
padding: 5px;
margin-bottom: 3px;
@@ -887,4 +893,4 @@ div.sticky {
}
.ml-5 {
margin-left: 3rem !important;
-}
\ No newline at end of file
+}
From 96b010d9c46c35cc34f12e753290328a2d9cee1a Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sat, 7 Dec 2024 23:13:09 -0600
Subject: [PATCH 041/108] Update allskySettings.php: add "noChanges" class
And change the message type to "message" since it's not a warning.
---
html/includes/allskySettings.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/html/includes/allskySettings.php b/html/includes/allskySettings.php
index 615607215..43ff2a1f4 100644
--- a/html/includes/allskySettings.php
+++ b/html/includes/allskySettings.php
@@ -504,8 +504,8 @@ function DisplayAllskyConfig() {
if ($ok) {
if (! $changesMade && ! $fromConfiguration) {
- $msg = "No settings changed. Nothing updated.";
- $status->addMessage($msg, 'warning');
+ $msg = " No settings changed. Nothing updated. ";
+ $status->addMessage($msg, 'message');
$msg = "";
} else if ($changes !== "") {
$moreArgs = "";
From 51791e4ba1be1c8453f1ee2c3783fa181ebc64c1 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sat, 7 Dec 2024 23:51:28 -0600
Subject: [PATCH 042/108] Update installUpgradeFunctions.sh: Create file if
needed
If the installation log file doesn't exist and we try to write to it, we'll get an error.
---
scripts/installUpgradeFunctions.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/installUpgradeFunctions.sh b/scripts/installUpgradeFunctions.sh
index b20501efe..5f3a5524a 100644
--- a/scripts/installUpgradeFunctions.sh
+++ b/scripts/installUpgradeFunctions.sh
@@ -228,6 +228,10 @@ function display_msg()
# ${DISPLAY_MSG_LOG} be set if ${LOG_IT} is true, but just in case, check.
[[ ${LOG_IT} == "false" || -z ${DISPLAY_MSG_LOG} ]] && return
+ if [[ ! -f ${DISPLAY_MSG_LOG} ]]; then
+ mkdir -p "$( dirname "${DISPLAY_MSG_LOG}" )"
+ touch "${DISPLAY_MSG_LOG}"
+ fi
# Strip out all color escape sequences before adding to log file.
# The message may have an actual escape character or may have the
From d2486a87b62879d88d59463b1465273ec2797292 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sun, 8 Dec 2024 00:09:34 -0600
Subject: [PATCH 043/108] Update install.sh: Warn in no RPi camera command was
found
---
install.sh | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/install.sh b/install.sh
index 0bcb6ceb4..a1e9592ff 100755
--- a/install.sh
+++ b/install.sh
@@ -302,10 +302,11 @@ CT=() # Camera Type array - what to display in whiptail
get_connected_cameras()
{
- local CMD CC MSG NUM_RPI=0 NUM_ZWO=0
+ local CMD CMD_RET CC MSG NUM_RPI=0 NUM_ZWO=0
# true == ignore errors. ${CMD} will be "" if no command found.
CMD="$( determineCommandToUse "false" "" "true" 2> /dev/null )"
+ CMD_RET=$? # return of 2 means no command was found
setup_rpi_supported_cameras "${CMD}" # Will create full file is CMD == ""
# RPi format: RPi \t camera_number \t camera_sensor [\t optional_other_stuff]
@@ -357,7 +358,12 @@ get_connected_cameras()
whiptail --title "${TITLE}" --msgbox "${MSG}" 12 "${WT_WIDTH}" 3>&1 1>&2 2>&3
MSG="No connected cameras were detected."
- display_msg --log error "${MSG}"
+ local MSG2=""
+ if [[ ${CMD_RET} -eq 2 ]]; then
+ MSG2="No command to take RPi images was found"
+ MSG2+=" - make sure 'libcamera-apps' is installed if you have an RPi camera."
+ fi
+ display_msg --log error "${MSG}" "${MSG2}"
exit_installation 1 "${STATUS_NO_CAMERA}" ""
fi
@@ -540,6 +546,7 @@ do_save_camera_capabilities()
MSG="No camera was found; one must be connected and working for the installation to succeed.\n"
MSG+="After connecting your camera, re-run the installation."
whiptail --title "${TITLE}" --msgbox "${MSG}" 12 "${WT_WIDTH}" 3>&1 1>&2 2>&3
+
display_msg --log error "No camera detected - installation aborted."
[[ -s ${TMP} ]] && display_msg --log error "$( < "${TMP}" )"
exit_with_image 1 "${STATUS_ERROR}" "No camera detected"
@@ -3518,8 +3525,8 @@ install_installer_dependencies()
{
sudo apt-get update && run_aptGet gawk jq dialog
} > "${TMP}" 2>&1
- check_success $? "gawk,jq installation failed" "${TMP}" "${DEBUG}" ||
- exit_with_image 1 "${STATUS_ERROR}" "gawk,jq install failed."
+ check_success $? "gawk,jq,dialog installation failed" "${TMP}" "${DEBUG}" ||
+ exit_with_image 1 "${STATUS_ERROR}" "gawk,jq,dialog install failed."
STATUS_VARIABLES+=( "${FUNCNAME[0]}='true'\n" )
}
@@ -3901,4 +3908,4 @@ else
fi
display_msg progress "\nEnjoy Allsky!\n"
-exit_installation 0 "${STATUS_OK}" ""
\ No newline at end of file
+exit_installation 0 "${STATUS_OK}" ""
From 33574ea3c33c58809c237754a6f98709d521feed Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sun, 8 Dec 2024 00:10:47 -0600
Subject: [PATCH 044/108] Update functions.sh: Keep track of RPi command was
found
---
scripts/functions.sh | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/scripts/functions.sh b/scripts/functions.sh
index f7bc21e71..4a727e246 100644
--- a/scripts/functions.sh
+++ b/scripts/functions.sh
@@ -187,7 +187,7 @@ function determineCommandToUse()
local PREFIX="${2}" # Only used if calling doExit().
local IGNORE_ERRORS="${3:-false}" # True if just checking
- local CRET RET MSG EXIT_MSG
+ local CRET RET MSG EXIT_MSG CMD_FOUND="false"
# If libcamera is installed and works, use it.
# If it's not installed, or IS installed but doesn't work (the user may not have it configured),
@@ -203,7 +203,9 @@ function determineCommandToUse()
CRET=$?
fi
if [[ ${CRET} -eq 0 ]]; then
- # Found the command - see if it works.
+ CMD_FOUND="true" # one of the commands were found.
+
+ # Found a command - see if it works.
"${CMD_TO_USE_}" --timeout 1 --nopreview > /dev/null 2>&1
RET=$?
if [[ ${RET} -eq 137 ]]; then
@@ -230,9 +232,15 @@ function determineCommandToUse()
fi
fi
- return 1
+ if [[ ${CMD_FOUND} == "true" ]]; then
+ return 1
+ else
+ return 2 # no command was found
+ fi
fi
+ CMD_FOUND="true" # some command was found.
+
# On Buster, raspistill sometimes hangs if no camera is found,
# so work around that.
if ! timeout 4 "${CMD_TO_USE_}" --timeout 1 --nopreview > /dev/null 2>&1 ; then
From 531c3111eec953f861192873b145707ddd33afd1 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sun, 8 Dec 2024 00:17:54 -0600
Subject: [PATCH 045/108] Update install.sh: Pass results of
determineCommandToUse()
---
install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install.sh b/install.sh
index a1e9592ff..9f46f6528 100755
--- a/install.sh
+++ b/install.sh
@@ -312,7 +312,7 @@ get_connected_cameras()
# RPi format: RPi \t camera_number \t camera_sensor [\t optional_other_stuff]
# ZWO format: ZWO \t camera_number \t camera_model
# "true" == ignore errors
- get_connected_cameras_info "true" > "${CONNECTED_CAMERAS_INFO}" 2>/dev/null
+ get_connected_cameras_info --cmd "${CMD}" "true" > "${CONNECTED_CAMERAS_INFO}" 2>/dev/null
# Get the RPi connected cameras, if any.
CC=""
From 97e6160b04f26b0756550ef071cb76a0c46ecdc2 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sun, 8 Dec 2024 00:22:04 -0600
Subject: [PATCH 046/108] Update functions.sh: check if determineCommandToUse()
was already run
---
scripts/functions.sh | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/scripts/functions.sh b/scripts/functions.sh
index 4a727e246..c8996ecd8 100644
--- a/scripts/functions.sh
+++ b/scripts/functions.sh
@@ -269,6 +269,12 @@ function determineCommandToUse()
# Prepend each line with the CAMERA_TYPE.
function get_connected_cameras_info()
{
+ local RUN_dCTU="true" # determine Command To Use
+ if [[ ${1} == "--cmd" ]]; then
+ RUN_dCTU="false"
+ CMD_TO_USE_="${2}"
+ shift 2
+ fi
local IGNORE_ERRORS="${1:-false}"
####### Check for RPi
@@ -276,7 +282,8 @@ function get_connected_cameras_info()
# RPi camera_number camera_sensor
# for each camera found.
# camera_sensor will be one word.
- if [[ -z ${CMD_TO_USE_} ]]; then
+ # Only run determineCommandToUse() if it wasn't already run.
+ if [[ -z ${CMD_TO_USE_} && ${RUN_dCTU} == "true" ]]; then
determineCommandToUse "false" "" "${IGNORE_ERRORS}" > /dev/null
fi
if [[ -n ${CMD_TO_USE_} ]]; then
From da2bc7325a8c8c821a35d836230256a9b74e3fb0 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sun, 8 Dec 2024 16:08:15 -0600
Subject: [PATCH 047/108] Update removeBadImages.sh: include timelapse in Usage
message
---
scripts/removeBadImages.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/removeBadImages.sh b/scripts/removeBadImages.sh
index 40f3541fa..1176ae876 100755
--- a/scripts/removeBadImages.sh
+++ b/scripts/removeBadImages.sh
@@ -21,7 +21,8 @@ usage_and_exit()
local RET="${1}"
{
echo
- echo "Remove images with corrupt data which might mess up startrails and keograms."
+ echo "Remove images with corrupt data which might mess up startrails, keograms, and timelapse."
+ echo
[ "${RET}" -ne 0 ] && echo -en "${RED}"
echo -n "Usage: ${ME} [--help] [--debug] directory [file]"
[ "${RET}" -ne 0 ] && echo -e "${NC}"
From 880f2f7cbe180fa9095f03040bf0a39d259df742 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sun, 8 Dec 2024 17:11:55 -0600
Subject: [PATCH 048/108] Update functions.sh: Check for "Planetary Camera" in
ZWO name
This is the same as the recent problem with an older ASI120 camera with "ZWOptical company" in its USB name.
---
scripts/functions.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/functions.sh b/scripts/functions.sh
index c8996ecd8..7948728ee 100644
--- a/scripts/functions.sh
+++ b/scripts/functions.sh
@@ -317,7 +317,8 @@ function get_connected_cameras_info()
{
if ($1 == "Bus" && $3 == "Device") {
ZWO = $7;
- if (ZWO == "ZWOptical" && $8 == "company") {
+ if ((ZWO == "ZWOptical" && $8 == "company") ||
+ (ZWO == "Planetary" && $8 == "Camera")) {
model = $9;
model_cont = 10;
} else {
From 9a407bf7c95a111679c727f226c7a4f4caf04726 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sun, 8 Dec 2024 17:23:31 -0600
Subject: [PATCH 049/108] Update 2-bug_report.yml: mention attaching
"install.log" if needed
---
.github/ISSUE_TEMPLATE/2-bug_report.yml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/.github/ISSUE_TEMPLATE/2-bug_report.yml b/.github/ISSUE_TEMPLATE/2-bug_report.yml
index 9418fa4c7..cb1ba1a65 100644
--- a/.github/ISSUE_TEMPLATE/2-bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/2-bug_report.yml
@@ -53,20 +53,20 @@ body:
\* Include a clear and concise description of what the problem is.
\* Include a screenshot of any error message(s).
\* Can you reproduce it? If so, how?
- \* Did any settings or anything else change?
validations:
required: true
- type: textarea
id: logs
attributes:
- label: Log / configuration files
+ label: Log and configuration files (ATTACH files, do NOT copy/paste them)
description: |
- ATTACH files, do NOT copy/paste them:
+ If the problem occured during installation, attach:
+ \* `~/allsky/config/logs/install.log`
- Follow the instructions for "Reporting Issues" in the Wiki, then attach `/var/log/allsky.log`.
+ Follow the instructions for "Reporting Issues" in the Allsky Documentation, then attach `/var/log/allsky.log`.
Attach `~/allsky/config/settings.json`, appending `.txt` to its name first.
If your problem is with an **Allsky Website**, also attach:
\* `~/allsky/html/allsky/configuration.json` (local Website)
- \* `~/allsky/config/remote_configuration.json` (remote Website)
\ No newline at end of file
+ \* `~/allsky/config/remote_configuration.json` (remote Website)
From a0e43e2a4ad20b321c46b16c91b2cec4f26cedc0 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sun, 8 Dec 2024 21:47:19 -0600
Subject: [PATCH 050/108] Update ASI_functions.cpp: Fix misspellings
---
src/ASI_functions.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/ASI_functions.cpp b/src/ASI_functions.cpp
index c474a6488..2c8ef782a 100644
--- a/src/ASI_functions.cpp
+++ b/src/ASI_functions.cpp
@@ -337,17 +337,17 @@ ASI_CAMERA_INFO ASICameraInfoArray[] =
12, ASI_FALSE, ASI_FALSE
},
- { "imx519", 0, "ArduCam 16 MP", 0, 3496, 4656, ASI_TRUE,
+ { "imx519", 0, "Arducam 16 MP", 0, 3496, 4656, ASI_TRUE,
BAYER_RG, {1, 2, 0}, {ASI_IMG_RGB24, ASI_IMG_END}, 1.22, ASI_FALSE,
10, ASI_FALSE, ASI_TRUE
},
- { "arducam_64mp", 0, "ArduCam 64 MP", 0, 6944, 9152, ASI_TRUE,
+ { "arducam_64mp", 0, "Arducam 64 MP", 0, 6944, 9152, ASI_TRUE,
BAYER_RG, {1, 2, 0}, {ASI_IMG_RGB24, ASI_IMG_END}, 0.8, ASI_FALSE,
10, ASI_FALSE, ASI_TRUE
},
- { "arducam-pivariety", 0, "ArduCam 462", 0, 1080, 1920, ASI_TRUE,
+ { "arducam-pivariety", 0, "Arducam 462", 0, 1080, 1920, ASI_TRUE,
BAYER_RG, {1, 2, 0}, {ASI_IMG_RGB24, ASI_IMG_END}, 2.9, ASI_FALSE,
10, ASI_FALSE, ASI_TRUE
},
From f7dc10f49d4d8887cf3013b390cad0ecbb62820c Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Mon, 9 Dec 2024 00:20:26 -0600
Subject: [PATCH 051/108] Update makeChanges.sh: tell prepare_local_website()
to run postData
It will run postData.sh, so remove it from this file
---
scripts/makeChanges.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/scripts/makeChanges.sh b/scripts/makeChanges.sh
index 9b6265d3b..740d8306e 100755
--- a/scripts/makeChanges.sh
+++ b/scripts/makeChanges.sh
@@ -621,8 +621,7 @@ do
"uselocalwebsite")
if [[ ${NEW_VALUE} == "true" ]]; then
- prepare_local_website ""
- "${ALLSKY_SCRIPTS}/postData.sh" --fromWebUI --allfiles
+ prepare_local_website "" "postData"
fi
;;
From 7728a0e5eaf76a7679cf6cc4a1cf7ecf0fb5bd91 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Mon, 9 Dec 2024 00:40:27 -0600
Subject: [PATCH 052/108] Update install.sh: tell prepare_local_website() to
run postData.sh if needed
---
install.sh | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/install.sh b/install.sh
index 9f46f6528..959bfa0cd 100755
--- a/install.sh
+++ b/install.sh
@@ -2509,15 +2509,16 @@ restore_prior_files()
else
MSG="Your remote Website needs to be updated to this newest version."
MSG+="\nIt is at version ${PRIOR_V}"
- # This command will update the version.
MSG+="\n\nRun: cd ~/allsky; ./remoteWebsiteInstall.sh"
display_msg --log notice "${MSG}"
fi
else
display_msg --log progress "${ITEM}: ${NOT_RESTORED}"
- # Create a default file.
+## FIX: TODO: why prepare the LOCAL website - the code above is for the REMOTE website.
+ # Create a default file
prepare_local_website ""
+
fi
# Do NOT restore options.json - it will be recreated.
@@ -2584,7 +2585,7 @@ restore_prior_files()
####
# If a prior local Website exists move its data to the new location.
-# If using a remote website, copy it's config file.
+# If using a remote website, copy its config file.
restore_prior_website_files()
{
declare -n v="${FUNCNAME[0]}"; [[ ${v} == "true" ]] && return
@@ -2707,11 +2708,11 @@ restore_prior_website_files()
echo "When done, check in '${PRIOR_WEBSITE_DIR}' for any files"
echo "you may have added; if there are any, store them in"
echo -e "\n ${ALLSKY_WEBSITE_MYFILES_DIR}"
- echo "then remove the old website: sudo rm -fr ${PRIOR_WEBSITE_DIR}"
+ echo "then remove the old Website: sudo rm -fr ${PRIOR_WEBSITE_DIR}"
} >> "${POST_INSTALLATION_ACTIONS}"
# Create a default file.
- prepare_local_website ""
+ prepare_local_website "" "postData"
else # NEW_STYLE_WEBSITE
ITEM="${SPACE}${SPACE}${ALLSKY_WEBSITE_CONFIGURATION_NAME}"
@@ -2733,6 +2734,9 @@ restore_prior_website_files()
MSG="${SPACE}${SPACE}${SPACE}Already current @ version ${NEW_WEB_CONFIG_VERSION}"
display_msg --logonly info "${MSG}"
fi
+
+ # Since the config file already exists, this will just run postData.sh:
+ prepare_local_website "" "postData"
fi
STATUS_VARIABLES+=( "${FUNCNAME[0]}='true'\n" )
From 45805bb250f9d164d70897bddb6a6ab80a2242ad Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Mon, 9 Dec 2024 00:54:12 -0600
Subject: [PATCH 053/108] Update installUpgradeFunctions.sh: Run postData.sh if
told to
---
scripts/installUpgradeFunctions.sh | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/scripts/installUpgradeFunctions.sh b/scripts/installUpgradeFunctions.sh
index 5f3a5524a..6cbe32c74 100644
--- a/scripts/installUpgradeFunctions.sh
+++ b/scripts/installUpgradeFunctions.sh
@@ -618,6 +618,7 @@ function replace_website_placeholders()
function prepare_local_website()
{
local FORCE="${1}"
+ local POST_DATA="${2}"
display_msg --log progress "Creating default ${ALLSKY_WEBSITE_CONFIGURATION_NAME}."
@@ -627,6 +628,16 @@ function prepare_local_website()
fi
replace_website_placeholders "local" "${ALLSKY_WEBSITE_CONFIGURATION_FILE}"
+
+ if [[ ${POST_DATA} == "postData" && "$( settings ".uselocalwebsite" )" == "true" ]]; then
+ # --fromWebUI tells it to be mostly silent.
+ local MSG="$( "${ALLSKY_SCRIPTS}/postData.sh" --fromWebUI --allfiles 2>&1 )"
+ if [[ $? -eq 0 ]]; then
+ display_msg --log progress "${MSG}"
+ else
+ display_msg --log warning "${MSG}"
+ fi
+ fi
}
From 5518b8b24a703d57cfe62324fcc8ec8ec189e124 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Mon, 9 Dec 2024 01:09:03 -0600
Subject: [PATCH 054/108] Update Allsky.html: Add warning about camera being
connected
---
html/documentation/installations/Allsky.html | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/html/documentation/installations/Allsky.html b/html/documentation/installations/Allsky.html
index e6cab0d9b..7ebd97318 100644
--- a/html/documentation/installations/Allsky.html
+++ b/html/documentation/installations/Allsky.html
@@ -28,7 +28,18 @@
This page describes how to install and upgrade Allsky.
-
+
+Your camera must be connected to the Pi prior to installation.
+
+If you have an RPi camera, run the following to make sure the camera can be seen by Allsky:
+
+libcamera-still --list-cameras
+
+If camera number 0 (the first camera) is n the list, you're good to go.
+
+
+
+
We highly suggest installing the current version of Allsky on a clean SD card
since a lot of files have changed and using a clean card will ensure a clutter-free environment
with the most recent commands.
@@ -36,7 +47,7 @@
See the instructions on
how to image an SD card for use by Allsky.
-
+
If a version of Allsky already exists
From 6ed1b3a91013e6d8c4fc2a9e90fcbd269eaa562d Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Mon, 9 Dec 2024 01:12:17 -0600
Subject: [PATCH 055/108] Update Allsky.html: Mention non-Raspberry Pi cameras
---
html/documentation/installations/Allsky.html | 3 +++
1 file changed, 3 insertions(+)
diff --git a/html/documentation/installations/Allsky.html b/html/documentation/installations/Allsky.html
index 7ebd97318..656d5a153 100644
--- a/html/documentation/installations/Allsky.html
+++ b/html/documentation/installations/Allsky.html
@@ -36,6 +36,9 @@
libcamera-still --list-cameras
If camera number 0 (the first camera) is n the list, you're good to go.
+
+Note that some non-Raspberry Pi brand cameras may need special software installed and/or operating system
+configuration changes - read the camera manual.
From 5cdf446d8a4e65088c04e1006c09539c69734362 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Mon, 9 Dec 2024 09:04:24 -0600
Subject: [PATCH 056/108] Update Allsky.html: correct typo
---
html/documentation/installations/Allsky.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/documentation/installations/Allsky.html b/html/documentation/installations/Allsky.html
index 656d5a153..554190709 100644
--- a/html/documentation/installations/Allsky.html
+++ b/html/documentation/installations/Allsky.html
@@ -35,7 +35,7 @@
libcamera-still --list-cameras
-If camera number 0 (the first camera) is n the list, you're good to go.
+If camera number 0 (the first camera) is in the list, you're good to go.
Note that some non-Raspberry Pi brand cameras may need special software installed and/or operating system
configuration changes - read the camera manual.
From cefafff933b284c5d0b01a1af4776c85d414386d Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Mon, 9 Dec 2024 16:32:28 -0600
Subject: [PATCH 057/108] Update functions.sh: Correct check
Unlike the "ZWOptical camera" string instead of "ZWO", "Planetary Camera" comes after the true model.
---
scripts/functions.sh | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/scripts/functions.sh b/scripts/functions.sh
index 7948728ee..4eda42c7f 100644
--- a/scripts/functions.sh
+++ b/scripts/functions.sh
@@ -317,8 +317,8 @@ function get_connected_cameras_info()
{
if ($1 == "Bus" && $3 == "Device") {
ZWO = $7;
- if ((ZWO == "ZWOptical" && $8 == "company") ||
- (ZWO == "Planetary" && $8 == "Camera")) {
+ # Check for "ZWOptical company" instead of ZWO on some older cameras
+ if (ZWO == "ZWOptical" && $8 == "company") {
model = $9;
model_cont = 10;
} else {
@@ -327,7 +327,12 @@ function get_connected_cameras_info()
}
if (model != "") {
# The model may have multiple tokens.
- for (i=model_cont; i<= NF; i++) model = model " " $i
+ for (i=model_cont; i<= NF; i++) {
+ # Check for "ASI120 Planetary Camera" on some older cameras.
+ if ($i == "Planetary")
+ break;
+ model = model " " $i;
+ }
printf("ZWO\t%d\t%s\n", num++, model);
model = ""; # This camera was output
}
From 4fdac7e13eb76d3ab8d589cc61845a46ecd91c8f Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Mon, 9 Dec 2024 17:23:25 -0600
Subject: [PATCH 058/108] Update index.html: Fix 2 broken links
---
html/documentation/index.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/html/documentation/index.html b/html/documentation/index.html
index e5d3a9315..76a6e83c0 100644
--- a/html/documentation/index.html
+++ b/html/documentation/index.html
@@ -26,8 +26,8 @@
This documentation provides information for
-installing,
-configuring,
+installing,
+configuring,
and running the Allsky software,
including describing what various features like
overlays
From 2693d0d70d4895ddb304a10034bea14beeae9379 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Mon, 9 Dec 2024 17:42:34 -0600
Subject: [PATCH 059/108] Update knownIssues.html: fix url
---
html/documentation/knownIssues.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/documentation/knownIssues.html b/html/documentation/knownIssues.html
index ab8700c42..2b986e026 100644
--- a/html/documentation/knownIssues.html
+++ b/html/documentation/knownIssues.html
@@ -44,7 +44,7 @@ Image Capture
RPi cameras don't support sensor temperature.
Workaround:
- See this workaround.
+ See this workaround.
Future Plans:
Will fix in the next major release for users running the Bullseye or Bookworm operating systems.
From 50251a7ae136b1cafc50beb808a05954b5b48332 Mon Sep 17 00:00:00 2001
From: Alex
Date: Tue, 10 Dec 2024 22:05:32 +0000
Subject: [PATCH 060/108] #4048 Fix for pi 5 gpio access
---
install.sh | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/install.sh b/install.sh
index 959bfa0cd..63e5accb9 100755
--- a/install.sh
+++ b/install.sh
@@ -3133,20 +3133,18 @@ install_Python()
# gpiozero decodes the Pi revision number to calculate the Pi version so until the Pi 6 is
# released this code will detect all future versions of the Pi 5
#
- # NOTE: rpi-gpi and rpi-lgpio cannot co-exist but since blinka is not installing either we
- # don't currently have to worry about removing rpi-gpio before installing rpi-lgpio
- #
local CMD="from gpiozero import Device"
CMD+="\nDevice.ensure_pin_factory()"
CMD+="\nprint(Device.pin_factory.board_info.model)"
pimodel="$( echo -e "${CMD}" | python3 2>/dev/null )" # hide error since it only applies to Pi 5.
- # if we are on the pi 5 then install lgpio, using the virtual environment which will always
- # exist on the pi 5
+ # if we are on the pi 5 then uninstall rpi.gpio, using the virtual environment which will always
+ # exist on the pi 5. lgpio is installed globally so will be used after rpi.gpio is removed
+ # Adatfruits blinka reinstalls rpi.gpio
if [[ ${pimodel:0:1} == "5" ]]; then
display_msg --log progress "Updating GPIO to lgpio"
activate_python_venv
- pip3 install rpi-lgpio > /dev/null 2>&1
+ pip3 uninstall -y rpi.gpio > /dev/null 2>&1
fi
STATUS_VARIABLES+=( "${FUNCNAME[0]}='true'\n" )
From f4a9ef1acf5762f742ff373a17bec115ae9e90a1 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Tue, 10 Dec 2024 17:56:50 -0600
Subject: [PATCH 061/108] Update generateForDay.sh: remove thumbnail prior to
generating timelapse
Also, fix a minor bug with not doing timelapse if startrails fails.
---
scripts/generateForDay.sh | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/scripts/generateForDay.sh b/scripts/generateForDay.sh
index 0e4f4f948..4eae661f7 100755
--- a/scripts/generateForDay.sh
+++ b/scripts/generateForDay.sh
@@ -289,7 +289,7 @@ if [[ ${DO_KEOGRAM} == "true" ]]; then
DO_STARTRAILS="false"
DO_TIMELAPSE="false"
# -gt 90 means either no files or unable to read initial file, and
- # keograms will have the same problem, so don't bother running.
+ # keograms and timelapse will have the same problem, so don't bother running.
echo "Keogram creation unable to read files; will not run startrails or timelapse."
fi
@@ -353,11 +353,11 @@ if [[ ${DO_STARTRAILS} == "true" ]]; then
${STARTRAILS_EXTRA_PARAMETERS}"
generate "Startrails, threshold=${BRIGHTNESS_THRESHOLD}" "startrails" "${CMD}"
- if [[ $? -gt 90 && (${DO_KEOGRAM} == "true" || ${DO_TIMELAPSE} == "true") ]]; then
- DO_STARTRAILS="false"
+ if [[ $? -gt 90 && ${DO_TIMELAPSE} == "true" ]]; then
+ DO_TIMELAPSE="false"
# -gt 90 means either no files or unable to read initial file, and
- # startrails will have the same problem, so don't bother running.
- echo "Startrails creation unable to read files; will not run keogram or timelapse."
+ # timelapse will have the same problem, so don't bother running.
+ echo "Startrails creation unable to read files; will not run timelapse."
fi
else
@@ -406,6 +406,7 @@ fi
if [[ ${DO_TIMELAPSE} == "true" ]]; then
VIDEO_FILE="allsky-${DATE}.mp4"
+
# Need a different name for the file so it's not mistaken for a regular image in the WebUI.
THUMBNAIL_FILE="thumbnail-${DATE}.jpg"
@@ -414,6 +415,9 @@ if [[ ${DO_TIMELAPSE} == "true" ]]; then
TIMELAPSE_UPLOAD_THUMBNAIL="$( settings ".timelapseuploadthumbnail" )"
if [[ ${TYPE} == "GENERATE" ]]; then
+ # If the thumbnail file exists it will used and produce errors, so delete it.
+ rm -f "${UPLOAD_THUMBNAIL}"
+
if [[ ${THUMBNAIL_ONLY} == "true" ]]; then
if [[ -f ${UPLOAD_FILE} ]]; then
RET=0
@@ -438,7 +442,6 @@ if [[ ${DO_TIMELAPSE} == "true" ]]; then
RET=$?
fi
if [[ ${RET} -eq 0 && ${TIMELAPSE_UPLOAD_THUMBNAIL} == "true" && -s ${UPLOAD_FILE} ]]; then
- rm -f "${UPLOAD_THUMBNAIL}"
# Want the thumbnail to be near the start of the video, but not the first frame
# since that can be a lousy frame.
# If the video is less than 5 seconds, make_thumbnail won't work, so try again.
From 87fb5f91696c60a0b0ec79a99e85bc566fc79d9e Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Tue, 10 Dec 2024 18:12:38 -0600
Subject: [PATCH 062/108] Update RemoteServer.html: fix url
---
html/documentation/installations/RemoteServer.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/documentation/installations/RemoteServer.html b/html/documentation/installations/RemoteServer.html
index 88a25e598..7c012e430 100644
--- a/html/documentation/installations/RemoteServer.html
+++ b/html/documentation/installations/RemoteServer.html
@@ -62,7 +62,7 @@ Preparing the remote server
of the WebUI's Allsky Settings page
and fill in the settings.
See the
-
+
Allsky Settings page for a description of the settings.
From 41c3e309701e0d627501c563ae759a79b35bc538 Mon Sep 17 00:00:00 2001
From: Alex
Date: Wed, 11 Dec 2024 20:19:14 +0000
Subject: [PATCH 063/108] 4048 Remove rpi.gpio on the pi 5
---
install.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install.sh b/install.sh
index 63e5accb9..821a5292c 100755
--- a/install.sh
+++ b/install.sh
@@ -3140,7 +3140,7 @@ install_Python()
# if we are on the pi 5 then uninstall rpi.gpio, using the virtual environment which will always
# exist on the pi 5. lgpio is installed globally so will be used after rpi.gpio is removed
- # Adatfruits blinka reinstalls rpi.gpio
+ # Adafruits blinka reinstalls rpi.gpio so we need to ensure its removed
if [[ ${pimodel:0:1} == "5" ]]; then
display_msg --log progress "Updating GPIO to lgpio"
activate_python_venv
From 7856293503bec73e1ee0d4928da5c83b8c36303e Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Thu, 12 Dec 2024 16:45:16 -0600
Subject: [PATCH 064/108] Update RemoteServer.html: warning about what page is
about
Fixes #4047
---
html/documentation/installations/RemoteServer.html | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/html/documentation/installations/RemoteServer.html b/html/documentation/installations/RemoteServer.html
index 7c012e430..ca6b1b7e3 100644
--- a/html/documentation/installations/RemoteServer.html
+++ b/html/documentation/installations/RemoteServer.html
@@ -31,6 +31,14 @@
to accept uploads of the current Allsky image
as well as startrails, keograms, and timelapse videos.
+
+
+This page is for setting up a remote server,
+which typically does not run an Allsky Website.
+If you want to set up a remote Website,
+click here.
+
+
Why use a remote server?
Since this server does NOT run the Allsky Website software you may wonder
From 956d012633090a51438195bd6db3f298a44d5115 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Thu, 12 Dec 2024 17:07:25 -0600
Subject: [PATCH 065/108] Update remoteWebsiteInstall.sh: add not about not
removing images
Fixes #4052
---
remoteWebsiteInstall.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 6115f5646..0fe7b2139 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -385,7 +385,9 @@ function display_welcome()
2) Upload the new remote Website code.\n\
3) Upload the remote Website configuration file.\n\
4) Enable the remote Website.\n\n\
- \
+ \n\
+ Any existing startrails, keograms, and/or timelapse will NOT be touched.\n\
+\
${DIALOG_RED}WARNING! This will:${DIALOG_NORMAL}\n\
- Overwrite the old Allsky web files on the remote server.\n\
- Remove any old Allsky files from the remote server.\n\n\n\
From 619e929c15bc2824df7aab50dda56f9aee1e33c7 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Thu, 12 Dec 2024 17:15:41 -0600
Subject: [PATCH 066/108] Update timelapse.sh: check for return code 137
Fixes #4028
For some reason, ffmpeg can be killed but we don't get a "Killed" message, but the return code is 137. Check for that.
---
scripts/timelapse.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/timelapse.sh b/scripts/timelapse.sh
index 7757a8770..e3087aafa 100755
--- a/scripts/timelapse.sh
+++ b/scripts/timelapse.sh
@@ -315,7 +315,6 @@ X="$( ffmpeg -y -f image2 \
${EXTRA} \
"${OUTPUT_FILE}" 2>&1 )"
RET=$?
-
# The "deprecated..." message is useless and only confuses users, so hide it.
X="$( echo "${X}" | grep -E -v "deprecated pixel format used|Processed " )"
[[ -n ${X} ]] && echo "${X}" >> "${TMP}" # a warning/error message
@@ -327,6 +326,10 @@ if [[ ${RET} -ne -0 ]]; then
if X="$( echo "${TMP}" | grep -E -i "Killed ffmpeg|malloc of size" )" ; then
indent --spaces "${X}"
echo -e "See the 'Troubleshooting -> Timelapse' documentation page for a fix.\n"
+ elif [[ ${RET} -eq 137 ]]; then
+ # Sometimes the process is killed but we don't get a Killed message.
+ indent --spaces "Killed ffmpeg\n${X}"
+ echo -e "See the 'Troubleshooting -> Timelapse' documentation page for a fix.\n"
fi
indent --spaces "Output: $( < "${TMP}" )"
From 1040192736150a3227d64a422cbc19c9b4880f19 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Thu, 12 Dec 2024 17:28:12 -0600
Subject: [PATCH 067/108] Update remoteWebsiteInstall.sh: Add -p to REMOTE_PORT
earlier
so it's always there.
Fixes #4059
---
remoteWebsiteInstall.sh | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 0fe7b2139..d3a065202 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -39,6 +39,7 @@ REMOTE_URL="$( settings ".remotewebsiteurl" "${SETTINGS_FILE}" )"
REMOTE_USER="$( settings ".REMOTEWEBSITE_USER" "${ALLSKY_ENV}" )"
REMOTE_HOST="$( settings ".REMOTEWEBSITE_HOST" "${ALLSKY_ENV}" )"
REMOTE_PORT="$( settings ".REMOTEWEBSITE_PORT" "${ALLSKY_ENV}" )"
+[[ -n ${REMOTE_PORT} ]] && REMOTE_PORT="-p ${REMOTE_PORT}"
REMOTE_PASSWORD="$( settings ".REMOTEWEBSITE_PASSWORD" "${ALLSKY_ENV}" )"
REMOTE_DIR="$( settings ".remotewebsiteimagedir" "${SETTINGS_FILE}" )"
REMOTE_PROTOCOL="$( settings ".remotewebsiteprotocol" "${SETTINGS_FILE}" )"
@@ -612,8 +613,9 @@ function remove_remote_file()
[[ -n ${REMOTE_DIR} ]] && CMDS="cd '${REMOTE_DIR}' ;"
CMDS+=" rm -r '${FILENAME}' ; bye"
+ # shellcheck disable=SC2086
ERR="$( lftp -u "${REMOTE_USER},${REMOTE_PASSWORD}" \
- "${REMOTE_PORT}" \
+ ${REMOTE_PORT} \
"${REMOTE_PROTOCOL}://${REMOTE_HOST}" \
-e "${CMDS}" 2>&1 )"
if [[ $? -eq 0 ]] ; then
@@ -660,10 +662,6 @@ function upload_remote_website()
local EXTRA_TEXT="" EXCLUDE_FOLDERS="" MSG
- if [[ -n ${REMOTE_PORT} ]]; then
- REMOTE_PORT="-p ${REMOTE_PORT}"
- fi
-
MSG="Starting upload to the remote Website"
[[ -n ${REMOTE_DIR} ]] && MSG+=" in ${REMOTE_DIR}"
if [[ ${REMOTE_WEBSITE_EXISTS} == "true" ]]; then
From ba41c060c9592d5eddcc5e2020350732c51c44ee Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Thu, 12 Dec 2024 17:50:44 -0600
Subject: [PATCH 068/108] Update imageSDcard.html: mention /opt/allsky
---
.../explanations/imageSDcard.html | 75 +++++++++++--------
1 file changed, 42 insertions(+), 33 deletions(-)
diff --git a/html/documentation/explanations/imageSDcard.html b/html/documentation/explanations/imageSDcard.html
index 42a7a35ba..9f36660fa 100644
--- a/html/documentation/explanations/imageSDcard.html
+++ b/html/documentation/explanations/imageSDcard.html
@@ -44,40 +44,49 @@ 1. Re-image an SD card but keep some files
but keep your Allsky files.
-If you have two SD cards, the process is straightforward:
-
- - Image the second SD card using the
- instructions below.
-
- Plug the newly-imaged SD card into your Pi and turn it on.
-
- Using an SD card-to-USB adapter, plug it into a USB port on your Pi
- and copy whatever files you want from it to the main SD card.
-
- Copy the ~/allsky directory on the saved SD card
- to ~/allsky-OLD on the main SD card.
-
-
-
-
-If you only have one SD card, consider getting another one
-and use the instructions above.
-It's always good to have a spare SD card anyway in case the first one goes bad.
- If you can't obtain a second card, do the following:
-
- - Copy ~/allsky plus any other
- files, images, etc. you want to keep from your SD card to a
- USB drive, PC, Mac, or another device.
-
- Image the SD card using the
- instructions below.
-
- Plug the newly-imaged SD card into your Pi and turn it on.
-
- Restore your files to the SD card.
-
- Copy the saved ~/allsky directory to
- ~/allsky-OLD on the new SD card.
-
- - Install Allsky
- and tell the installation you want to use the prior version of Allsky;
- it will then restore your saved images, darks, and configuration files.
+
+- If you have two SD cards, the process is straightforward:
+
+ - Image the second SD card using the
+ instructions below.
+
- Plug the newly-imaged SD card into your Pi and turn it on.
+
- Using an SD card-to-USB adapter, plug it into a USB port on your Pi and
+ copy the ~/allsky directory on the saved SD card
+ to ~/allsky-OLD on the new SD card.
+
If you have modules in the old card's /opt/allsky
+ directory, copy that directory to the new SD card using sudo .
+ Copy whatever other files you want from the old SD card to the new one.
+
+
+ - If you only have one SD card, consider getting another one
+ and use the instructions above.
+ It's always good to have a spare SD card anyway in case the first one goes bad.
+
If you can't obtain a second card, do the following:
+
+ - Copy ~/allsky plus any other
+ files, images, etc. you want to keep from your SD card to a
+ USB drive, PC, Mac, or another device.
+
If you have modules in /opt/allsky,
+ copy that directory as well.
+ Suggestion: name its backup directory
+ opt-allsky,
+ - Image the SD card using the
+ instructions below.
+
- Plug the newly-imaged SD card into your Pi and turn it on.
+
- Restore your files to the SD card.
+
+ Copy the saved ~/allsky directory to
+ ~/allsky-OLD on the new SD card.
+ If you saved /opt/allsky,
+ copy that directory to the new SD card using sudo .
+
+Now
+install Allsky
+and tell the installation you want to use the prior version of Allsky;
+it will then restore your saved images, darks, and configuration files.
+You may want to leave your 2nd SD card or USB drive attached to the Pi in case you
+missed some files.
2. First install or "starting over"
From 9b9e7d90cee2f45b23651e2e852c3cc0017ad2fc Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sat, 14 Dec 2024 22:23:07 -0600
Subject: [PATCH 069/108] Update remoteWebsiteInstall.sh: Add blank line for
readability
---
remoteWebsiteInstall.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index d3a065202..417fd5c14 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -388,7 +388,7 @@ function display_welcome()
4) Enable the remote Website.\n\n\
\n\
Any existing startrails, keograms, and/or timelapse will NOT be touched.\n\
-\
+\n\
${DIALOG_RED}WARNING! This will:${DIALOG_NORMAL}\n\
- Overwrite the old Allsky web files on the remote server.\n\
- Remove any old Allsky files from the remote server.\n\n\n\
From cf793a56829e23a2c7ecd675daedba98a3afc592 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sat, 14 Dec 2024 22:32:34 -0600
Subject: [PATCH 070/108] Update remoteWebsiteInstall.sh: remove old "version"
file
---
remoteWebsiteInstall.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 417fd5c14..8827866c1 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -77,6 +77,7 @@ OLD_FILES_TO_REMOVE=( \
"getTime.php" \
"virtualsky.json" \
"README.md" \
+ "version" \
"myImages")
############################################## functions
From 0bde26ec8368d65f495f57222ac8ec0d8d4d99a7 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sat, 14 Dec 2024 22:54:15 -0600
Subject: [PATCH 071/108] Update install.sh: remove incorrect comment
---
install.sh | 1 -
1 file changed, 1 deletion(-)
diff --git a/install.sh b/install.sh
index 821a5292c..3efa4d002 100755
--- a/install.sh
+++ b/install.sh
@@ -2585,7 +2585,6 @@ restore_prior_files()
####
# If a prior local Website exists move its data to the new location.
-# If using a remote website, copy its config file.
restore_prior_website_files()
{
declare -n v="${FUNCNAME[0]}"; [[ ${v} == "true" ]] && return
From 655284f5e4de0ff51125d5d794b84a846b5933ba Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sat, 14 Dec 2024 23:08:27 -0600
Subject: [PATCH 072/108] Update remoteWebsiteInstall.sh: Update version
The AllskyVersion setting should always be updated whenever remoteWebsiteInstall.sh is run to keep it in sync with the main Allsky.
---
remoteWebsiteInstall.sh | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 8827866c1..23e710221 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -505,8 +505,7 @@ function update_old()
# See 'pre_install_checks' for details on which configuration file is used.
function create_website_config()
{
- local MSG="Creating configuration file from ${CONFIG_MESSAGE}"
- display_msg --logonly info "${MSG}"
+ local MSG
if [[ ${CONFIG_TO_USE} == "new" || ${CONFIG_TO_USE} == "remoteReallyOld" ]]; then
# Need a new config file so copy it from the repo and replace as many
@@ -519,7 +518,10 @@ function create_website_config()
MSG+=" from repo and updated placeholders."
display_msg --logonly info "${MSG}"
- elif [[ ${CONFIG_TO_USE} == "local" ]]; then
+ return
+ fi
+
+ if [[ ${CONFIG_TO_USE} == "local" ]]; then
# Using the remote config file on the Pi which may be new or old format.
MSG="Using existing ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME}"
if update_old "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" ; then
@@ -557,6 +559,9 @@ function create_website_config()
display_aborted "${MSG}" "${ERR}"
fi
fi
+
+ display_msg --logonly info "Updated remote configuration file to ${ALLSKY_VERSION}"
+ update_json_file ".${WEBSITE_ALLSKY_VERSION}" "${ALLSKY_VERSION}" "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}"
}
# Check if a remote file, or array of files, exist.
@@ -672,7 +677,7 @@ function upload_remote_website()
# However, we must upload the index.php files.
EXCLUDE_FOLDERS="--exclude keograms --exclude startrails --exclude videos"
-# FIX: the --include doesn't work - the files aren't uploaded.
+# ALEX: FIX: the --include doesn't work - the files aren't uploaded.
# Do we need to do a second lftp mirror to upload them?
EXCLUDE_FOLDERS+=" --include keograms/index.php"
EXCLUDE_FOLDERS+=" --include startrails/index.php"
From e67041432668c5813fc59d3fcd407d37ce93f202 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 03:44:26 -0600
Subject: [PATCH 073/108] Update remoteWebsiteInstall.sh: Rename some variables
to better reflect their use
---
remoteWebsiteInstall.sh | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 23e710221..963363926 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -22,13 +22,13 @@ source "${ALLSKY_SCRIPTS}/installUpgradeFunctions.sh" || exit "${EXIT_ERROR_STOP
DISPLAY_MSG_LOG="${ALLSKY_LOGS}/${ME/.sh/}.log"
# Config variables
-HAVE_NEW_CONFIG="false"
+HAVE_LOCAL_CONFIG="false"
HAVE_PRIOR_CONFIG="false"
-HAVE_NEW_REMOTE_CONFIG="false"
+HAVE_NEW_STYLE_REMOTE_CONFIG="false"
HAVE_REALLY_OLD_REMOTE_CONFIG="false"
CONFIG_TO_USE="" # which Website configuration file to use?
CONFIG_MESSAGE=""
-REMOTE_WEBSITE_EXISTS="false"
+REMOTE_WEBSITE_IS_VALID="false"
# Dialog size variables
DIALOG_WIDTH="$( tput cols )"; ((DIALOG_WIDTH -= 10 ))
@@ -232,7 +232,7 @@ function pre_install_checks()
DT="FOUND"
MSG="Found ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}."
display_msg --logonly info "${MSG}"
- HAVE_NEW_CONFIG="true"
+ HAVE_LOCAL_CONFIG="true"
### FIX / TODO: Should this be used?
# During Allsky upgrades, if the OLD directory exists users are asked if
@@ -256,8 +256,8 @@ function pre_install_checks()
DIALOG_TEXT+="\n2 - Checking for existing remote Website: "
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
local INDENT=" "
- REMOTE_WEBSITE_EXISTS="$( check_if_website_exists )"
- if [[ ${REMOTE_WEBSITE_EXISTS} == "true" ]]; then
+ REMOTE_WEBSITE_IS_VALID="$( check_if_website_exists )"
+ if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then
# If we didn't find a remote Website configuration file on the Pi,
# it's "should be" an old-style Website since the user wasn't
@@ -271,7 +271,7 @@ function pre_install_checks()
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
local NEW_CONFIG_FILES=("${ALLSKY_WEBSITE_CONFIGURATION_NAME}")
if check_if_files_exist "${REMOTE_URL}" "or" "${NEW_CONFIG_FILES[@]}" ; then
- HAVE_NEW_REMOTE_CONFIG="true"
+ HAVE_NEW_STYLE_REMOTE_CONFIG="true"
DIALOG_TEXT+="Found."
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
MSG="Found a current configuration file on the remote server."
@@ -302,7 +302,7 @@ function pre_install_checks()
DIALOG_TEXT+="NOT FOUND."
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
- if [[ ${HAVE_NEW_CONFIG} == "true" || ${HAVE_PRIOR_CONFIG} == "true" ]]; then
+ if [[ ${HAVE_LOCAL_CONFIG} == "true" || ${HAVE_PRIOR_CONFIG} == "true" ]]; then
DIALOG_TEXT+="${DIALOG_RED}"
DIALOG_TEXT+="\n${INDENT}WARNING: a remote configuration file exists"
DIALOG_TEXT+="\n${INDENT}but a remote Website wasn't found."
@@ -313,8 +313,8 @@ function pre_install_checks()
fi
- if [[ ${HAVE_NEW_CONFIG} == "true" ]]; then
- if [[ ${HAVE_NEW_REMOTE_CONFIG} == "true" ]]; then
+ if [[ ${HAVE_LOCAL_CONFIG} == "true" ]]; then
+ if [[ ${HAVE_NEW_STYLE_REMOTE_CONFIG} == "true" ]]; then
MSG="A remote configuration file was found but using the local version instead."
else
MSG="Using the local remote configuration file (no remote file found)."
@@ -330,7 +330,7 @@ function pre_install_checks()
CONFIG_TO_USE="prior" # it may be old or current format
CONFIG_MESSAGE="the ${B}"
- elif [[ ${HAVE_NEW_REMOTE_CONFIG} == "true" ]]; then
+ elif [[ ${HAVE_NEW_STYLE_REMOTE_CONFIG} == "true" ]]; then
MSG="Using new-style Website configuration file on the remote Website;"
MSG+=" it will be downloaded and saved locally."
display_msg --logonly info "${MSG}"
@@ -670,7 +670,7 @@ function upload_remote_website()
MSG="Starting upload to the remote Website"
[[ -n ${REMOTE_DIR} ]] && MSG+=" in ${REMOTE_DIR}"
- if [[ ${REMOTE_WEBSITE_EXISTS} == "true" ]]; then
+ if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then
# Don't upload images if the remote Website exists (we assume it already
# has the images).
From b5195769b4cd85c472606512968060b736a999c3 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 03:47:34 -0600
Subject: [PATCH 074/108] Update remoteWebsiteInstall.sh: Output msg if
myImages exists
Do NOT delete it because it probably contains files the user needs.
---
remoteWebsiteInstall.sh | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 963363926..8e82e9454 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -77,8 +77,8 @@ OLD_FILES_TO_REMOVE=( \
"getTime.php" \
"virtualsky.json" \
"README.md" \
- "version" \
- "myImages")
+ "version" )
+OLD_FILES_TO_WARN=( "myImages" )
############################################## functions
@@ -728,6 +728,22 @@ function upload_remote_website()
remove_remote_file "${FILE_TO_DELETE}" "check"
done
+ for FILE_TO_WARN in "${OLD_FILES_TO_WARN[@]}"; do
+ if check_if_files_exist "${REMOTE_URL}" "or" "${FILE_TO_WARN}" ; then
+ display_msg --logonly info "Old file '${FILE_TO_WARN}' exists."
+ if [[ ${FILE_TO_WARN} == "myImages" ]]; then
+# TODO: move the files for the user
+ MSG="NOTE: move any files in '${FILE_TO_WARN}' on the remote Website to 'myFiles',"
+ MSG+=" then remove '${FILE_TO_WARN}'. It is no longer used."
+ else
+ MSG="NOTE: Please remove '${FILE_TO_WARN}' on the remote Website. It is no longer used."
+ fi
+ display_box "--infobox" "${DIALOG_INSTALL}" "${MSG}"
+ else
+ display_msg --logonly info "Old file '${FILE_TO_WARN}' does not exist."
+ fi
+ done
+
display_msg --logonly info "Website upload complete"
}
From b07eb1494cd82a48b052255603169dda1886fbb6 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 03:50:05 -0600
Subject: [PATCH 075/108] Update remoteWebsiteInstall.sh: update comment for
ALEX
---
remoteWebsiteInstall.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 8e82e9454..43c22a33b 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -226,7 +226,6 @@ function pre_install_checks()
DIALOG_TEXT+="\n1 - Checking for remote Website configuration file on Pi: "
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
-
if [[ -f ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} ]]; then
# 1a.
DT="FOUND"
@@ -234,11 +233,12 @@ function pre_install_checks()
display_msg --logonly info "${MSG}"
HAVE_LOCAL_CONFIG="true"
-### FIX / TODO: Should this be used?
+### FIX: ALEX: I don't think this "elif" part should be used.
# During Allsky upgrades, if the OLD directory exists users are asked if
# it should be used. If "yes", then the prior remote Website config file was
# copied to the new Allsky, so 1a should match.
# If the user answered "no", don't use OLD Allsky, we probably shouldn't either.
+# HAVE_PRIOR_CONFIG should also be deleted.
elif [[ -f ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE} ]]; then
# 1b.
DT="FOUND ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} in '${PRIOR_CONFIG_DIR}'"
From 195937753c856e44aa6a8c015a58d9897af48ad2 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 03:59:17 -0600
Subject: [PATCH 076/108] Update remoteWebsiteInstall.sh: Shorter and more
consistent messages
---
remoteWebsiteInstall.sh | 68 +++++++++++++++++++----------------------
1 file changed, 32 insertions(+), 36 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 43c22a33b..5051cf081 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -241,7 +241,7 @@ function pre_install_checks()
# HAVE_PRIOR_CONFIG should also be deleted.
elif [[ -f ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE} ]]; then
# 1b.
- DT="FOUND ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} in '${PRIOR_CONFIG_DIR}'"
+ DT="FOUND ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE}."
MSG="Found ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE}."
display_msg --logonly info "${MSG}"
HAVE_PRIOR_CONFIG="true"
@@ -263,7 +263,7 @@ function pre_install_checks()
# it's "should be" an old-style Website since the user wasn't
# using the WebUI to configure it.
- DIALOG_TEXT+="FOUND."
+ DIALOG_TEXT+="WORKING."
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
# 2a.
@@ -272,13 +272,13 @@ function pre_install_checks()
local NEW_CONFIG_FILES=("${ALLSKY_WEBSITE_CONFIGURATION_NAME}")
if check_if_files_exist "${REMOTE_URL}" "or" "${NEW_CONFIG_FILES[@]}" ; then
HAVE_NEW_STYLE_REMOTE_CONFIG="true"
- DIALOG_TEXT+="Found."
+ DIALOG_TEXT+="FOUND."
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
MSG="Found a current configuration file on the remote server."
display_msg --logonly info "${MSG}"
else
# 2b.
- DIALOG_TEXT+="Not found."
+ DIALOG_TEXT+="NOT FOUND."
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
DIALOG_TEXT+="\n${INDENT}* Checking it for old-style configuration file:"
@@ -286,20 +286,20 @@ function pre_install_checks()
local REALLY_OLD_CONFIG_FILES=("${OLD_CONFIG_NAME}")
if check_if_files_exist "${REMOTE_URL}" "or" "${REALLY_OLD_CONFIG_FILES[@]}" ; then
HAVE_REALLY_OLD_REMOTE_CONFIG="true"
- DT="FOUND"
+ DT="FOUND."
MSG="Found old-style ${OLD_CONFIG_NAME} file on the remote Website."
display_msg --logonly info "${MSG}"
else
# This "shouldn't" happen - the remote Website should have SOME type
# of configuration file.
- DT="NOT FOUND"
+ DT="NOT FOUND."
fi
- DIALOG_TEXT+="${DT}."
+ DIALOG_TEXT+="${DT}"
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
fi
else
# No remote Website found.
- DIALOG_TEXT+="NOT FOUND."
+ DIALOG_TEXT+="NOT WORKING."
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
if [[ ${HAVE_LOCAL_CONFIG} == "true" || ${HAVE_PRIOR_CONFIG} == "true" ]]; then
@@ -315,9 +315,9 @@ function pre_install_checks()
if [[ ${HAVE_LOCAL_CONFIG} == "true" ]]; then
if [[ ${HAVE_NEW_STYLE_REMOTE_CONFIG} == "true" ]]; then
- MSG="A remote configuration file was found but using the local version instead."
+ MSG="A new-style remote configuration file was found but using the local version instead."
else
- MSG="Using the local remote configuration file (no remote file found)."
+ MSG="Using the remote configuration file on the Pi (no remote file found)."
fi
display_msg --logonly info "${MSG}"
CONFIG_TO_USE="local" # it may be old or current format
@@ -345,9 +345,10 @@ function pre_install_checks()
CONFIG_MESSAGE="a new"
else
- MSG="Unable to determine the configuration file to use. A new one will be created."
+ MSG="No configuration file found - a new one will be created."
display_msg --logonly info "${MSG}"
CONFIG_TO_USE="new"
+ CONFIG_MESSAGE="a new"
fi
DIALOG_TEXT+="\n * Checking ability to upload to it: "
@@ -381,20 +382,17 @@ function display_welcome()
if [[ ${AUTO_CONFIRM} == "false" ]]; then
display_msg --logonly info "Displaying the welcome dialog."
local DIALOG_TEXT="\n\
- This script will now:\n\n\
- \
- 1) Use ${CONFIG_MESSAGE} configuration file.\n\
+This script will now:\n\n\
+ 1) Use ${CONFIG_MESSAGE} configuration file.\n\
2) Upload the new remote Website code.\n\
3) Upload the remote Website configuration file.\n\
- 4) Enable the remote Website.\n\n\
- \n\
- Any existing startrails, keograms, and/or timelapse will NOT be touched.\n\
+ 4) Enable the remote Website.\n\
+ 5) Any existing startrails, keograms, and/or timelapse will NOT be touched.\n\
\n\
- ${DIALOG_RED}WARNING! This will:${DIALOG_NORMAL}\n\
+ ${DIALOG_RED}NOTE: This will:${DIALOG_NORMAL}\n\
- Overwrite the old Allsky web files on the remote server.\n\
- Remove any old Allsky files from the remote server.\n\n\n\
${DIALOG_UNDERLINE}Are you sure you wish to continue?${DIALOG_NORMAL}"
-
if ! display_box "--yesno" "${DIALOG_WELCOME_TITLE}" "${DIALOG_TEXT}" ; then
display_aborted "--user" "at the Welcome dialog" ""
fi
@@ -425,9 +423,6 @@ function display_aborted()
DIALOG_PROMPT+="${DIALOG_UNDERLINE}Would you like to view the error message?${DIALOG_NORMAL}"
if display_box "--yesno" "${DIALOG_INSTALL}" "${DIALOG_PROMPT}" ; then
display_box "--msgbox" "${DIALOG_TITLE_LOG}" "${ERROR_MSG}" "--scrollbar"
-if false; then
- display_log_file "${DIALOG_TITLE_LOG}" "${DISPLAY_MSG_LOG}"
-fi
fi
fi
@@ -440,27 +435,28 @@ fi
# Displays the completed dialog, used at the end of the installation process.
function display_complete()
{
- local EXTRA_TEXT=""
- local E=" Please use the WebUI's 'Editor' page to replace any '${NEED_TO_UPDATE}' with the correct values."
+ local EXTRA_TEXT E E2
+ E="Use the WebUI's 'Editor' page to edit the"
+ E+=" '${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} (remote Allsky Website)' file"
+ E2=", replacing any '${NEED_TO_UPDATE}' strings with the correct values."
if [[ ${CONFIG_TO_USE} == "new" ]]; then
- EXTRA_TEXT="\nA new configuration file was created for your remote Website."
- EXTRA_TEXT+="${E}"
+ EXTRA_TEXT="A new configuration file was created."
+ EXTRA_TEXT+="\n ${E}${E2}"
elif [[ ${CONFIG_TO_USE} == "remoteReallyOld" ]]; then
- EXTRA_TEXT="\nYou have a very old remote Allsky Website so a new configuration file was created."
- EXTRA_TEXT+="${E}"
+ EXTRA_TEXT="You had a very old remote Allsky Website so a new configuration file was created."
+ EXTRA_TEXT+="\n ${E}${E2}"
+ else
+ EXTRA_TEXT="${E} to change settings for your remote Website."
fi
- display_msg --logonly info "INSTALLATION COMPLETED.\n"
-
- local DIALOG_TEXT="\n\
- The installation of the remote Website is complete\n\
- and the remote Website should be working.\n\n\
- Please check it.\n\n\
- Use the WebUI's 'Editor' page to change settings for your Website.${EXTRA_TEXT}"
+ local DIALOG_TEXT="\n The installation of the remote Website is complete.\n\n Please check it."
+ DIALOG_TEXT+="\n\n ${EXTRA_TEXT}"
display_box "--msgbox" "${DIALOG_DONE}" "${DIALOG_TEXT}"
clear # Gets rid of background color from last 'dialog' command.
- display_msg info "\nEnjoy your remote Allsky Website!\n"
+ display_msg --log success "\nEnjoy your remote Allsky Website!\n\n${EXTRA_TEXT}"
+
+ display_msg --logonly info "INSTALLATION COMPLETED.\n"
}
# Check connectivity to the remote Website by trying to upload a file to it.
From de2f508a2b567b72188f15ef0a2766fcbfebaf6d Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 04:00:32 -0600
Subject: [PATCH 077/108] Update remoteWebsiteInstall.sh: rename function to
better reflect what it checks
---
remoteWebsiteInstall.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 5051cf081..fb6a1b93c 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -256,7 +256,7 @@ function pre_install_checks()
DIALOG_TEXT+="\n2 - Checking for existing remote Website: "
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
local INDENT=" "
- REMOTE_WEBSITE_IS_VALID="$( check_if_website_exists )"
+ REMOTE_WEBSITE_IS_VALID="$( check_if_website_is_valid )"
if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then
# If we didn't find a remote Website configuration file on the Pi,
@@ -635,7 +635,7 @@ function remove_remote_file()
# all of the ${WEBSITE_FILES} exist then assume we have a remote Website.
#
# Returns - echo "true" if it exists, else "false"
-function check_if_website_exists()
+function check_if_website_is_valid()
{
local CONFIG_FILES=("${OLD_CONFIG_NAME}" "${ALLSKY_WEBSITE_CONFIGURATION_NAME}")
local WEBSITE_FILES=("index.php" "functions.php")
From f42cc751807077ce307dec1be71565cbf68d7e5a Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 04:23:51 -0600
Subject: [PATCH 078/108] Update remoteWebsiteInstall.sh: misc minor changes
* Don't check if files exist before removing them (the check doesn't work for all files).
* Misc. wording changes to messages.
* Others
---
remoteWebsiteInstall.sh | 94 ++++++++++++++++++++++++++---------------
1 file changed, 59 insertions(+), 35 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index fb6a1b93c..59e92d380 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -248,19 +248,19 @@ function pre_install_checks()
else
DT="NOT FOUND"
- display_msg --logonly info "No local config files found."
+ display_msg --logonly info "No local config file found."
fi
DIALOG_TEXT+="${DT}."
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
- DIALOG_TEXT+="\n2 - Checking for existing remote Website: "
+ DIALOG_TEXT+="\n2 - Checking for working remote Website: "
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
local INDENT=" "
REMOTE_WEBSITE_IS_VALID="$( check_if_website_is_valid )"
if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then
# If we didn't find a remote Website configuration file on the Pi,
- # it's "should be" an old-style Website since the user wasn't
+ # it "should be" an old-style Website since the user wasn't
# using the WebUI to configure it.
DIALOG_TEXT+="WORKING."
@@ -298,7 +298,7 @@ function pre_install_checks()
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
fi
else
- # No remote Website found.
+ # No working remote Website found.
DIALOG_TEXT+="NOT WORKING."
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
@@ -351,7 +351,7 @@ function pre_install_checks()
CONFIG_MESSAGE="a new"
fi
- DIALOG_TEXT+="\n * Checking ability to upload to it: "
+ DIALOG_TEXT+="\n * Checking ability to upload to Website: "
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
display_msg --logonly info "Checking remote Website connectivity."
local ERR="$( check_connectivity )"
@@ -382,7 +382,7 @@ function display_welcome()
if [[ ${AUTO_CONFIRM} == "false" ]]; then
display_msg --logonly info "Displaying the welcome dialog."
local DIALOG_TEXT="\n\
-This script will now:\n\n\
+ This script will now:\n\n\
1) Use ${CONFIG_MESSAGE} configuration file.\n\
2) Upload the new remote Website code.\n\
3) Upload the remote Website configuration file.\n\
@@ -427,7 +427,6 @@ function display_aborted()
fi
clear # Gets rid of background color from last 'dialog' command.
- # Not needed: display_msg info "${ERROR_MSG}"
exit 1
}
@@ -540,24 +539,23 @@ function create_website_config()
# Use the new remote config file since none were found locally.
# Replace placeholders and convert it to the newest format.
# Remember that the remote file name is different than what we store on the Pi.
- if ERR="$( wget -O "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" "${REMOTE_URL}/${ALLSKY_WEBSITE_CONFIGURATION_FILE}" 2>&1 )"; then
+ local FILE="${REMOTE_URL}/${ALLSKY_WEBSITE_CONFIGURATION_NAME}"
+ if ERR="$( wget -O "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" "${FILE}" 2>&1 )"; then
replace_website_placeholders "remote"
update_old "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}"
- MSG="Downloaded ${ALLSKY_WEBSITE_CONFIGURATION_FILE} from ${REMOTE_URL},"
- MSG+=" to ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}."
+ MSG="Downloaded '${FILE}' to '${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}'."
display_msg --logonly info "${MSG}"
else
- # This "shouldn't" happen since we either already checked the file exists,
+ # This "shouldn't" happen since we either already checked that the file exists,
# or we uploaded it.
- MSG="Failed to download ${ALLSKY_WEBSITE_CONFIGURATION_FILE} from ${REMOTE_URL}."
- MSG+=" Where did it go?"
+ MSG="Failed to download '${FILE}'. Where did it go?"
display_aborted "${MSG}" "${ERR}"
fi
fi
- display_msg --logonly info "Updated remote configuration file to ${ALLSKY_VERSION}"
update_json_file ".${WEBSITE_ALLSKY_VERSION}" "${ALLSKY_VERSION}" "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}"
+ display_msg --logonly info "Updated remote configuration file to ${ALLSKY_VERSION}."
}
# Check if a remote file, or array of files, exist.
@@ -566,6 +564,10 @@ function create_website_config()
# ${3}... - the files
#
# Returns - 0 if the file(s) exist, 1 if ANY file doesn't exist.
+
+# TODO: FIX: This doesn't work for "version" or "README.md" or probably any file whose
+# type is unknown to the server.
+
function check_if_files_exist()
{
local URL="${1}"
@@ -575,14 +577,14 @@ function check_if_files_exist()
for FILE in "$@"; do
url="${URL}/${FILE}"
- HTTP_STATUS="$( curl -o /dev/null --head --silent --write-out "%{http_code}" "$url" )"
+ HTTP_STATUS="$( curl -o /dev/null --head --silent --location --write-out "%{http_code}" "$url" )"
- local PRE_MSG="File ${FILE} ${url}"
+ local PRE_MSG="File '${FILE}'"
if [[ ${HTTP_STATUS} == "200" ]] ; then
show_debug_message "${PRE_MSG} exists on the remote server"
RET_CODE=0
else
- show_debug_message "${PRE_MSG} does not exists on the remote server"
+ show_debug_message "${PRE_MSG} does not exist on the remote server (HTTP_STATUS=${HTTP_STATUS})"
if [[ ${AND_OR} == "and" ]]; then
return 1
fi
@@ -604,7 +606,6 @@ function remove_remote_file()
if [[ ${CHECK} == "check" ]]; then
if ! check_if_files_exist "${REMOTE_URL}" "or" "${FILENAME}" ; then
- show_debug_message "===== not on server"
return
fi
fi
@@ -622,17 +623,20 @@ function remove_remote_file()
-e "${CMDS}" 2>&1 )"
if [[ $? -eq 0 ]] ; then
MSG="Deleted remote file '${FILENAME}'"
- else
+ elif [[ ! ${ERR} =~ "550" ]]; then # does not exist
MSG="Unable to delete remote file '${FILENAME}': ${ERR}"
+ else
+ show_debug_message "'${FILENAME}' not on remote Website."
+ return
fi
display_msg --logonly info "${MSG}"
}
-# Check if a remote Website exists.
-# The check is done by looking for the following files:
-# If any of the ${CONFIG_FILES} files exist AND
-# all of the ${WEBSITE_FILES} exist then assume we have a remote Website.
+# Check if a valid remote Website exists.
+#
+# If any of the ${CONFIG_FILES} files exist AND
+# all of the ${WEBSITE_FILES} exist then assume the remote Website is valid.
#
# Returns - echo "true" if it exists, else "false"
function check_if_website_is_valid()
@@ -640,15 +644,21 @@ function check_if_website_is_valid()
local CONFIG_FILES=("${OLD_CONFIG_NAME}" "${ALLSKY_WEBSITE_CONFIGURATION_NAME}")
local WEBSITE_FILES=("index.php" "functions.php")
+ display_msg --logonly info "Looking for a config file at ${REMOTE_URL}"
if check_if_files_exist "${REMOTE_URL}" "or" "${CONFIG_FILES[@]}" ; then
- show_debug_message "Found a remote Website config file"
+ local MSG=" Found a config file"
if check_if_files_exist "${REMOTE_URL}" "and" "${WEBSITE_FILES[@]}" ; then
- display_msg --logonly info "Found a remote Allsky Website at ${REMOTE_URL}"
+ display_msg --logonly info "${MSG} and a valid Website."
echo "true"
return 0
+ else
+ display_msg --logonly info "${MSG} but NOT a valid Website."
fi
+ else
+ display_msg --logonly info " Did not find a config file; assuming invalid site"
fi
+
echo "false"
return 1
}
@@ -669,7 +679,7 @@ function upload_remote_website()
if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then
# Don't upload images if the remote Website exists (we assume it already
- # has the images).
+ # has the images). "VALID" assumes "EXISTS".
# However, we must upload the index.php files.
EXCLUDE_FOLDERS="--exclude keograms --exclude startrails --exclude videos"
@@ -679,6 +689,8 @@ function upload_remote_website()
EXCLUDE_FOLDERS+=" --include startrails/index.php"
EXCLUDE_FOLDERS+=" --include videos/index.php"
MSG+=" (without videos, images, and their thumbnails)."
+ else
+ MSG+=" (including any videos, images, and their thumbnails)."
fi
display_msg --logonly info "${MSG}${EXTRA_TEXT}."
@@ -721,7 +733,7 @@ function upload_remote_website()
# Remove any old core files no longer required
for FILE_TO_DELETE in "${OLD_FILES_TO_REMOVE[@]}"; do
- remove_remote_file "${FILE_TO_DELETE}" "check"
+ remove_remote_file "${FILE_TO_DELETE}" "do not check"
done
for FILE_TO_WARN in "${OLD_FILES_TO_WARN[@]}"; do
@@ -744,19 +756,31 @@ function upload_remote_website()
}
# Uploads the configuration file for the remote Website.
-function upload_config_file()
+function upload_remote_config_file()
{
- local MSG="\nUploading remote Allsky configuration file"
+ local MSG
+
+ if [[ ! -f "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" ]]; then
+ MSG="'${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}' not found!"
+ display_msg --logonly info " ${MSG}"
+ display_aborted "at the configuration file upload" "${MSG}"
+ return 1
+ fi
+
+ MSG="\nUploading remote Allsky configuration file"
display_box "--infobox" "${DIALOG_INSTALL}" "${MSG}"
display_msg --logonly info "Uploading Website configuration file."
- local ERR="$( "${ALLSKY_SCRIPTS}/upload.sh" --remote-web \
+ local ERR="$( "${ALLSKY_SCRIPTS}/upload.sh" --remote-web --silent \
"${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" "${REMOTE_DIR}" \
- "${ALLSKY_WEBSITE_CONFIGURATION_NAME}" 2>&1 )"
+ "${ALLSKY_WEBSITE_CONFIGURATION_NAME}" "remoteWebsiteInstall" 2>&1 )"
if [[ $? -eq 0 ]]; then
- MSG="${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} uploaded to"
- MSG+="${REMOTE_DIR}/${ALLSKY_WEBSITE_CONFIGURATION_NAME}"
- show_debug_message "${MSG}"
+ local R="${REMOTE_DIR}"
+ [[ -n ${R} ]] && R+="/"
+ MSG="'${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}' uploaded to"
+ MSG+=" '${R}${ALLSKY_WEBSITE_CONFIGURATION_NAME}'"
+ [[ ${DEBUG} == "true" && -n ${ERR} ]] && MSG+=" (${ERR})"
+ display_msg --logonly info "${MSG}"
else
display_msg --logonly info " Failed: ${ERR}"
display_aborted "at the configuration file upload" "${ERR}"
@@ -851,6 +875,6 @@ display_welcome
create_website_config
disable_remote_website
upload_remote_website
-upload_config_file
+upload_remote_config_file
enable_remote_website
display_complete
From 7fb7c5933b6c088eea0bbf138b2f4eb6e435924e Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 04:46:00 -0600
Subject: [PATCH 079/108] Update remoteWebsiteInstall.sh: shellcheck fixes
---
remoteWebsiteInstall.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 59e92d380..a37b39bc0 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -104,7 +104,7 @@ function enter_yes_no()
fi
done
- return ${RESULT}
+ return "${RESULT}"
}
# prompt the user to press any key.
@@ -163,7 +163,7 @@ function display_box()
else
echo -e "${DIALOG_TEXT}"
fi
- return ${RET}
+ return "${RET}"
fi
# Don't use: it's redundant most of the time --backtitle "${DIALOG_BACK_TITLE}" \
@@ -591,7 +591,7 @@ function check_if_files_exist()
fi
done
- return ${RET_CODE}
+ return "${RET_CODE}"
}
# Deletes a file from the remote server.
From dc866fedccf4d022c4262531dfed75e3201b0b88 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 05:37:53 -0600
Subject: [PATCH 080/108] Update variables.sh: Add disable SC2317
For some reason sourcing in variables.sh causes every subsequent line in every file to give SC2317 errors
---
variables.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/variables.sh b/variables.sh
index 10911885b..9214341c8 100644
--- a/variables.sh
+++ b/variables.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# shellcheck disable=SC2034 # variable unused
+# shellcheck disable=SC2034,SC2317 # variable unused, statement unreached
# This file is source'd into other files to set some variables used by scripts.
# This allows us to easily add and change directory names.
From 09e98c5fdfeb04f5c573e06eac790af6f26db1af Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 05:44:40 -0600
Subject: [PATCH 081/108] Update ci_shellcheck.yml: Ignore SC2317
---
.github/workflows/ci_shellcheck.yml | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/ci_shellcheck.yml b/.github/workflows/ci_shellcheck.yml
index 8da64c54a..17a21cf5c 100644
--- a/.github/workflows/ci_shellcheck.yml
+++ b/.github/workflows/ci_shellcheck.yml
@@ -17,15 +17,15 @@ jobs:
# The type of runner that the job will run on
runs-on: ubuntu-latest
- # Steps represent a sequence of tasks that will be executed as part of the job
+ # "steps" represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- # Runs a set of commands using the runners shell
+ # Runs a set of commands using the runner's shell
- name: check bash files
run: |
- # check bash files (bash -n, shellchecki -x)
+ # check bash files (bash -n, shellcheck -x)
err=0
for i in $(find . -maxdepth 2 -name '*.sh'); do
echo "==================== $i"
@@ -58,8 +58,9 @@ jobs:
#SC2069: Something about the order of >&2 and > xxx
#SC2024: similar to SC2069
#SC2269: This variable is assigned to itself
+ #SC2317: Command appears to be unreachable
###shellcheck -x -e SC1090 -e SC1091 -e SC2004 -e SC2155 -e SC2181 -e SC2188 -e SC2024 -e SC2069 -e SC2269 $i || this_err=1
- shellcheck -x -e SC2004 -e SC2155 -e SC2181 -e SC2188 -e SC2024 -e SC2069 -e SC2269 $i || this_err=1
+ shellcheck -x -e SC2004 -e SC2155 -e SC2181 -e SC2188 -e SC2024 -e SC2069 -e SC2269 -e SC2317 $i || this_err=1
;;
esac
if [ ${this_err} -eq 1 ]; then
From a3b87bdfd8b3808f79938937c2afded4bc837b04 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 05:47:10 -0600
Subject: [PATCH 082/108] Update variables.sh: SC2317 ignored in yaml script
not needed here
---
variables.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/variables.sh b/variables.sh
index 9214341c8..10911885b 100644
--- a/variables.sh
+++ b/variables.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# shellcheck disable=SC2034,SC2317 # variable unused, statement unreached
+# shellcheck disable=SC2034 # variable unused
# This file is source'd into other files to set some variables used by scripts.
# This allows us to easily add and change directory names.
From ff1a30457ba8834c258dee8de6b770921e3d4fa1 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 05:54:34 -0600
Subject: [PATCH 083/108] Update generateForDay.sh: fix SC2086
---
scripts/generateForDay.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/generateForDay.sh b/scripts/generateForDay.sh
index 4eae661f7..ebfcaea63 100755
--- a/scripts/generateForDay.sh
+++ b/scripts/generateForDay.sh
@@ -183,14 +183,14 @@ if [[ ${TYPE} == "GENERATE" ]]; then
[[ -n ${DEBUG_ARG} ]] && echo "${ME}: Executing: ${CMD}"
# shellcheck disable=SC2086
eval ${CMD}
- RET=$?
+ local RET=$?
if [[ ${RET} -ne 0 ]]; then
echo -e "${RED}${ME}: Command Failed: ${CMD}${NC}"
elif [[ ${SILENT} == "false" ]]; then
echo -e "\tDone"
fi
- return ${RET}
+ return "${RET}"
}
else
From 72d5f33815fbd3ba8ba46a3bf005dc83f4855361 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 05:57:04 -0600
Subject: [PATCH 084/108] Update postData.sh: SC2086 fix
---
scripts/postData.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/postData.sh b/scripts/postData.sh
index a6274ae6e..62ae3a110 100755
--- a/scripts/postData.sh
+++ b/scripts/postData.sh
@@ -83,7 +83,7 @@ while [[ $# -gt 0 ]]; do
esac
shift
done
-[[ ${RET} -ne 0 ]] && usage_and_exit ${RET}
+[[ ${RET} -ne 0 ]] && usage_and_exit "${RET}"
[[ ${HELP} == "true" ]] && usage_and_exit 0
From b5c1bcd612a44f3e3e7824ef183f49135c73d612 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 05:58:00 -0600
Subject: [PATCH 085/108] Update checkAllsky.sh: fix SC2086
---
scripts/checkAllsky.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkAllsky.sh b/scripts/checkAllsky.sh
index b870c711c..a78f0b3a9 100755
--- a/scripts/checkAllsky.sh
+++ b/scripts/checkAllsky.sh
@@ -868,4 +868,4 @@ else
fi
fi
-exit ${RET}
+exit "${RET}"
From 1a8e21b4a0b0cd8a75233b8987d11dde10a61d30 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 06:00:30 -0600
Subject: [PATCH 086/108] Update postToMap.sh: SC2086 fix
---
scripts/postToMap.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/postToMap.sh b/scripts/postToMap.sh
index e33a5cc54..325d38608 100755
--- a/scripts/postToMap.sh
+++ b/scripts/postToMap.sh
@@ -73,7 +73,7 @@ function check_URL()
else
# Make sure it's a valid URL. Some servers don't return anything if the user agent is "curl".
- local CONTENT="$( curl --user-agent Allsky --location --head --silent --show-error --connect-timeout ${TIMEOUT} "${URL}" 2>&1 )"
+ local CONTENT="$( curl --user-agent Allsky --location --head --silent --show-error --connect-timeout "${TIMEOUT}" "${URL}" 2>&1 )"
local RET=$?
if [[ ${DEBUG} == "true" ]]; then
echo -e "\n${wDEBUG}"
@@ -356,7 +356,7 @@ if [[ ${UPLOAD} == "true" ]]; then
else
echo -e "${ERROR_MSG_START}${E}${wNC}"
fi
- exit ${RETURN_CODE}
+ exit "${RETURN_CODE}"
fi
# Get the return string from the server. It's the last line of output.
From e87e8879ce59920c15301b6f3cc0d79bef658fd9 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 06:01:32 -0600
Subject: [PATCH 087/108] Update testUpload.sh: SC2086 fix
---
scripts/testUpload.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/testUpload.sh b/scripts/testUpload.sh
index b3965994d..9e1fc38e0 100755
--- a/scripts/testUpload.sh
+++ b/scripts/testUpload.sh
@@ -302,4 +302,4 @@ if [[ -s ${MSG_FILE} ]]; then
fi
rm -f "${MSG_FILE}"
-exit ${RET}
+exit "${RET}"
From 1f2f57991b413f3781a8c5d2e755d152143ea12b Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 06:08:09 -0600
Subject: [PATCH 088/108] Update installUpgradeFunctions.sh: SC2086 fixes
---
scripts/installUpgradeFunctions.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/installUpgradeFunctions.sh b/scripts/installUpgradeFunctions.sh
index 6cbe32c74..d7581df40 100644
--- a/scripts/installUpgradeFunctions.sh
+++ b/scripts/installUpgradeFunctions.sh
@@ -605,9 +605,9 @@ function replace_website_placeholders()
config.camera "camera" "${CAMERA}" \
config.lens "lens" "${LENS}" \
config.computer "computer" "${COMPUTER}" \
- config.AllskyVersion "AllskyVersion" "${ALLSKY_VERSION}" \
- ${MINI_TLAPSE_DISPLAY} "mini_display" "${MINI_TLAPSE_DISPLAY_VALUE}" \
- ${MINI_TLAPSE_URL} "mini_url" "${MINI_TLAPSE_URL_VALUE}"
+ "${WEBSITE_ALLSKY_VERSION}" "AllskyVersion" "${ALLSKY_VERSION}" \
+ "${MINI_TLAPSE_DISPLAY}" "mini_display" "${MINI_TLAPSE_DISPLAY_VALUE}" \
+ "${MINI_TLAPSE_URL}" "mini_url" "${MINI_TLAPSE_URL_VALUE}"
}
From 91e6129ac9b67dac90dd24c8bbcfacad46de9a6c Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 06:10:01 -0600
Subject: [PATCH 089/108] Update saveImage.sh: SC2086 fix
---
scripts/saveImage.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/saveImage.sh b/scripts/saveImage.sh
index 6b04b9557..f39025fe0 100755
--- a/scripts/saveImage.sh
+++ b/scripts/saveImage.sh
@@ -363,7 +363,7 @@ if [[ ${SAVE_IMAGE} == "true" ]]; then
# Remove the oldest files if we haven't reached the limit.
if [[ ${LEFT} -le 0 ]]; then
KEEP=$((TIMELAPSE_MINI_IMAGES - TIMELAPSE_MINI_FREQUENCY))
- x="$( tail -${KEEP} "${MINI_TIMELAPSE_FILES}" )"
+ x="$( tail "-${KEEP}" "${MINI_TIMELAPSE_FILES}" )"
echo -e "${x}" > "${MINI_TIMELAPSE_FILES}"
if [[ ${ALLSKY_DEBUG_LEVEL} -ge 3 ]]; then
echo -en "${YELLOW}${ME}: Replaced ${TIMELAPSE_MINI_FREQUENCY} oldest, LEFT=$LEFT, KEEP=$KEEP"
From bbc5b888513bb4d776c43dd2d3e3457d534cd443 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 06:12:26 -0600
Subject: [PATCH 090/108] Update remoteWebsiteInstall.sh: SC2086 fixes
---
remoteWebsiteInstall.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 23e710221..660afd36d 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -104,7 +104,7 @@ function enter_yes_no()
fi
done
- return ${RESULT}
+ return "${RESULT}"
}
# prompt the user to press any key.
@@ -163,7 +163,7 @@ function display_box()
else
echo -e "${DIALOG_TEXT}"
fi
- return ${RET}
+ return "${RET}"
fi
# Don't use: it's redundant most of the time --backtitle "${DIALOG_BACK_TITLE}" \
@@ -593,7 +593,7 @@ function check_if_files_exist()
fi
done
- return ${RET_CODE}
+ return "${RET_CODE}"
}
# Deletes a file from the remote server.
From e2d2787c789c1910b72bd051e6020b9f140ca93a Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 06:16:03 -0600
Subject: [PATCH 091/108] Update ci_shellcheck.yml: update "paths"
---
.github/workflows/ci_shellcheck.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/ci_shellcheck.yml b/.github/workflows/ci_shellcheck.yml
index 17a21cf5c..f0e58657a 100644
--- a/.github/workflows/ci_shellcheck.yml
+++ b/.github/workflows/ci_shellcheck.yml
@@ -7,8 +7,8 @@ on:
push:
paths:
- '*.sh'
- - '*/*.sh'
- - '*/*/*.sh'
+ - 'scripts/*.sh'
+ - 'scripts/utilities/*.sh'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
From 6308d0f21af288a68246b1b8bf8e91da1680c96b Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 06:20:51 -0600
Subject: [PATCH 092/108] Update ci_shellcheck.yml: go 3 levels
---
.github/workflows/ci_shellcheck.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/ci_shellcheck.yml b/.github/workflows/ci_shellcheck.yml
index f0e58657a..9eab4c9fb 100644
--- a/.github/workflows/ci_shellcheck.yml
+++ b/.github/workflows/ci_shellcheck.yml
@@ -27,7 +27,7 @@ jobs:
run: |
# check bash files (bash -n, shellcheck -x)
err=0
- for i in $(find . -maxdepth 2 -name '*.sh'); do
+ for i in $(find . -maxdepth 3 -name '*.sh'); do
echo "==================== $i"
bash -n $i
if [ $? -ne 0 ]; then
From d9ea172b747937a6b1e8de5383e55b735b866d23 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 06:23:02 -0600
Subject: [PATCH 093/108] Update allsky-config.sh: SC2086 fix
---
scripts/utilities/allsky-config.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/utilities/allsky-config.sh b/scripts/utilities/allsky-config.sh
index f102c7341..0aa76b5e1 100755
--- a/scripts/utilities/allsky-config.sh
+++ b/scripts/utilities/allsky-config.sh
@@ -268,7 +268,7 @@ function prompt()
exit 2
else
echo "${OPT}"
- return ${RET}
+ return "${RET}"
fi
}
From 27bdbf3641ee2d7f7480734ead5c048f3c038566 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 06:27:54 -0600
Subject: [PATCH 094/108] Update installSamba.sh: shellcheck fix
---
scripts/utilities/installSamba.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/utilities/installSamba.sh b/scripts/utilities/installSamba.sh
index ce8f82feb..3afdc87cd 100755
--- a/scripts/utilities/installSamba.sh
+++ b/scripts/utilities/installSamba.sh
@@ -75,6 +75,7 @@ echo
echo -en "${BOLD}"
echo "============================================="
echo -n "Press RETURN to continue with installation: "
+# shellcheck disable=SC2034
read -r x
echo -e "${NC}"
From 8a3d5676d362d314b1f589a6711f93ba1a798b80 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 06:32:13 -0600
Subject: [PATCH 095/108] Update allsky-config.sh: shellcheck fixes
---
scripts/utilities/allsky-config.sh | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/scripts/utilities/allsky-config.sh b/scripts/utilities/allsky-config.sh
index 0aa76b5e1..89574f55a 100755
--- a/scripts/utilities/allsky-config.sh
+++ b/scripts/utilities/allsky-config.sh
@@ -42,6 +42,7 @@ while [[ $# -gt 0 ]]; do
*)
CMD="${ARG}"
shift
+ # shellcheck disable=SC2124
CMD_ARGS="${@}"
break;
;;
@@ -84,6 +85,7 @@ PATH="${PATH}:${ALLSKY_UTILITIES}"
# Show all the supported cameras.
function show_supported_cameras()
{
+ # shellcheck disable=SC2124
local ARGS="${@}"
#shellcheck disable=SC2086
@@ -98,7 +100,7 @@ function show_supported_cameras()
ARGS="$( prompt "${PROMPT}" "${OPTS[@]}" )"
fi
- #shellcheck disable=SC2086
+ # shellcheck disable=SC2086
show_supported_cameras.sh ${ARGS}
}
@@ -114,10 +116,13 @@ function show_connected_cameras()
else
local FORMAT="%-6s %-8s %s\n"
echo
+ # shellcheck disable=SC2059
printf "${FORMAT}" "Type" "Number" "Model"
+ # shellcheck disable=SC2059
printf "${FORMAT}" "====" "======" "====="
echo -e "${CAMERAS}" | while read -r TYPE NUM MODEL
do
+ # shellcheck disable=SC2059
printf "${FORMAT}" "${TYPE}" "${NUM}" "${MODEL}"
done
fi
@@ -127,9 +132,10 @@ function show_connected_cameras()
# Show all the currently connected cameras.
function new_rpi_camera_info()
{
+ # shellcheck disable=SC2124
local ARGS="${@}" # optional
- #shellcheck disable=SC2086
+ # shellcheck disable=SC2086
get_RPi_camera_info.sh ${ARGS}
}
@@ -232,6 +238,7 @@ function run_command()
{
COMMAND="${1}"
shift
+ # shellcheck disable=SC2124
ARGUMENTS="${@}"
if ! type "${COMMAND}" > /dev/null 2>&1 ; then
echo -e "\n${RED}${ME}: Unknown command '${COMMAND}'.${NC}" >&2
@@ -294,7 +301,7 @@ if [[ -z ${CMD} ]]; then
run_command "${COMMAND}"
RET=$?
- [[ ${ALLOW_MORE_COMMANDS} == "false" ]] && exit ${RET}
+ [[ ${ALLOW_MORE_COMMANDS} == "false" ]] && exit "${RET}"
while true; do
echo -e "\n\n"
echo -e "${YELLOW}${BOLD}"
From e2a29d75644b5e9f634c848f8436f786e1297718 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Wed, 18 Dec 2024 17:05:45 -0600
Subject: [PATCH 096/108] Update installUpgradeFunctions.sh: fix comparison
Fixes #4085
---
scripts/installUpgradeFunctions.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/installUpgradeFunctions.sh b/scripts/installUpgradeFunctions.sh
index d7581df40..3ee337277 100644
--- a/scripts/installUpgradeFunctions.sh
+++ b/scripts/installUpgradeFunctions.sh
@@ -500,11 +500,11 @@ function replace_website_placeholders()
MINI_TLAPSE_URL_VALUE=""
else
MINI_TLAPSE_DISPLAY_VALUE="true"
- if [[ ${DO_REMOTE_WEBSITE} == "true" ]]; then
- MINI_TLAPSE_URL_VALUE="mini-timelapse.mp4"
- else
+ if [[ ${TYPE} == "local" ]]; then
#shellcheck disable=SC2153
MINI_TLAPSE_URL_VALUE="/${IMG_DIR}/mini-timelapse.mp4"
+ else
+ MINI_TLAPSE_URL_VALUE="mini-timelapse.mp4"
fi
fi
else
From 615574dfa323237fcd36b19f1b4b10e0374f23eb Mon Sep 17 00:00:00 2001
From: Alex Greenland
Date: Fri, 20 Dec 2024 15:11:14 +0000
Subject: [PATCH 097/108] #4084 Fix for index.php files not being updated
---
remoteWebsiteInstall.sh | 50 ++++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 26 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index a37b39bc0..b16093512 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -90,19 +90,23 @@ function enter_yes_no()
local RESULT=1
local ANSWER
- while true; do
- echo -e "${TEXT}"
- read -r -p "Do you want to continue? (y/n): " ANSWER
- ANSWER="${ANSWER,,}" # convert to lowercase
-
- if [[ ${ANSWER} == "y" || ${ANSWER} == "yes" ]]; then
- return 0
- elif [[ ${ANSWER} == "n" || ${ANSWER} == "no" ]]; then
- return 1
- else
- echo -e "\nInvalid response. Please enter y/yes or n/no."
- fi
- done
+ if [[ ${AUTO_CONFIRM} == "false" ]]; then
+ while true; do
+ echo -e "${TEXT}"
+ read -r -p "Do you want to continue? (y/n): " ANSWER
+ ANSWER="${ANSWER,,}" # convert to lowercase
+
+ if [[ ${ANSWER} == "y" || ${ANSWER} == "yes" ]]; then
+ return 0
+ elif [[ ${ANSWER} == "n" || ${ANSWER} == "no" ]]; then
+ return 1
+ else
+ echo -e "\nInvalid response. Please enter y/yes or n/no."
+ fi
+ done
+ else
+ return 0
+ fi
return "${RESULT}"
}
@@ -111,8 +115,10 @@ function enter_yes_no()
# This function is only used when running in text (--text) mode.
function press_any_key()
{
- echo -e "${1}\nPress any key to continue..."
- read -r -n1 -s
+ if [[ ${AUTO_CONFIRM} == "false" ]]; then
+ echo -e "${1}\nPress any key to continue..."
+ read -r -n1 -s
+ fi
}
# Add a common heading to the dialog text.
@@ -565,9 +571,6 @@ function create_website_config()
#
# Returns - 0 if the file(s) exist, 1 if ANY file doesn't exist.
-# TODO: FIX: This doesn't work for "version" or "README.md" or probably any file whose
-# type is unknown to the server.
-
function check_if_files_exist()
{
local URL="${1}"
@@ -672,7 +675,7 @@ function upload_remote_website()
return
fi
- local EXTRA_TEXT="" EXCLUDE_FOLDERS="" MSG
+ local EXTRA_TEXT="" EXCLUDE_FILES="" MSG
MSG="Starting upload to the remote Website"
[[ -n ${REMOTE_DIR} ]] && MSG+=" in ${REMOTE_DIR}"
@@ -681,13 +684,8 @@ function upload_remote_website()
# Don't upload images if the remote Website exists (we assume it already
# has the images). "VALID" assumes "EXISTS".
# However, we must upload the index.php files.
- EXCLUDE_FOLDERS="--exclude keograms --exclude startrails --exclude videos"
+ EXCLUDE_FILES="--exclude-glob=*.jpg --exclude-glob=*.mp4"
-# ALEX: FIX: the --include doesn't work - the files aren't uploaded.
-# Do we need to do a second lftp mirror to upload them?
- EXCLUDE_FOLDERS+=" --include keograms/index.php"
- EXCLUDE_FOLDERS+=" --include startrails/index.php"
- EXCLUDE_FOLDERS+=" --include videos/index.php"
MSG+=" (without videos, images, and their thumbnails)."
else
MSG+=" (including any videos, images, and their thumbnails)."
@@ -709,7 +707,7 @@ function upload_remote_website()
CMDS+="${NL}cd ." # for debugging
fi
CMDS+="${NL}mirror --reverse --no-perms --verbose --overwrite --ignore-time --transfer-all"
- [[ -n ${EXCLUDE_FOLDERS} ]] && CMDS+=" ${EXCLUDE_FOLDERS}"
+ [[ -n ${EXCLUDE_FILES} ]] && CMDS+=" ${EXCLUDE_FILES}"
CMDS+="${NL}bye"
local TMP="${ALLSKY_TMP}/remote_upload.txt"
From d171f715c113584091022f932c7a1f66b1d3f327 Mon Sep 17 00:00:00 2001
From: Alex Greenland
Date: Fri, 20 Dec 2024 15:51:25 +0000
Subject: [PATCH 098/108] #4084 Fix for not using allsky-OLD configuration.json
---
remoteWebsiteInstall.sh | 43 +++++++----------------------------------
1 file changed, 7 insertions(+), 36 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index b16093512..794c444ba 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -23,7 +23,6 @@ DISPLAY_MSG_LOG="${ALLSKY_LOGS}/${ME/.sh/}.log"
# Config variables
HAVE_LOCAL_CONFIG="false"
-HAVE_PRIOR_CONFIG="false"
HAVE_NEW_STYLE_REMOTE_CONFIG="false"
HAVE_REALLY_OLD_REMOTE_CONFIG="false"
CONFIG_TO_USE="" # which Website configuration file to use?
@@ -212,8 +211,8 @@ function display_log_file()
#
# 1a. If ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} exists, use it.
#
-# 1b. If ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE} exists,
-# copy it to ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} and use it.
+# 1b. No longer used, assume upgrade of Allsky will copy the configuration file
+# to the new installation
#
# 2a. If there's a remote Website with a ${ALLSKY_WEBSITE_CONFIGURATION_NAME} file,
# save it locally as ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE} and use it.
@@ -238,20 +237,6 @@ function pre_install_checks()
MSG="Found ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}."
display_msg --logonly info "${MSG}"
HAVE_LOCAL_CONFIG="true"
-
-### FIX: ALEX: I don't think this "elif" part should be used.
-# During Allsky upgrades, if the OLD directory exists users are asked if
-# it should be used. If "yes", then the prior remote Website config file was
-# copied to the new Allsky, so 1a should match.
-# If the user answered "no", don't use OLD Allsky, we probably shouldn't either.
-# HAVE_PRIOR_CONFIG should also be deleted.
- elif [[ -f ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE} ]]; then
- # 1b.
- DT="FOUND ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE}."
- MSG="Found ${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE}."
- display_msg --logonly info "${MSG}"
- HAVE_PRIOR_CONFIG="true"
-
else
DT="NOT FOUND"
display_msg --logonly info "No local config file found."
@@ -308,13 +293,17 @@ function pre_install_checks()
DIALOG_TEXT+="NOT WORKING."
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
- if [[ ${HAVE_LOCAL_CONFIG} == "true" || ${HAVE_PRIOR_CONFIG} == "true" ]]; then
+ if [[ ${HAVE_LOCAL_CONFIG} == "true" ]]; then
DIALOG_TEXT+="${DIALOG_RED}"
DIALOG_TEXT+="\n${INDENT}WARNING: a remote configuration file exists"
DIALOG_TEXT+="\n${INDENT}but a remote Website wasn't found."
DIALOG_TEXT+="\n${INDENT}What is the configuration file for?"
DIALOG_TEXT+="${DIALOG_NORMAL}"
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
+ else
+ DIALOG_TEXT+="${DIALOG_RED}"
+ DIALOG_TEXT+="\n${INDENT}WARNING: No configuration file found a new one will be created."
+ DIALOG_TEXT+="${DIALOG_NORMAL}"
fi
fi
@@ -329,13 +318,6 @@ function pre_install_checks()
CONFIG_TO_USE="local" # it may be old or current format
CONFIG_MESSAGE="the current remote"
- elif [[ ${HAVE_PRIOR_CONFIG} == "true" ]]; then
- local B="$( basename "${PRIOR_ALLSKY_DIR}" )"
- MSG="Using the ${B} configuration file."
- display_msg --logonly info "${MSG}"
- CONFIG_TO_USE="prior" # it may be old or current format
- CONFIG_MESSAGE="the ${B}"
-
elif [[ ${HAVE_NEW_STYLE_REMOTE_CONFIG} == "true" ]]; then
MSG="Using new-style Website configuration file on the remote Website;"
MSG+=" it will be downloaded and saved locally."
@@ -530,17 +512,6 @@ function create_website_config()
fi
display_msg --logonly info "${MSG}"
- elif [[ ${CONFIG_TO_USE} == "prior" ]]; then
- # Use the config file from the prior Allsky, replacing as many placeholders as we can.
- # If the file is an older version, convert to the newest format.
- cp "${PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE}" "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}"
- replace_website_placeholders "remote"
- update_old "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}"
-
- MSG="Copied ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} from the"
- MSG+=" $( basename "${PRIOR_ALLSKY_DIR}" ) directory and updated placeholders."
- display_msg --logonly info "${MSG}"
-
elif [[ ${CONFIG_TO_USE} == "remoteNew" ]]; then
# Use the new remote config file since none were found locally.
# Replace placeholders and convert it to the newest format.
From 5f816483506c5812da209258c8253d7092903e4b Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Fri, 20 Dec 2024 15:02:50 -0600
Subject: [PATCH 099/108] Update remoteWebsiteInstall.sh: replace spaces with
tabs
To be consistent with everything else.
---
remoteWebsiteInstall.sh | 46 ++++++++++++++++++++---------------------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 794c444ba..0fa27103d 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -89,23 +89,23 @@ function enter_yes_no()
local RESULT=1
local ANSWER
- if [[ ${AUTO_CONFIRM} == "false" ]]; then
- while true; do
- echo -e "${TEXT}"
- read -r -p "Do you want to continue? (y/n): " ANSWER
- ANSWER="${ANSWER,,}" # convert to lowercase
-
- if [[ ${ANSWER} == "y" || ${ANSWER} == "yes" ]]; then
- return 0
- elif [[ ${ANSWER} == "n" || ${ANSWER} == "no" ]]; then
- return 1
- else
- echo -e "\nInvalid response. Please enter y/yes or n/no."
- fi
- done
- else
- return 0
- fi
+ if [[ ${AUTO_CONFIRM} == "false" ]]; then
+ while true; do
+ echo -e "${TEXT}"
+ read -r -p "Do you want to continue? (y/n): " ANSWER
+ ANSWER="${ANSWER,,}" # convert to lowercase
+
+ if [[ ${ANSWER} == "y" || ${ANSWER} == "yes" ]]; then
+ return 0
+ elif [[ ${ANSWER} == "n" || ${ANSWER} == "no" ]]; then
+ return 1
+ else
+ echo -e "\nInvalid response. Please enter y/yes or n/no."
+ fi
+ done
+ else
+ return 0
+ fi
return "${RESULT}"
}
@@ -114,10 +114,10 @@ function enter_yes_no()
# This function is only used when running in text (--text) mode.
function press_any_key()
{
- if [[ ${AUTO_CONFIRM} == "false" ]]; then
- echo -e "${1}\nPress any key to continue..."
- read -r -n1 -s
- fi
+ if [[ ${AUTO_CONFIRM} == "false" ]]; then
+ echo -e "${1}\nPress any key to continue..."
+ read -r -n1 -s
+ fi
}
# Add a common heading to the dialog text.
@@ -300,10 +300,10 @@ function pre_install_checks()
DIALOG_TEXT+="\n${INDENT}What is the configuration file for?"
DIALOG_TEXT+="${DIALOG_NORMAL}"
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
- else
+ else
DIALOG_TEXT+="${DIALOG_RED}"
DIALOG_TEXT+="\n${INDENT}WARNING: No configuration file found a new one will be created."
- DIALOG_TEXT+="${DIALOG_NORMAL}"
+ DIALOG_TEXT+="${DIALOG_NORMAL}"
fi
fi
From 0cef6d0ee87b1c03838b22d5b342c656beeb7098 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Fri, 20 Dec 2024 22:39:04 -0600
Subject: [PATCH 100/108] Update remoteWebsiteInstall.sh: be more specific with
excluded files
only exclude ones in subdirectories.
---
remoteWebsiteInstall.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 0fa27103d..235aef418 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -650,12 +650,17 @@ function upload_remote_website()
MSG="Starting upload to the remote Website"
[[ -n ${REMOTE_DIR} ]] && MSG+=" in ${REMOTE_DIR}"
+
+# TODO: for == "false", should prompt user if they want the files uploaded.
+
if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then
# Don't upload images if the remote Website exists (we assume it already
# has the images). "VALID" assumes "EXISTS".
# However, we must upload the index.php files.
- EXCLUDE_FILES="--exclude-glob=*.jpg --exclude-glob=*.mp4"
+ EXCLUDE_FILES="--exclude-glob=videos/*.mp4"
+ EXCLUDE_FILES+="--exclude-glob=keograms/*.jpg"
+ EXCLUDE_FILES+="--exclude-glob=startrails/*.jpg"
MSG+=" (without videos, images, and their thumbnails)."
else
From 263e3b95e8dce2cc9e00deb9dc607f857264dd38 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Fri, 20 Dec 2024 22:39:57 -0600
Subject: [PATCH 101/108] Update remoteWebsiteInstall.sh: run postData.sh
And make debug statement more obvious.
---
remoteWebsiteInstall.sh | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 235aef418..49ea84bd9 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -555,10 +555,10 @@ function check_if_files_exist()
local PRE_MSG="File '${FILE}'"
if [[ ${HTTP_STATUS} == "200" ]] ; then
- show_debug_message "${PRE_MSG} exists on the remote server"
+ show_debug_message "${PRE_MSG} EXISTS on the remote server"
RET_CODE=0
else
- show_debug_message "${PRE_MSG} does not exist on the remote server (HTTP_STATUS=${HTTP_STATUS})"
+ show_debug_message "${PRE_MSG} DOES NOT EXIST on the remote server (HTTP_STATUS=${HTTP_STATUS})"
if [[ ${AND_OR} == "and" ]]; then
return 1
fi
@@ -804,6 +804,13 @@ function enable_remote_website()
display_msg --logonly info "Remote Website enabled."
}
+function post_data()
+{
+ local MSG
+ MSG="$( "${ALLSKY_SCRIPTS}/postData.sh" --allfiles 2>&1 )"
+ display_msg --logonly info "${MSG}"
+}
+
############################################## main body
OK="true"
HELP="false"
@@ -851,4 +858,5 @@ disable_remote_website
upload_remote_website
upload_remote_config_file
enable_remote_website
+post_data
display_complete
From 1c9bf400f3694f861d4fe6a16802f6aab2319a53 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Fri, 20 Dec 2024 23:17:53 -0600
Subject: [PATCH 102/108] Update remoteWebsiteInstall.sh: Fix excludes (add
space)
Also:
* Add comment for future fix
* Make final message to user easier to read.
* Only update ALLSKY_VERSION if needed.
* Ignore thumbnails
* Shorten postData.sh output
---
remoteWebsiteInstall.sh | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 49ea84bd9..ff1843742 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -249,6 +249,9 @@ function pre_install_checks()
local INDENT=" "
REMOTE_WEBSITE_IS_VALID="$( check_if_website_is_valid )"
if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then
+# FIX: TODO: we only get here if there's SOME config file.
+# check_if_website_is_valid() should set HAVE_NEW_STYLE_REMOTE_CONFIG and
+# HAVE_REALLY_OLD_REMOTE_CONFIG so we don't do it again below.
# If we didn't find a remote Website configuration file on the Pi,
# it "should be" an old-style Website since the user wasn't
@@ -424,7 +427,8 @@ function display_complete()
{
local EXTRA_TEXT E E2
E="Use the WebUI's 'Editor' page to edit the"
- E+=" '${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} (remote Allsky Website)' file"
+ E+="\n '${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} (remote Allsky Website)'"
+ E+="\n file"
E2=", replacing any '${NEED_TO_UPDATE}' strings with the correct values."
if [[ ${CONFIG_TO_USE} == "new" ]]; then
EXTRA_TEXT="A new configuration file was created."
@@ -531,8 +535,13 @@ function create_website_config()
fi
fi
- update_json_file ".${WEBSITE_ALLSKY_VERSION}" "${ALLSKY_VERSION}" "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}"
- display_msg --logonly info "Updated remote configuration file to ${ALLSKY_VERSION}."
+ local VER="$( settings ".${WEBSITE_ALLSKY_VERSION}" "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}" )"
+ if [[ ${VER} == "${ALLSKY_VERSION}" ]]; then
+ display_msg --logonly info "'${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME}' already at ${ALLSKY_VERSION}."
+ else
+ update_json_file ".${WEBSITE_ALLSKY_VERSION}" "${ALLSKY_VERSION}" "${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}"
+ display_msg --logonly info "Updated '${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME}' to ${ALLSKY_VERSION}."
+ fi
}
# Check if a remote file, or array of files, exist.
@@ -659,9 +668,9 @@ function upload_remote_website()
# has the images). "VALID" assumes "EXISTS".
# However, we must upload the index.php files.
EXCLUDE_FILES="--exclude-glob=videos/*.mp4"
- EXCLUDE_FILES+="--exclude-glob=keograms/*.jpg"
- EXCLUDE_FILES+="--exclude-glob=startrails/*.jpg"
-
+ EXCLUDE_FILES+=" --exclude-glob=keograms/*.jpg"
+ EXCLUDE_FILES+=" --exclude-glob=startrails/*.jpg"
+ EXCLUDE_FILES+=" --exclude-glob=*/thumbnails/*.jpg"
MSG+=" (without videos, images, and their thumbnails)."
else
MSG+=" (including any videos, images, and their thumbnails)."
@@ -807,7 +816,8 @@ function enable_remote_website()
function post_data()
{
local MSG
- MSG="$( "${ALLSKY_SCRIPTS}/postData.sh" --allfiles 2>&1 )"
+ # --fromWebUI only displays summary.
+ MSG="$( "${ALLSKY_SCRIPTS}/postData.sh" --fromWebUI --allfiles 2>&1 )"
display_msg --logonly info "${MSG}"
}
From b518a953688923941ee327fa2f099cda11b2d1d7 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Fri, 20 Dec 2024 23:37:03 -0600
Subject: [PATCH 103/108] Update remoteWebsiteInstall.sh: Change myFiles dialog
to msgbox so user sees it
Also:
* Added variables for indenting for consistency.
---
remoteWebsiteInstall.sh | 55 ++++++++++++++++++++++-------------------
1 file changed, 29 insertions(+), 26 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index ff1843742..7cac95076 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -32,6 +32,7 @@ REMOTE_WEBSITE_IS_VALID="false"
# Dialog size variables
DIALOG_WIDTH="$( tput cols )"; ((DIALOG_WIDTH -= 10 ))
DIALOG_HEIGHT=25
+INDENT=" " # indent each line so it's easier to read
# Remote connectivity variables
REMOTE_URL="$( settings ".remotewebsiteurl" "${SETTINGS_FILE}" )"
@@ -246,7 +247,7 @@ function pre_install_checks()
DIALOG_TEXT+="\n2 - Checking for working remote Website: "
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
- local INDENT=" "
+ local SPACES="${INDENT}${INDENT}"
REMOTE_WEBSITE_IS_VALID="$( check_if_website_is_valid )"
if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then
# FIX: TODO: we only get here if there's SOME config file.
@@ -261,7 +262,7 @@ function pre_install_checks()
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
# 2a.
- DIALOG_TEXT+="\n${INDENT}* Checking it for new-style configuration file: "
+ DIALOG_TEXT+="\n${SPACES}* Checking it for new-style configuration file: "
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
local NEW_CONFIG_FILES=("${ALLSKY_WEBSITE_CONFIGURATION_NAME}")
if check_if_files_exist "${REMOTE_URL}" "or" "${NEW_CONFIG_FILES[@]}" ; then
@@ -275,7 +276,7 @@ function pre_install_checks()
DIALOG_TEXT+="NOT FOUND."
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
- DIALOG_TEXT+="\n${INDENT}* Checking it for old-style configuration file:"
+ DIALOG_TEXT+="\n${SPACES}* Checking it for old-style configuration file:"
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
local REALLY_OLD_CONFIG_FILES=("${OLD_CONFIG_NAME}")
if check_if_files_exist "${REMOTE_URL}" "or" "${REALLY_OLD_CONFIG_FILES[@]}" ; then
@@ -298,14 +299,14 @@ function pre_install_checks()
if [[ ${HAVE_LOCAL_CONFIG} == "true" ]]; then
DIALOG_TEXT+="${DIALOG_RED}"
- DIALOG_TEXT+="\n${INDENT}WARNING: a remote configuration file exists"
- DIALOG_TEXT+="\n${INDENT}but a remote Website wasn't found."
- DIALOG_TEXT+="\n${INDENT}What is the configuration file for?"
+ DIALOG_TEXT+="\n${SPACES}WARNING: a remote configuration file exists"
+ DIALOG_TEXT+="\n${SPACES}but a remote Website wasn't found."
+ DIALOG_TEXT+="\n${SPACES}What is the configuration file for?"
DIALOG_TEXT+="${DIALOG_NORMAL}"
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
else
DIALOG_TEXT+="${DIALOG_RED}"
- DIALOG_TEXT+="\n${INDENT}WARNING: No configuration file found a new one will be created."
+ DIALOG_TEXT+="\n${SPACES}WARNING: No configuration file found a new one will be created."
DIALOG_TEXT+="${DIALOG_NORMAL}"
fi
@@ -342,7 +343,7 @@ function pre_install_checks()
CONFIG_MESSAGE="a new"
fi
- DIALOG_TEXT+="\n * Checking ability to upload to Website: "
+ DIALOG_TEXT+="\n${SPACES} * Checking ability to upload to Website: "
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
display_msg --logonly info "Checking remote Website connectivity."
local ERR="$( check_connectivity )"
@@ -374,15 +375,15 @@ function display_welcome()
display_msg --logonly info "Displaying the welcome dialog."
local DIALOG_TEXT="\n\
This script will now:\n\n\
- 1) Use ${CONFIG_MESSAGE} configuration file.\n\
- 2) Upload the new remote Website code.\n\
- 3) Upload the remote Website configuration file.\n\
- 4) Enable the remote Website.\n\
- 5) Any existing startrails, keograms, and/or timelapse will NOT be touched.\n\
+${INDENT} 1) Use ${CONFIG_MESSAGE} configuration file.\n\
+${INDENT} 2) Upload the new remote Website code.\n\
+${INDENT} 3) Upload the remote Website configuration file.\n\
+${INDENT} 4) Enable the remote Website.\n\
+${INDENT} 5) Any existing startrails, keograms, and/or timelapse will NOT be touched.\n\
\n\
${DIALOG_RED}NOTE: This will:${DIALOG_NORMAL}\n\
- - Overwrite the old Allsky web files on the remote server.\n\
- - Remove any old Allsky files from the remote server.\n\n\n\
+${INDENT}- Overwrite the old Allsky web files on the remote server.\n\
+${INDENT}- Remove any old Allsky files from the remote server.\n\n\n\
${DIALOG_UNDERLINE}Are you sure you wish to continue?${DIALOG_NORMAL}"
if ! display_box "--yesno" "${DIALOG_WELCOME_TITLE}" "${DIALOG_TEXT}" ; then
display_aborted "--user" "at the Welcome dialog" ""
@@ -427,21 +428,21 @@ function display_complete()
{
local EXTRA_TEXT E E2
E="Use the WebUI's 'Editor' page to edit the"
- E+="\n '${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} (remote Allsky Website)'"
- E+="\n file"
+ E+="\n${INDENT} '${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME} (remote Allsky Website)'"
+ E+="\n${INDENT}file"
E2=", replacing any '${NEED_TO_UPDATE}' strings with the correct values."
if [[ ${CONFIG_TO_USE} == "new" ]]; then
EXTRA_TEXT="A new configuration file was created."
- EXTRA_TEXT+="\n ${E}${E2}"
+ EXTRA_TEXT+="\n${INDENT}${E}${E2}"
elif [[ ${CONFIG_TO_USE} == "remoteReallyOld" ]]; then
EXTRA_TEXT="You had a very old remote Allsky Website so a new configuration file was created."
- EXTRA_TEXT+="\n ${E}${E2}"
+ EXTRA_TEXT+="\n${INDENT}${E}${E2}"
else
EXTRA_TEXT="${E} to change settings for your remote Website."
fi
- local DIALOG_TEXT="\n The installation of the remote Website is complete.\n\n Please check it."
- DIALOG_TEXT+="\n\n ${EXTRA_TEXT}"
+ local DIALOG_TEXT="\n${INDENT}The installation of the remote Website is complete.\n\n${INDENT}Please check it."
+ DIALOG_TEXT+="\n\n${INDENT}${EXTRA_TEXT}"
display_box "--msgbox" "${DIALOG_DONE}" "${DIALOG_TEXT}"
clear # Gets rid of background color from last 'dialog' command.
@@ -721,15 +722,17 @@ function upload_remote_website()
for FILE_TO_WARN in "${OLD_FILES_TO_WARN[@]}"; do
if check_if_files_exist "${REMOTE_URL}" "or" "${FILE_TO_WARN}" ; then
- display_msg --logonly info "Old file '${FILE_TO_WARN}' exists."
+ display_msg --logonly info "Old file '${FILE_TO_WARN}' exists on server."
+ MSG="\n${INDENT}${DIALOG_RED}NOTE:${DIALOG_NORMAL}"
if [[ ${FILE_TO_WARN} == "myImages" ]]; then
# TODO: move the files for the user
- MSG="NOTE: move any files in '${FILE_TO_WARN}' on the remote Website to 'myFiles',"
- MSG+=" then remove '${FILE_TO_WARN}'. It is no longer used."
+ MSG+="\n${INDENT}Move any files in '${FILE_TO_WARN}' on the remote Website to 'myFiles',"
+ MSG+="\n${INDENT}then remove '${FILE_TO_WARN}'."
else
- MSG="NOTE: Please remove '${FILE_TO_WARN}' on the remote Website. It is no longer used."
+ MSG+="\n${INDENT}Please remove '${FILE_TO_WARN}' on the remote Website."
fi
- display_box "--infobox" "${DIALOG_INSTALL}" "${MSG}"
+ MSG+="\n${INDENT}It is no longer used."
+ display_box "--msgbox" "${DIALOG_INSTALL}" "${MSG}"
else
display_msg --logonly info "Old file '${FILE_TO_WARN}' does not exist."
fi
From 4deb36a679b326015be0011d1a8ff4b3fa75cd02 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sat, 21 Dec 2024 00:06:52 -0600
Subject: [PATCH 104/108] Update remoteWebsiteInstall.sh: Don't check for
config files twice.
Also:
* Change myFiles dialog to msgbox so user sees it
* Added variables for indenting for consistency.
* Improve message about no working Website.
---
remoteWebsiteInstall.sh | 62 ++++++++++++++++++++++-------------------
1 file changed, 33 insertions(+), 29 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index 7cac95076..c53054d7f 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -22,7 +22,7 @@ source "${ALLSKY_SCRIPTS}/installUpgradeFunctions.sh" || exit "${EXIT_ERROR_STOP
DISPLAY_MSG_LOG="${ALLSKY_LOGS}/${ME/.sh/}.log"
# Config variables
-HAVE_LOCAL_CONFIG="false"
+HAVE_LOCAL_REMOTE_CONFIG="false"
HAVE_NEW_STYLE_REMOTE_CONFIG="false"
HAVE_REALLY_OLD_REMOTE_CONFIG="false"
CONFIG_TO_USE="" # which Website configuration file to use?
@@ -237,7 +237,7 @@ function pre_install_checks()
DT="FOUND"
MSG="Found ${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE}."
display_msg --logonly info "${MSG}"
- HAVE_LOCAL_CONFIG="true"
+ HAVE_LOCAL_REMOTE_CONFIG="true"
else
DT="NOT FOUND"
display_msg --logonly info "No local config file found."
@@ -250,13 +250,7 @@ function pre_install_checks()
local SPACES="${INDENT}${INDENT}"
REMOTE_WEBSITE_IS_VALID="$( check_if_website_is_valid )"
if [[ ${REMOTE_WEBSITE_IS_VALID} == "true" ]]; then
-# FIX: TODO: we only get here if there's SOME config file.
-# check_if_website_is_valid() should set HAVE_NEW_STYLE_REMOTE_CONFIG and
-# HAVE_REALLY_OLD_REMOTE_CONFIG so we don't do it again below.
-
- # If we didn't find a remote Website configuration file on the Pi,
- # it "should be" an old-style Website since the user wasn't
- # using the WebUI to configure it.
+ # There is at least one config file.
DIALOG_TEXT+="WORKING."
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
@@ -264,13 +258,9 @@ function pre_install_checks()
# 2a.
DIALOG_TEXT+="\n${SPACES}* Checking it for new-style configuration file: "
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
- local NEW_CONFIG_FILES=("${ALLSKY_WEBSITE_CONFIGURATION_NAME}")
- if check_if_files_exist "${REMOTE_URL}" "or" "${NEW_CONFIG_FILES[@]}" ; then
- HAVE_NEW_STYLE_REMOTE_CONFIG="true"
+ if [[ ${HAVE_NEW_STYLE_REMOTE_CONFIG} == "true" ]]; then
DIALOG_TEXT+="FOUND."
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
- MSG="Found a current configuration file on the remote server."
- display_msg --logonly info "${MSG}"
else
# 2b.
DIALOG_TEXT+="NOT FOUND."
@@ -278,16 +268,12 @@ function pre_install_checks()
DIALOG_TEXT+="\n${SPACES}* Checking it for old-style configuration file:"
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
- local REALLY_OLD_CONFIG_FILES=("${OLD_CONFIG_NAME}")
- if check_if_files_exist "${REMOTE_URL}" "or" "${REALLY_OLD_CONFIG_FILES[@]}" ; then
- HAVE_REALLY_OLD_REMOTE_CONFIG="true"
+ if [[ ${HAVE_REALLY_OLD_REMOTE_CONFIG} == "true" ]]; then
DT="FOUND."
- MSG="Found old-style ${OLD_CONFIG_NAME} file on the remote Website."
- display_msg --logonly info "${MSG}"
else
# This "shouldn't" happen - the remote Website should have SOME type
# of configuration file.
- DT="NOT FOUND."
+ DT="ERROR: NOT FOUND."
fi
DIALOG_TEXT+="${DT}"
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
@@ -297,16 +283,21 @@ function pre_install_checks()
DIALOG_TEXT+="NOT WORKING."
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
- if [[ ${HAVE_LOCAL_CONFIG} == "true" ]]; then
+ if [[ ${HAVE_LOCAL_REMOTE_CONFIG} == "true" ]]; then
+ # The remote's config file is on the Pi but the remote Website doesn't have a
+ # config file and/or the Website source files.
+ # This could happen if the user HAD a working remote Website but moved all the files to,
+ # for example, "allsky/OLD", before upgrading.
DIALOG_TEXT+="${DIALOG_RED}"
DIALOG_TEXT+="\n${SPACES}WARNING: a remote configuration file exists"
- DIALOG_TEXT+="\n${SPACES}but a remote Website wasn't found."
- DIALOG_TEXT+="\n${SPACES}What is the configuration file for?"
+ DIALOG_TEXT+="\n${SPACES}but a working remote Website wasn't found."
+ DIALOG_TEXT+="\n${SPACES}If you moved the remote Website before upgrading, ignore this message."
+ DIALOG_TEXT+="\n\n${SPACES}Either way, a new Website will be created."
DIALOG_TEXT+="${DIALOG_NORMAL}"
display_box "--infobox" "${DIALOG_PRE_CHECK}" "${DIALOG_TEXT}"
else
DIALOG_TEXT+="${DIALOG_RED}"
- DIALOG_TEXT+="\n${SPACES}WARNING: No configuration file found a new one will be created."
+ DIALOG_TEXT+="\n${SPACES}WARNING: No configuration file found so a new one will be created."
DIALOG_TEXT+="${DIALOG_NORMAL}"
fi
@@ -625,12 +616,23 @@ function remove_remote_file()
# Returns - echo "true" if it exists, else "false"
function check_if_website_is_valid()
{
- local CONFIG_FILES=("${OLD_CONFIG_NAME}" "${ALLSKY_WEBSITE_CONFIGURATION_NAME}")
+ local FOUND="false"
local WEBSITE_FILES=("index.php" "functions.php")
- display_msg --logonly info "Looking for a config file at ${REMOTE_URL}"
- if check_if_files_exist "${REMOTE_URL}" "or" "${CONFIG_FILES[@]}" ; then
- local MSG=" Found a config file"
+ display_msg --logonly info "Looking for old and new config files at ${REMOTE_URL}"
+ if check_if_files_exist "${REMOTE_URL}" "or" "${OLD_CONFIG_NAME}" ; then
+ HAVE_REALLY_OLD_REMOTE_CONFIG="true"
+ FOUND="true"
+ fi
+ if check_if_files_exist "${REMOTE_URL}" "or" "${ALLSKY_WEBSITE_CONFIGURATION_NAME}" ; then
+ HAVE_NEW_STYLE_REMOTE_CONFIG="true"
+ FOUND="true"
+ fi
+
+ if [[ ${FOUND} == "true" ]]; then
+ local MSG=" config files found:"
+ [[ ${HAVE_REALLY_OLD_REMOTE_CONFIG} == "true" ]] && MSG+=" ${OLD_CONFIG_NAME}"
+ [[ ${HAVE_NEW_STYLE_REMOTE_CONFIG} == "true" ]] && MSG+=" ${ALLSKY_WEBSITE_CONFIGURATION_NAME}"
if check_if_files_exist "${REMOTE_URL}" "and" "${WEBSITE_FILES[@]}" ; then
display_msg --logonly info "${MSG} and a valid Website."
@@ -640,7 +642,9 @@ function check_if_website_is_valid()
display_msg --logonly info "${MSG} but NOT a valid Website."
fi
else
- display_msg --logonly info " Did not find a config file; assuming invalid site"
+ # If the user just created the "allsky" directory on the Website but nothing else,
+ # we'll get here.
+ display_msg --logonly info " Did not find a config file; assuming new, unpopulated Website."
fi
echo "false"
From d100ed4badb6b8a8cf9e94c7fbf71a28a9bcfc97 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sat, 21 Dec 2024 00:20:43 -0600
Subject: [PATCH 105/108] Update remoteWebsiteInstall.sh: Simplify check for
"myImages"
Also, remove the ".git" directory.
---
remoteWebsiteInstall.sh | 35 ++++++++++++++++-------------------
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git a/remoteWebsiteInstall.sh b/remoteWebsiteInstall.sh
index c53054d7f..f241d56f4 100755
--- a/remoteWebsiteInstall.sh
+++ b/remoteWebsiteInstall.sh
@@ -77,8 +77,8 @@ OLD_FILES_TO_REMOVE=( \
"getTime.php" \
"virtualsky.json" \
"README.md" \
- "version" )
-OLD_FILES_TO_WARN=( "myImages" )
+ "version" \
+ ".git/" )
############################################## functions
@@ -724,23 +724,20 @@ function upload_remote_website()
remove_remote_file "${FILE_TO_DELETE}" "do not check"
done
- for FILE_TO_WARN in "${OLD_FILES_TO_WARN[@]}"; do
- if check_if_files_exist "${REMOTE_URL}" "or" "${FILE_TO_WARN}" ; then
- display_msg --logonly info "Old file '${FILE_TO_WARN}' exists on server."
- MSG="\n${INDENT}${DIALOG_RED}NOTE:${DIALOG_NORMAL}"
- if [[ ${FILE_TO_WARN} == "myImages" ]]; then
-# TODO: move the files for the user
- MSG+="\n${INDENT}Move any files in '${FILE_TO_WARN}' on the remote Website to 'myFiles',"
- MSG+="\n${INDENT}then remove '${FILE_TO_WARN}'."
- else
- MSG+="\n${INDENT}Please remove '${FILE_TO_WARN}' on the remote Website."
- fi
- MSG+="\n${INDENT}It is no longer used."
- display_box "--msgbox" "${DIALOG_INSTALL}" "${MSG}"
- else
- display_msg --logonly info "Old file '${FILE_TO_WARN}' does not exist."
- fi
- done
+ local DIR="myImages"
+ if check_if_files_exist "${REMOTE_URL}" "or" "${DIR}" ; then
+ display_msg --logonly info "Old directory '${DIR}' exists on server."
+
+ # It would be nice to move the files for the user,
+ # but almost no one has a "myImages" directory.
+ MSG="\n${INDENT}${DIALOG_RED}NOTE:${DIALOG_NORMAL}"
+ MSG+="\n${INDENT}Move any files in '${DIR}' on the remote Website to"
+ MSG+="\n${INDENT}the 'myFiles' directory, then remove '${DIR}'."
+ MSG+="\n${INDENT}It is no longer used."
+ display_box "--msgbox" "${DIALOG_INSTALL}" "${MSG}"
+ else
+ display_msg --logonly info "Old file '${DIR}' does not exist."
+ fi
display_msg --logonly info "Website upload complete"
}
From 53075b75939269e1331216e55204b543ff19ee81 Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sat, 21 Dec 2024 14:34:36 -0600
Subject: [PATCH 106/108] Update public.php: remove spurious );
---
html/public.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/public.php b/html/public.php
index 79ddd0132..0e54cc9ce 100644
--- a/html/public.php
+++ b/html/public.php
@@ -41,7 +41,7 @@ function getImage() {
if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
console.log('broken image: ', err);
}
- });
+ }
}).finally(() => {
// Use tail recursion to trigger the next invocation after `$delay` milliseconds
setTimeout(function () { getImage(); }, );
From 5b262db9d2b307899a469addb02638a555ed135a Mon Sep 17 00:00:00 2001
From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com>
Date: Sat, 21 Dec 2024 14:39:39 -0600
Subject: [PATCH 107/108] Update public.php: Add ;
---
html/public.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/html/public.php b/html/public.php
index 0e54cc9ce..8a6673258 100644
--- a/html/public.php
+++ b/html/public.php
@@ -46,7 +46,7 @@ function getImage() {
// Use tail recursion to trigger the next invocation after `$delay` milliseconds
setTimeout(function () { getImage(); }, );
});
- }
+ };
getImage();
From 26f6f0bce426d3045b817015bf697763c47cf48b Mon Sep 17 00:00:00 2001
From: Alex Greenland
Date: Sat, 21 Dec 2024 21:41:01 +0000
Subject: [PATCH 108/108] Fix timed reload
---
html/public.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/html/public.php b/html/public.php
index 8a6673258..5866713f9 100644
--- a/html/public.php
+++ b/html/public.php
@@ -41,11 +41,11 @@ function getImage() {
if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
console.log('broken image: ', err);
}
- }
- }).finally(() => {
- // Use tail recursion to trigger the next invocation after `$delay` milliseconds
- setTimeout(function () { getImage(); }, );
- });
+ }).finally(() => {
+ // Use tail recursion to trigger the next invocation after `$delay` milliseconds
+ setTimeout(function () { getImage(); }, );
+ }
+ );
};
getImage();
|