summaryrefslogtreecommitdiffstats
path: root/bin/reproducible_html_rsync_remote_results.sh
blob: f19b92cd8c2cc4657f48331f9d0bb3839f39df89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash

# Copyright 2015 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2

DEBUG=false
. /srv/jenkins/bin/common-functions.sh
common_init "$@"

# common code defining db access
. /srv/jenkins/bin/reproducible_common.sh

# that's all
rsync_remote_results() {
	for PROJECT in coreboot lede openwrt netbsd ; do
		echo "$(date -u) - Starting to rsync results for '$PROJECT'."
		local RESULTS=$(mktemp --tmpdir=$TEMPDIR -d reproducible-rsync-XXXXXXXXX)
		# copy the new results from build node to webserver node
		rsync -r -v -e "ssh -o 'Batchmode = yes'" profitbricks-build3-amd64.debian.net:$BASE/$PROJECT/ $RESULTS
		chmod 775 $RESULTS
		# move old results out of the way
		if [ -d $BASE/$PROJECT ] ; then
			mv $BASE/$PROJECT ${RESULTS}.tmp
			# preserve images and css
			for OBJECT in $(find ${RESULTS}.tmp -name "*css" -o -name "*png" -o -name "*jpg") ; do
				cp -v $OBJECT $RESULTS/
			done
			# delete the old results
			rm ${RESULTS}.tmp -r
		fi
		# make the new results visible
		mv $RESULTS $BASE/$PROJECT
		echo "$(date -u) - $REPRODUCIBLE_URL/$PROJECT has been updated."
	done
}

# main
echo "$(date -u) - Starting to rsync results."
rsync_remote_results
echo "$(date -u) - the end."