2022-09-23 13:39:17 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-09-28 12:32:41 +00:00
|
|
|
mkdir $BUILDDIR
|
|
|
|
mkdir $SOURCEDIR
|
2022-12-02 09:04:09 +00:00
|
|
|
mkdir -p $HASHFILEDIR
|
2022-09-28 12:32:41 +00:00
|
|
|
|
2022-11-11 12:27:28 +00:00
|
|
|
set -o nounset
|
|
|
|
set -o xtrace
|
|
|
|
set -o errexit
|
|
|
|
set -eo pipefail
|
|
|
|
|
2022-09-23 13:39:17 +00:00
|
|
|
source /usr/local/bin/functions.sh
|
|
|
|
|
2022-12-02 08:37:03 +00:00
|
|
|
filename="website.zip"
|
|
|
|
hashfilename="hashfile"
|
|
|
|
|
2022-12-02 09:36:44 +00:00
|
|
|
# create empty hashfile
|
2022-12-02 08:37:03 +00:00
|
|
|
# download website data
|
2022-12-02 09:36:44 +00:00
|
|
|
# compare current hash to hashfile
|
|
|
|
# same?
|
|
|
|
# do nothing
|
|
|
|
# not same?
|
|
|
|
# overwrite hashfile with new hash
|
|
|
|
# unzip website
|
|
|
|
# execute scripts (if applicable)
|
|
|
|
# build website
|
|
|
|
# move files
|
2022-12-02 08:37:03 +00:00
|
|
|
|
|
|
|
echo "Downloading website data"
|
2022-12-02 09:04:09 +00:00
|
|
|
get-website-data $filename
|
2022-12-02 09:36:44 +00:00
|
|
|
|
2022-12-02 08:37:03 +00:00
|
|
|
echo "Check for new content"
|
2022-12-02 09:36:44 +00:00
|
|
|
currentHash=$( print-hash-from-file $filename )
|
2022-12-02 10:33:27 +00:00
|
|
|
touch $HASHFILEDIR/$hashfilename
|
2022-12-02 09:36:44 +00:00
|
|
|
if [[ $currentHash == $(cat $HASHFILEDIR/$hashfilename) ]]
|
2022-12-02 08:37:03 +00:00
|
|
|
then
|
2022-12-02 09:36:44 +00:00
|
|
|
echo "Nothing to do"
|
2022-12-02 08:37:03 +00:00
|
|
|
else
|
2022-12-02 09:36:44 +00:00
|
|
|
write-hashfile $currentHash $hashfilename
|
|
|
|
unzip-website-data $filename
|
|
|
|
echo "Executing Custom Scripts, if applicable"
|
|
|
|
execute-scripts-when-existing
|
|
|
|
echo "Building website"
|
|
|
|
build-website
|
|
|
|
echo "Moving files"
|
|
|
|
move-website-files-to-target
|
2022-12-02 08:37:03 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2022-12-02 09:36:44 +00:00
|
|
|
|
|
|
|
|