[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
|
|
||||||
# if yes
|
|
||||||
# hash the current file
|
|
||||||
# compare current hash to hashfile
|
# compare current hash to hashfile
|
||||||
# same?
|
# same?
|
||||||
# do nothing
|
# do nothing
|
||||||
# not same?
|
# not same?
|
||||||
# overwrite hashfile with new hash
|
# overwrite hashfile with new hash
|
||||||
# start the website build
|
# unzip website
|
||||||
# if not
|
# execute scripts (if applicable)
|
||||||
# hash the current file
|
# build website
|
||||||
# write the hashfile
|
# move files
|
||||||
# start the build
|
|
||||||
|
|
||||||
echo "Downloading website data"
|
echo "Downloading website data"
|
||||||
get-website-data $filename
|
get-website-data $filename
|
||||||
|
|
||||||
echo "Check for new content"
|
echo "Check for new content"
|
||||||
if [[ -f $hashfile ]]
|
|
||||||
then
|
|
||||||
currentHash=$( print-hash-from-file $filename )
|
currentHash=$( print-hash-from-file $filename )
|
||||||
|
if [[ $currentHash == $(cat $HASHFILEDIR/$hashfilename) ]]
|
||||||
|
then
|
||||||
|
echo "Nothing to do"
|
||||||
else
|
else
|
||||||
write-hashfile $filename $hashfilename
|
write-hashfile $currentHash $hashfilename
|
||||||
|
unzip-website-data $filename
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
echo "Executing Custom Scripts, if applicable"
|
echo "Executing Custom Scripts, if applicable"
|
||||||
execute-scripts-when-existing
|
execute-scripts-when-existing
|
||||||
echo "Building website"
|
echo "Building website"
|
||||||
build-and-extract-website
|
build-website
|
||||||
echo "Moving files"
|
echo "Moving files"
|
||||||
move-website-files-to-target
|
move-website-files-to-target
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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