#!/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