[Skip-CI] WIP check file before building

merge-requests/4/head
erik 1 year ago
parent 37170ee982
commit e6c51ed479

@ -13,38 +13,39 @@ source /usr/local/bin/functions.sh
filename="website.zip"
hashfilename="hashfile"
touch $HASHFILEDIR/$hashfilename
# create empty hashfile
# download website data
# check if hashfile exists
# if yes
# hash the current file
# compare current hash to hashfile
# same?
# do nothing
# not same?
# overwrite hashfile with new hash
# start the website build
# if not
# hash the current file
# write the hashfile
# start the build
# 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
echo "Downloading website data"
get-website-data $filename
echo "Check for new content"
if [[ -f $hashfile ]]
currentHash=$( print-hash-from-file $filename )
if [[ $currentHash == $(cat $HASHFILEDIR/$hashfilename) ]]
then
currentHash=$(print-hash-from-file $filename )
echo "Nothing to do"
else
write-hashfile $filename $hashfilename
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
fi
echo "Executing Custom Scripts, if applicable"
execute-scripts-when-existing
echo "Building website"
build-and-extract-website
echo "Moving files"
move-website-files-to-target

@ -5,18 +5,13 @@ function get-website-data() {
}
function write-hashfile() {
(cd $SOURCEDIR; sha256sum $1 | cut -d " " -f 1 > $HASHFILEDIR/$2;)
echo $1 > $HASHFILEDIR/$2
}
function print-hash-from-file() {
(cd $SOURCEDIR; sha256sum $1 | cut -d " " -f 1;)
}
function compare-website-data() {
oldHash="$( cat ~/hashfile )"
}
function unzip-website-data() {
unzip $SOURCEDIR/$1 -d $BUILDDIR
}
@ -41,7 +36,7 @@ function execute-scripts-when-existing {
fi
}
function build-and-extract-website() {
function build-website() {
(cd $BUILDDIR; dir=$(ls); cd $dir; lein run;)
}

Loading…
Cancel
Save