diff options
-rwxr-xr-x | templates/turris3x.run | 12 |
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" |