From e21f6540bf63df98d9ce204bc97f4f5931fab8ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sun, 26 Aug 2018 19:08:25 +0200 Subject: turris3x: Download SDK only once a day --- templates/turris3x.run | 12 ++++++++---- 1 file 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" -- cgit v1.2.3