summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-08-29 23:39:01 +0200
committerKarel Kočí <cynerd@email.cz>2018-08-29 23:40:54 +0200
commit341f4cdf09db9d770081d3de23efa8b45ace183f (patch)
treea955a682850b4b0292ad2415c27c3cbff320b0d1 /templates
parent7208d41e0b7887aa93719d57b675417758ea7592 (diff)
downloadlaminar-cnf-341f4cdf09db9d770081d3de23efa8b45ace183f.tar.gz
laminar-cnf-341f4cdf09db9d770081d3de23efa8b45ace183f.tar.bz2
laminar-cnf-341f4cdf09db9d770081d3de23efa8b45ace183f.zip
turris4x: fix flock usage
Diffstat (limited to 'templates')
-rwxr-xr-xtemplates/turris4x.run51
1 files changed, 21 insertions, 30 deletions
diff --git a/templates/turris4x.run b/templates/turris4x.run
index f303e78..0a73d3c 100755
--- a/templates/turris4x.run
+++ b/templates/turris4x.run
@@ -5,42 +5,33 @@ set -e
MAKE="make -j4 IS_TTY=1 BUILD_LOG=1"
-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"
-
- echo_stage "Prepare SDK"
- mkdir openwrt
- cd openwrt
- GIT_MIRROR="$TWORKSPACE/openwrt-git-mirror" \
- CCACHE_HOST_DIR="$TWORKSPACE/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/openwrt-sdk"
- cp -a openwrt "$WORKSPACE/openwrt-sdk"
- cp git-hash "$WORKSPACE/openwrt-git-hash"
-}
-
-copy_sdk() {
- cp -a "$WORKSPACE/openwrt-sdk" openwrt
-}
-
curl "https://repo.turris.cz/$BOARD-$BRANCH/git-hash" > git-hash
cat 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
+ flock --shared "$WORKSPACE/openwrt-sdk.lock" \
+ cp -a "$WORKSPACE/openwrt-sdk" openwrt
else
echo_info "Building new version of SDK"
- flock --exclusive "$WORKSPACE/openwrt-sdk.lock" -c build_sdk
+ echo_stage "Get turris-build"
+ git_fetch_t "https://gitlab.labs.nic.cz/turris/turris-build.git" turris-build "$TB_HASH"
+
+ echo_stage "Prepare SDK"
+ TB_HASH="$(awk '/ \* turris-build\: /{print $3}' git-hash)"
+ mkdir openwrt
+ flock --exclusive "$WORKSPACE/openwrt-sdk.lock" /bin/sh -s <<EOF
+ cd openwrt
+ GIT_MIRROR="$TWORKSPACE/openwrt-git-mirror" \
+ CCACHE_HOST_DIR="$TWORKSPACE/ccache-host" \
+ CCACHE_TARGET_DIR="$WORKSPACE/ccache-target" \
+ ../turris-build/compile_fw -t $BOARD -p $BRANCH repo_prepare
+ $MAKE toolchain/compile package/usign/host/compile
+ rm -rf build_dir
+ cd ..
+ rm -rf "$WORKSPACE/openwrt-sdk"
+ cp -a openwrt "$WORKSPACE/openwrt-sdk"
+ cp git-hash "$WORKSPACE/openwrt-git-hash"
+EOF
fi
cd openwrt