new way to generate

This commit is contained in:
Michael Jerger 2024-02-22 10:34:24 +01:00
parent 04377f0daf
commit f0ed84822b
2 changed files with 2 additions and 24 deletions

View file

@ -23,8 +23,6 @@ if [[ $currentHash == $newHash ]]
echo "Downloading website data" echo "Downloading website data"
get-website-data $filename get-website-data $filename
unzip-website-data $filename unzip-website-data $filename
echo "Executing Custom Scripts, if applicable"
execute-scripts-when-existing
echo "Building website" echo "Building website"
build-website build-website
echo "Moving files" echo "Moving files"

View file

@ -16,30 +16,10 @@ function unzip-website-data() {
unzip $SOURCEDIR/$1 -d $BUILDDIR unzip $SOURCEDIR/$1 -d $BUILDDIR
} }
function execute-scripts-when-existing() {
websitedir=$(ls $BUILDDIR)
if [[ -f $BUILDDIR/$websitedir/$SCRIPTFILE ]]
then
checksum="$(sha256sum $BUILDDIR/$websitedir/$SCRIPTFILE | grep -oE "^[a-z0-9]+")"
if [[ "$SHA256SUM" == "$checksum" ]]
then
chmod +x $BUILDDIR/$websitedir/$SCRIPTFILE
(cd $BUILDDIR; dir=$(ls); cd $dir; ./$SCRIPTFILE) #make sure paths defined in scriptfile are relative to $dir
else
printf "Provided SHA256 Sum does not match calculated sum. Exiting."
printf "Calculated SHA256: $checksum"
printf "Given SHA256: $SHA256SUM"
exit 1
fi
else
printf "No script file provided."
fi
}
function build-website() { function build-website() {
(cd $BUILDDIR; dir=$(ls); cd $dir; lein run;) (cd $BUILDDIR; dir=$(ls); cd $dir; ./generate.sh;)
} }
function move-website-files-to-target() { function move-website-files-to-target() {
(cd $BUILDDIR; dir=$(ls); cd $dir; rsync -ru --exclude-from "/etc/exclude.pattern" --delete resources/public/* $WEBSITEROOT;) (cd $BUILDDIR; dir=$(ls); cd $dir; rsync -ru --exclude-from "/etc/exclude.pattern" --delete target/html/* $WEBSITEROOT;)
} }