summaryrefslogtreecommitdiff
path: root/templates/turris.run
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2019-02-09 17:34:28 +0100
committerKarel Kočí <cynerd@email.cz>2019-02-09 17:34:28 +0100
commit4ddd4057e2ab91e30f61cfa757605bfd0cca4d89 (patch)
tree7731d687a58775fa7e893786800364aa7780e765 /templates/turris.run
parent8cb01673521acceb006e7113e8986d4d677422f1 (diff)
downloadlaminar-cnf-4ddd4057e2ab91e30f61cfa757605bfd0cca4d89.tar.gz
laminar-cnf-4ddd4057e2ab91e30f61cfa757605bfd0cca4d89.tar.bz2
laminar-cnf-4ddd4057e2ab91e30f61cfa757605bfd0cca4d89.zip
turris: change how we do Turris 4.x
Diffstat (limited to 'templates/turris.run')
-rwxr-xr-xtemplates/turris.run62
1 files changed, 62 insertions, 0 deletions
diff --git a/templates/turris.run b/templates/turris.run
new file mode 100755
index 0000000..5f4aeb3
--- /dev/null
+++ b/templates/turris.run
@@ -0,0 +1,62 @@
+#!/bin/sh
+# vim: ft=sh
+. "$(dirname "$(readlink -f "$0")")/../job.common"
+
+if [ "$V" -ge 1 ]; then
+ make="make -j1 IS_TTY=1 BUILD_LOG=1 V=99"
+else
+ make="make -j4 IS_TTY=1 BUILD_LOG=1"
+fi
+
+curl "https://repo.turris.cz/$ANIMAL/packages/$BOARD/git-hash" > git-hash
+cat git-hash
+# TODO take lock so we won't run multiple instances of new builds
+if [ -z "$CLEAN" ] && [ -f "$WORKSPACE/openwrt-git-hash" ] && cmp -s git-hash "$WORKSPACE/openwrt-git-hash"; then
+ echo_info "Using previous version of SDK"
+ tar -xzf "$WORKSPACE/openwrt.tar.gz"
+else
+ echo_info "Building new version of SDK"
+ echo_stage "Get turris-build"
+ TB_HASH="$(awk '/ \* turris-build\: /{print $3}' git-hash)"
+ git_fetch_t "https://gitlab.labs.nic.cz/turris/turris-build.git" turris-build "$TB_HASH"
+
+ echo_stage "Prepare SDK"
+ mkdir openwrt
+ (
+ cd openwrt
+ cat > .turris-build.conf <<EOF
+GIT_MIRROR="$TWORKSPACE/openwrt-git-mirror"
+DL_MIRROR="$TWORKSPACE/openwrt-dl-mirror"
+CCACHE_HOST_DIR="$TWORKSPACE/ccache-host"
+CCACHE_TARGET_DIR="$WORKSPACE/ccache-target"
+EOF
+ ../turris-build/compile_pkgs -e -t "$BOARD" -p "$ANIMAL" repo_prepare autopkg
+ $make toolchain/compile target/compile package/usign/host/compile
+ )
+ tar -czf openwrt.tar.gz openwrt
+ mv openwrt.tar.gz "$WORKSPACE/openwrt.tar.gz"
+ mv git-hash "$WORKSPACE/openwrt-git-hash"
+fi
+cd openwrt
+
+echo_stage "Get personal repository feed"
+echo "src-git personal git@cynerd.cz:openwrt-personal-pkgs" >> feeds.conf
+./scripts/feeds update personal
+./scripts/feeds list -r personal | awk '{print $1}' | xargs ./scripts/feeds uninstall # Remove any package provided by personal feed
+./scripts/feeds install -p personal -d y -f -a
+
+echo_stage "Compile packages from personal feed"
+find package/feeds/personal -mindepth 1 -maxdepth 1 -printf 'package/%P/compile\0' | \
+ xargs --null $make
+
+echo_stage "Generate index and sign"
+$make package/index BUILD_KEY=~/openwrt-repo.key
+
+echo_stage "Deploy"
+ssh upload rm -rf "deploy-turris-$ANIMAL-$BOARD"
+scp -r "bin/packages/$ARCH/personal" upload:deploy-turris-$BOARD
+ssh upload /bin/sh -e <<EOF
+ mkdir -p "/var/www/repo/turris/$ANIMAL"
+ rm -rf "/var/www/repo/turris/$ANIMAL/$BOARD"
+ mv deploy-turris-$ANIMAL-$BOARD "/var/www/repo/turris/$ANIMAL/$BOARD"
+EOF