#!/bin/sh # vim: ft=sh set -e GWORKSPACE=~/workspace/turris4x . utils MAKE="make -j4 IS_TTY=1 BUILD_LOG=1" echo_stage "Get packages" git_clone "git@cynerd.cz:openwrt-personal-pkgs" pkgs curl "https://repo.turris.cz/$BOARD-$BRANCH/git-hash" > git-hash laminar_self_lock sdk if [ -f "$WORKSPACE/openwrt-git-hash" ] && cmp -s git-hash "$WORKSPACE/openwrt-git-hash"; then echo_info "Using previous version of SDK" cp -a "$WORKSPACE/sdk" openwrt cd openwrt else echo_info "Building new version of SDK" echo_stage "Get turris-build" HASH="$(awk '/ \* turris-build\: /{print $3}' git-hash)" git_clone "https://gitlab.labs.nic.cz/turris/turris-build.git" turris-build "$HASH" echo_stage "Prepare SDK" mkdir openwrt cd openwrt echo ../turris-build/compile_fw -t $BOARD -p $BRANCH repo_prepare GIT_MIRROR="$GWORKSPACE/mirror" \ CCACHE_HOST_DIR="$GWORKSPACE/ccache-host" \ CCACHE_TARGET_DIR="$WORKSPACE/ccache-target" \ ../turris-build/compile_fw -t $BOARD -p $BRANCH repo_prepare echo_stage "Compile tools" $MAKE toolchain/compile package/usign/host/compile rm -rf build_dir echo_stage "Store SDK in workspace" cd .. rm -rf "$WORKSPACE/sdk" cp -a openwrt "$WORKSPACE/sdk" cp git-hash "$WORKSPACE/git-hash" cd openwrt fi laminar_self_release sdk echo_stage "Add our repository as feed" echo "src-git personal file://$WORKSPACE/pkgs" >> feeds.conf ./scripts/feeds update personal ./scripts/feeds install -p personal -d y -f -a echo_stage "Compile packages from our feed" $MAKE $(./scripts/feeds list -r personal | sed -n 's/^\([^ ]*\).*$/package\/\1\/compile/p' | tr '\n' ' ') echo_stage "Generate index and sign" $MAKE package/index BUILD_KEY=~/openwrt-repo.key echo_stage "Deploy" ssh upload rm -rf "deploy-turris4x-$BOARD" scp -r "bin/packages/$ARCH/personal" upload:deploy-turris4x-$BOARD ssh upload /bin/sh -e <