diff options
author | Karel Kočí <cynerd@email.cz> | 2018-08-29 19:49:30 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2018-08-29 19:49:30 +0200 |
commit | ab62d2c6a3b30410d5c1bda92e6bd43cebf8ba52 (patch) | |
tree | 2763cf89c01f1c221812b9d7b3c4a1361fc36644 /templates | |
parent | d96e29faa6ffa38c9576640cad1ca0f0ef645110 (diff) | |
download | laminar-cnf-ab62d2c6a3b30410d5c1bda92e6bd43cebf8ba52.tar.gz laminar-cnf-ab62d2c6a3b30410d5c1bda92e6bd43cebf8ba52.tar.bz2 laminar-cnf-ab62d2c6a3b30410d5c1bda92e6bd43cebf8ba52.zip |
turris4x: replace laminar locks with flock
Diffstat (limited to 'templates')
-rwxr-xr-x | templates/turris4x.run | 26 |
1 files changed, 14 insertions, 12 deletions
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 |