summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-08-26 19:08:25 +0200
committerKarel Kočí <cynerd@email.cz>2018-08-26 19:08:25 +0200
commite21f6540bf63df98d9ce204bc97f4f5931fab8ec (patch)
tree1018b85ea3cfc272efdd9fa7153b550159388dd9 /templates
parent4931a5fcda484db34a65d0f4cd41d55f68709472 (diff)
downloadlaminar-cnf-e21f6540bf63df98d9ce204bc97f4f5931fab8ec.tar.gz
laminar-cnf-e21f6540bf63df98d9ce204bc97f4f5931fab8ec.tar.bz2
laminar-cnf-e21f6540bf63df98d9ce204bc97f4f5931fab8ec.zip
turris3x: Download SDK only once a day
Diffstat (limited to 'templates')
-rwxr-xr-xtemplates/turris3x.run12
1 files changed, 8 insertions, 4 deletions
diff --git a/templates/turris3x.run b/templates/turris3x.run
index 982b1e6..668419b 100755
--- a/templates/turris3x.run
+++ b/templates/turris3x.run
@@ -6,10 +6,14 @@ set -e
echo_stage "Get packages"
git_fetch "https://git.cynerd.cz/openwrt-personal-pkgs" pkgs turris3x
-# TODO download only once a day
-echo_stage "Download SDK"
-curl "$SDK_URI" > sdk.tar.bz2
-mv sdk.tar.bz2 "$WORKSPACE/sdk.tar.bz2"
+SDK="$WORKSPACE/sdk.tar.bz2"
+if [ ! -e "$SDK" ] || [ $(expr $(date -u +%s) - $(stat -c %Z "$SDK")) -gt 86400 ]; then
+ echo_stage "Download SDK"
+ curl "$SDK_URI" > sdk.tar.bz2
+ mv sdk.tar.bz2 "$SDK"
+else
+ echo_stage "Skipping download"
+fi
echo_stage "Export SDK"
tar -xjf "$WORKSPACE/sdk.tar.bz2"