Skip to content

Commit

Permalink
Merge pull request #3932 from AllskyTeam/myFiles-changes
Browse files Browse the repository at this point in the history
myFiles changes
  • Loading branch information
EricClaeys authored Nov 1, 2024
2 parents 0e67e3e + 27d105c commit 67e3112
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 39 deletions.
65 changes: 27 additions & 38 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,11 @@ set_permissions()
fi
done

# These directories aren't in GitHub so need to be manually created.
mkdir -p \
"${ALLSKY_EXTRA}" \
"${ALLSKY_MYFILES_DIR}"

# The web server needs to be able to create and update many of the files in ${ALLSKY_CONFIG}.
# Not all, but go ahead and chgrp all of them so we don't miss any new ones.
sudo find "${ALLSKY_CONFIG}/" -type f -exec chmod 664 '{}' \;
Expand Down Expand Up @@ -956,6 +961,7 @@ set_permissions()

# These directories aren't in GitHub so need to be manually created.
mkdir -p \
"${ALLSKY_WEBSITE_MYFILES_DIR}" \
"${ALLSKY_WEBSITE}/videos/thumbnails" \
"${ALLSKY_WEBSITE}/keograms/thumbnails" \
"${ALLSKY_WEBSITE}/startrails/thumbnails"
Expand Down Expand Up @@ -2383,11 +2389,6 @@ restore_prior_files()
CONFIGURATION_NEEDED="${STATUS_NO_LAT_LONG}"
fi

# Default permissions for these are ok.
mkdir -p \
"${ALLSKY_EXTRA}" \
"${ALLSKY_CONFIG}/myFiles"

STATUS_VARIABLES+=( "${FUNCNAME[0]}='true'\n" )
return # Nothing left to do in this function, so return
fi
Expand Down Expand Up @@ -2431,12 +2432,11 @@ restore_prior_files()
display_msg --log progress "${ITEM}: ${NOT_RESTORED}"
fi

ITEM="${SPACE}'config/myFiles' directory"
if [[ -d ${PRIOR_CONFIG_DIR}/myFiles ]]; then
ITEM="${SPACE}'$( basename "$( dirname "${ALLSKY_MYFILES_DIR}" )" )/${ALLSKY_MYFILES_NAME}' directory"
if [[ -d ${PRIOR_MYFILES_DIR} ]]; then
display_msg --log progress "${ITEM} (moving)"
mv "${PRIOR_CONFIG_DIR}/myFiles" "${ALLSKY_CONFIG}"
mv "${PRIOR_MYFILES_DIR}" "${ALLSKY_MYFILES_DIR}"
else
mkdir -p "${ALLSKY_CONFIG}/myFiles"
# Almost no one has this directory, so don't show to user.
display_msg --logonly info "${ITEM}: ${NOT_RESTORED}"
fi
Expand Down Expand Up @@ -2711,16 +2711,13 @@ restore_prior_website_files()
display_msg --log progress "${ITEM}: ${NOT_RESTORED}"
fi

ITEM="${SPACE}${SPACE}'myFiles' directory"
D="${PRIOR_WEBSITE_DIR}/myFiles"
ITEM="${SPACE}${SPACE}'${ALLSKY_MYFILES_NAME}' directory"
D="${PRIOR_WEBSITE_DIR}/${ALLSKY_MYFILES_NAME}"
if [[ -d ${D} ]]; then
count=$( get_count "${D}" '*' )
if [[ ${count} -gt 1 ]]; then
display_msg --log progress "${ITEM} (moving)"
mv "${D}" "${ALLSKY_WEBSITE}"
fi
display_msg --log progress "${ITEM} (moving)"
mv "${D}" "${ALLSKY_WEBSITE_MYFILES_DIR}"
else
display_msg --log progress "${ITEM}: ${NOT_RESTORED}"
display_msg --logonly info "${ITEM}: ${NOT_RESTORED}"
fi

