SKIP-CI // Started with hash check

merge-requests/4/head
Clemens 1 year ago
parent a844a9e947
commit 37170ee982

@ -6,5 +6,6 @@ ADD resources /tmp
ENV SOURCEDIR="/etc/websitesource"
ENV BUILDDIR="/etc/website"
ENV WEBSITEROOT="/var/www/html/website/"
ENV HASHFILEDIR="/data/hasfiles/"
RUN /tmp/install.sh

@ -2,6 +2,7 @@
mkdir $BUILDDIR
mkdir $SOURCEDIR
mkdir -p $HASHFILEDIR
set -o nounset
set -o xtrace
@ -29,12 +30,11 @@ hashfilename="hashfile"
# start the build
echo "Downloading website data"
get-website-data filename
get-website-data $filename
echo "Check for new content"
if [[ -f $hashfile ]]
then
currentHash=$( sha256sum $SOURCEDIR/$filename | cut -d " " -f 1 > ~/$2 ) #ToDo: output of sh256sum without path to file?
currentHash=$(print-hash-from-file $filename )
else
write-hashfile $filename $hashfilename

@ -1,11 +1,15 @@
#!/bin/bash
function get-website-data() {
curl -H "Authorization: token $AUTHTOKEN" -o $SOURCEDIR/$filename $GITREPOURL
curl -H "Authorization: token $AUTHTOKEN" -o $SOURCEDIR/$1 $GITREPOURL
}
function write-hashfile() {
(cd $SOURCEDIR; sha256sum $1 | cut -d " " -f 1 > ~/$2;)
(cd $SOURCEDIR; sha256sum $1 | cut -d " " -f 1 > $HASHFILEDIR/$2;)
}
function print-hash-from-file() {
(cd $SOURCEDIR; sha256sum $1 | cut -d " " -f 1;)
}
function compare-website-data() {
@ -14,7 +18,7 @@ function compare-website-data() {
}
function unzip-website-data() {
unzip $SOURCEDIR/$filename -d $BUILDDIR
unzip $SOURCEDIR/$1 -d $BUILDDIR
}
function execute-scripts-when-existing {

Loading…
Cancel
Save