summaryrefslogtreecommitdiff
path: root/scripts/build_tools.sh
blob: b161f878b03dd755781e5113aec0e6d0102a8291 (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
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
# This tool pulls down and builds updater-ng and usign
# It expects to be executed in root directory of this project
set -e

git_pull() {
	if [ ! -d $1 ]; then
		git clone $2 $1
		pushd $1 >/dev/null
		git submodule update --init --recursive
		popd >/dev/null
	else
		pushd $1 >/dev/null
		git fetch
		if ! git diff --quiet HEAD origin/HEAD; then
			git clean -Xdf
			git reset --hard origin/master
			git submodule update --init --recursive
		fi
		popd >/dev/null
	fi
}

wget_pull() {
	if [ ! -e $1 ] || [ $(expr $(date -u +%s) - $(stat -c %Z $1)) -gt 86400 ]; then
		wget $2 -O $1
	fi
}

## Usign ##
git_pull .usign git://git.openwrt.org/project/usign.git

if [ ! -x .usign/usign ]; then
	pushd .usign >/dev/null
	cmake .
	make
	popd >/dev/null
fi

## Updater-ng ##
git_pull .updater https://kkoci@gitlab.labs.nic.cz/turris/updater.git

if [ ! -x .updater/bin/pkgupdate ]; then
	make -C .updater NO_DOC=1 LUA_COMPILE:=no
fi

## get-api-crl ##
wget_pull .get-api-crl https://gitlab.labs.nic.cz/turris/misc/raw/master/cacerts/get-api-crl

## Get certificates ##
for K in release standby test; do
	wget_pull .$K.pub https://gitlab.labs.nic.cz/turris/turris-os-packages/raw/test/cznic/cznic-repo-keys/files/$K.pub
done