summaryrefslogtreecommitdiff
path: root/scripts/build_tools.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build_tools.sh')
-rwxr-xr-xscripts/build_tools.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/scripts/build_tools.sh b/scripts/build_tools.sh
new file mode 100755
index 0000000..2adb27b
--- /dev/null
+++ b/scripts/build_tools.sh
@@ -0,0 +1,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/master; 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