Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run postData.sh during installation if needed #4039

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}"
Expand All @@ -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" )
Expand Down
11 changes: 11 additions & 0 deletions scripts/installUpgradeFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}."

Expand All @@ -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
}


Expand Down
3 changes: 1 addition & 2 deletions scripts/makeChanges.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;

Expand Down
Loading