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 01/18] 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 02/18] 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 03/18] 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 04/18] 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 05/18] 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 06/18] 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 07/18] 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 08/18] 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 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 09/18] 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 615574dfa323237fcd36b19f1b4b10e0374f23eb Mon Sep 17 00:00:00 2001 From: Alex Greenland Date: Fri, 20 Dec 2024 15:11:14 +0000 Subject: [PATCH 10/18] #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 11/18] #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 12/18] 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 13/18] 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 14/18] 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 15/18] 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 16/18] 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 17/18] 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 18/18] 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" }