summaryrefslogtreecommitdiff
path: root/scripts/update-and-validate.sh
blob: 99ba8208c997e162bca7273af9595e00085496b1 (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
#!/bin/sh
# Used on release-check.swamid.se

update()
{
#	echo "git pull"
	git pull -q || return $?

	/var/www/scripts/updateWebb.bash

	ls swamid-2.0/*.xml | sed 's@swamid-2.0/\(.*\).xml@.time/\1.validate@' > /tmp/$$.xml
	ls .time/*.validate > /tmp/$$.time
	comm -13 /tmp/$$.xml /tmp/$$.time | while read file; do
		docker exec swamid-metadata-sp /var/www/scripts/removeEntity.bash /opt/swamid-metadata/$file
	done
	rm /tmp/$$.xml /tmp/$$.time

	# remove some to get DB refreshed
	if [ $(find .time/ -ctime +15 | wc -l) -ne 0 ]; then
		rm `find .time/ -ctime +15 | tail -10`
	fi

	make -f Makefile.validate -s
}

cd /opt/swamid-metadata || exit 1
update