# This is the old name.
Expand All @@ -2730,9 +2727,10 @@ restore_prior_website_files()
if [[ -d ${D} ]]; then
count=$( get_count "${D}" '*' )
if [[ ${count} -gt 1 ]]; then
local MSG2=" Please use 'myFiles' going forward."
display_msg --log progress "${ITEM} (copying to '${ALLSKY_WEBSITE}/myFiles')" "${MSG2}"
cp "${D}"/* "${ALLSKY_WEBSITE}/myFiles"
local MSG2=" Please use '${ALLSKY_WEBSITE_MYFILES_DIR}' going forward."
display_msg --log progress "${ITEM} (copying to '${ALLSKY_WEBSITE_MYFILES_DIR}')" "${MSG2}"
# TODO: This won't copy dot files.
cp "${D}"/* "${ALLSKY_WEBSITE_MYFILES_DIR}"
fi
else
# Since this is obsolete only add to log file.
Expand Down Expand Up @@ -2777,7 +2775,7 @@ restore_prior_website_files()
echo -e "${MSG}"
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"
echo -e "\n ${ALLSKY_WEBSITE_MYFILES_DIR}"
echo "then remove the old website: sudo rm -fr ${PRIOR_WEBSITE_DIR}"
} >> "${POST_INSTALLATION_ACTIONS}"

Expand Down Expand Up @@ -2881,10 +2879,10 @@ do_restore()
display_msg --log progress "${ITEM}: ${NOT_RESTORED}"
fi

ITEM="${SPACE}'config/myFiles' directory"
if [[ -d ${ALLSKY_CONFIG}/myFiles ]]; then
ITEM="${SPACE}'$( basename "$( dirname "${ALLSKY_MYFILES_DIR}" )" )/${ALLSKY_MYFILES_NAME}' directory"
if [[ -d ${ALLSKY_MYFILES_DIR} ]]; then
display_msg --log progress "${ITEM} (moving back)"
mv "${ALLSKY_CONFIG}/myFiles" "${PRIOR_CONFIG_DIR}"
mv "${ALLSKY_MYFILES_DIR}" "${PRIOR_MYFILES_DIR}"
else
# Few people have this directory, so don't show to user.
display_msg --logonly info "${ITEM}: ${NOT_RESTORED}"
Expand Down Expand Up @@ -2926,22 +2924,13 @@ do_restore()
display_msg --log progress "${ITEM}: ${NOT_RESTORED}"
fi

ITEM="${SPACE}${SPACE}'myFiles' directory"
D="${ALLSKY_WEBSITE}/myFiles"
if [[ -d ${D} ]]; then
count=$( get_count "${D}" '*' )
if [[ ${count} -gt 1 ]]; then
display_msg --log progress "${ITEM} (moving)"
mv "${D}" "${PRIOR_WEBSITE_DIR}"
fi
ITEM="${SPACE}${SPACE}${ALLSKY_MYFILES_NAME}"
if [[ -d ${ALLSKY_WEBSITE_MYFILES_DIR} ]]; then
display_msg --log progress "${ITEM} (moving)"
mv "${ALLSKY_WEBSITE_MYFILES_DIR}" "${PRIOR_WEBSITE_DIR}"
else
display_msg --log progress "${ITEM}: ${NOT_RESTORED}"
display_msg --logonly info "${ITEM}: ${NOT_RESTORED}"
fi

#xx TODO: huh? why remove it?
#xx ITEM="${SPACE}${SPACE}Local Website directory"
#xx display_msg --log progress "${ITEM} (removing)"
#xx rm -fr "${ALLSKY_WEBSITE}"
fi

# Since we'll be running a new Allsky, start off with clean log files.
Expand Down
3 changes: 2 additions & 1 deletion scripts/installUpgradeFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export REPO_OPTIONS_FILE="${ALLSKY_REPO}/$( basename "${OPTIONS_FILE}" ).repo"
export REPO_ENV_FILE="${ALLSKY_REPO}/$( basename "${ALLSKY_ENV}" ).repo"
export REPO_WEBSITE_CONFIGURATION_FILE="${ALLSKY_REPO}/${ALLSKY_WEBSITE_CONFIGURATION_NAME}.repo"

##### Information on prior Allsky versions
##### Information on prior Allsky versions and files.
# Location of old-style WebUI and Website.
export OLD_WEBUI_LOCATION="/var/www/html"
export OLD_WEBSITE_LOCATION="${OLD_WEBUI_LOCATION}/allsky"
Expand All @@ -35,6 +35,7 @@ export PRIOR_ALLSKY_DIR="$( dirname "${ALLSKY_HOME}" )/${ALLSKY_INSTALL_DIR}-OLD
export PRIOR_CONFIG_DIR="${PRIOR_ALLSKY_DIR}/$( basename "${ALLSKY_CONFIG}" )"
export PRIOR_REMOTE_WEBSITE_CONFIGURATION_FILE="${PRIOR_CONFIG_DIR}/${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME}"
export PRIOR_PYTHON_VENV="${PRIOR_ALLSKY_DIR}/venv/lib"
export PRIOR_MYFILES_DIR="${ALLSKY_MYFILES_DIR/${ALLSKY_HOME}/${PRIOR_ALLSKY_DIR}}"

# Name of setting that determines version of Website config file.
export WEBSITE_CONFIG_VERSION="ConfigVersion"
Expand Down
5 changes: 5 additions & 0 deletions variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ if [[ -z "${ALLSKY_VARIABLE_SET}" ]]; then
ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME="remote_${ALLSKY_WEBSITE_CONFIGURATION_NAME}"
ALLSKY_REMOTE_WEBSITE_CONFIGURATION_FILE="${ALLSKY_CONFIG}/${ALLSKY_REMOTE_WEBSITE_CONFIGURATION_NAME}"

# Areas for users' Allsky-related files that get propogated to new releases.
ALLSKY_MYFILES_NAME="myFiles"
ALLSKY_MYFILES_DIR="${ALLSKY_CONFIG}/${ALLSKY_MYFILES_NAME}"
ALLSKY_WEBSITE_MYFILES_DIR="${ALLSKY_WEBSITE}/${ALLSKY_MYFILES_NAME}"

# Holds all the Allsky documentation.
ALLSKY_DOCUMENTATION="${ALLSKY_WEBUI}/documentation"

Expand Down

0 comments on commit 67e3112

Please sign in to comment.