From ab62d2c6a3b30410d5c1bda92e6bd43cebf8ba52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 29 Aug 2018 19:49:30 +0200 Subject: turris4x: replace laminar locks with flock --- templates/turris4x.run | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'templates/turris4x.run') diff --git a/templates/turris4x.run b/templates/turris4x.run index 9321d90..97aa745 100755 --- a/templates/turris4x.run +++ b/templates/turris4x.run @@ -5,16 +5,7 @@ set -e MAKE="make -j4 IS_TTY=1 BUILD_LOG=1" -laminar_self_lock sdk -curl "https://repo.turris.cz/$BOARD-$BRANCH/git-hash" > git-hash -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/openwrt-sdk" openwrt - cd openwrt - -else - echo_info "Building new version of SDK" - +build_sdk() { echo_stage "Get turris-build" HASH="$(awk '/ \* turris-build\: /{print $3}' git-hash)" git_fetch_t "https://gitlab.labs.nic.cz/turris/turris-build.git" turris-build "$HASH" @@ -36,10 +27,21 @@ else rm -rf "$WORKSPACE/openwrt-sdk" cp -a openwrt "$WORKSPACE/openwrt-sdk" cp git-hash "$WORKSPACE/openwrt-git-hash" - cd openwrt +} + +copy_sdk() { + cp -a "$WORKSPACE/openwrt-sdk" openwrt +} +curl "https://repo.turris.cz/$BOARD-$BRANCH/git-hash" > git-hash +if [ -f "$WORKSPACE/openwrt-git-hash" ] && cmp -s git-hash "$WORKSPACE/openwrt-git-hash"; then + echo_info "Using previous version of SDK" + flock --shared "$WORKSPACE/openwrt-sdk.lock" -c copy_sdk +else + echo_info "Building new version of SDK" + flock --exclusive "$WORKSPACE/openwrt-sdk.lock" -c build_sdk fi -laminar_self_release sdk +cd openwrt echo_stage "Add our repository as feed" echo "src-git personal git@cynerd.cz:openwrt-personal-pkgs" >> feeds.conf -- cgit v1.2.3