[Skip-CI] WIP check file before building
This commit is contained in:
parent
37170ee982
commit
e6c51ed479
2 changed files with 29 additions and 33 deletions
|
@ -13,38 +13,39 @@ source /usr/local/bin/functions.sh
|
||||||
|
|
||||||
filename="website.zip"
|
filename="website.zip"
|
||||||
hashfilename="hashfile"
|
hashfilename="hashfile"
|
||||||
|
touch $HASHFILEDIR/$hashfilename
|
||||||
|
|
||||||
|
# create empty hashfile
|
||||||
# download website data
|
# download website data
|
||||||
# check if hashfile exists
|
# compare current hash to hashfile
|
||||||
# if yes
|
# same?
|
||||||
# hash the current file
|
# do nothing
|
||||||
# compare current hash to hashfile
|
# not same?
|
||||||
# same?
|
# overwrite hashfile with new hash
|
||||||
# do nothing
|
# unzip website
|
||||||
# not same?
|
# execute scripts (if applicable)
|
||||||
# overwrite hashfile with new hash
|
# build website
|
||||||
# start the website build
|
# move files
|
||||||
# if not
|
|
||||||
# hash the current file
|
|
||||||
# write the hashfile
|
|
||||||
# start the build
|
|
||||||
|
|
||||||
echo "Downloading website data"
|
echo "Downloading website data"
|
||||||
get-website-data $filename
|
get-website-data $filename
|
||||||
echo "Check for new content"
|
|
||||||
if [[ -f $hashfile ]]
|
|
||||||
then
|
|
||||||
currentHash=$(print-hash-from-file $filename )
|
|
||||||
|
|
||||||
else
|
|
||||||
write-hashfile $filename $hashfilename
|
|
||||||
|
|
||||||
|
echo "Check for new content"
|
||||||
|
currentHash=$( print-hash-from-file $filename )
|
||||||
|
if [[ $currentHash == $(cat $HASHFILEDIR/$hashfilename) ]]
|
||||||
|
then
|
||||||
|
echo "Nothing to do"
|
||||||
|
else
|
||||||
|
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
|
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() {
|
function write-hashfile() {
|
||||||
(cd $SOURCEDIR; sha256sum $1 | cut -d " " -f 1 > $HASHFILEDIR/$2;)
|
echo $1 > $HASHFILEDIR/$2
|
||||||
}
|
}
|
||||||
|
|
||||||
function print-hash-from-file() {
|
function print-hash-from-file() {
|
||||||
(cd $SOURCEDIR; sha256sum $1 | cut -d " " -f 1;)
|
(cd $SOURCEDIR; sha256sum $1 | cut -d " " -f 1;)
|
||||||
}
|
}
|
||||||
|
|
||||||
function compare-website-data() {
|
|
||||||
oldHash="$( cat ~/hashfile )"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function unzip-website-data() {
|
function unzip-website-data() {
|
||||||
unzip $SOURCEDIR/$1 -d $BUILDDIR
|
unzip $SOURCEDIR/$1 -d $BUILDDIR
|
||||||
}
|
}
|
||||||
|
@ -41,7 +36,7 @@ function execute-scripts-when-existing {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function build-and-extract-website() {
|
function build-website() {
|
||||||
(cd $BUILDDIR; dir=$(ls); cd $dir; lein run;)
|
(cd $BUILDDIR; dir=$(ls); cd $dir; lein run;)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue