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

website/install.sh: Inform user what to do #697

Merged
merged 2 commits into from
Oct 20, 2021
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
6 changes: 6 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/bin/bash

if [ -z "${ALLSKY_HOME}" ]
then
export ALLSKY_HOME="$(realpath $(dirname "${BASH_ARGV0}"))"
fi

source "variables.sh"
if [[ $EUID -eq 0 ]]; then
echo "This script must NOT be run as root" 1>&2
Expand Down
50 changes: 33 additions & 17 deletions website/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,44 @@
if [ -z "${ALLSKY_HOME}" ] ; then
export ALLSKY_HOME=$(realpath $(dirname "${BASH_ARGV0}")/..)
fi
source ${ALLSKY_HOME}/variables.sh
source "${ALLSKY_HOME}/variables.sh"
source "${ALLSKY_CONFIG}/config.sh"

echo -en '\n'
echo -e "*************************************"
echo "*** Welcome to the Allsky Website ***"
echo -e "*************************************"
echo -en '\n'
echo
echo "*************************************"
echo "*** Welcome to the Allsky Website ***"
echo "*************************************"
echo

echo -en "${GREEN}* Fetching website files\n${NC}"
echo -e "${GREEN}* Fetching website files into ${WEBSITE_DIR}${NC}"
git clone https://github.com/thomasjacquin/allsky-website.git "${WEBSITE_DIR}"
echo -en '\n'
echo

cd "${WEBSITE_DIR}"

# xxxx Should set some variables in config.js based on settings_*.json and config.sh
# If the directories already exist, don't mess with them.
if [ ! -d startrails/thumbnails -o ! -d keograms/thumbnails -o ! -d videos/thumbnails ]; then
echo -e "${GREEN}* Creating thumbnails directories${NC}"
mkdir -p startrails/thumbnails keograms/thumbnails videos/thumbnails
echo

echo -en "${GREEN}* Creating thumbnails directories\n${NC}"
mkdir startrails/thumbnails keograms/thumbnails videos/thumbnails
echo -en '\n'
echo -e "${GREEN}* Fixing ownership and permissions${NC}"
chown -R pi:www-data .
find ./ -type f -exec chmod 644 {} \;
find ./ -type d -exec chmod 775 {} \;
echo
fi

# xxxx Should set some variables in config.js based on settings_*.json and config.sh.
# In the meantime, let the user know to do it.
echo
echo -e "${GREEN}* Installation complete${NC}"
echo

echo -en "${GREEN}* Fixing ownership and permissions\n${NC}"
chown -R pi:www-data .
find ./ -type f -exec chmod 644 {} \;
find ./ -type d -exec chmod 775 {} \;
echo -en '\n'
echo "+++++++++++++++++++++++++++++++++++++"
echo "Before using the website you need to:"
echo " * Edit '${WEBSITE_DIR}/config.js'"
if [ "x${POST_END_OF_NIGHT_DATA}" != "xtrue" ]; then
echo " * Set 'POST_END_OF_NIGHT_DATA=true' in ${ALLSKY_CONFIG}/config.sh"
fi
echo