diff options
author | Karel Kočí <karel.koci@nic.cz> | 2017-01-25 17:36:15 +0100 |
---|---|---|
committer | Karel Kočí <karel.koci@nic.cz> | 2017-01-25 17:36:15 +0100 |
commit | 1e506098990a0711e30537438a07abe15131942b (patch) | |
tree | bca459499b7be3b15a6def183ba761ff32a3017d | |
parent | fd736fa50b650853492373096c27be9aeb71a0cc (diff) | |
download | turris-myrepo-1e506098990a0711e30537438a07abe15131942b.tar.gz turris-myrepo-1e506098990a0711e30537438a07abe15131942b.tar.bz2 turris-myrepo-1e506098990a0711e30537438a07abe15131942b.zip |
Download sdk once a day
-rwxr-xr-x | build_repo.sh | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/build_repo.sh b/build_repo.sh index c3b0d1f..afff0dd 100755 --- a/build_repo.sh +++ b/build_repo.sh @@ -14,35 +14,43 @@ fi rm -rf .omnia-sdk rm -rf .turris-sdk +pull_sdk() { + # Update only once a day + if [ ! -e .$1-sdk-clean ] || [ $(expr $(date -u +%s) - $(stat -c %Y .$1-sdk-clean)) -gt 5184000 ]; then + rm -rf .$1-sdk-clean + echo -e "\e[1;34mGetting current SDK for $1\e[0m" + curl "$2" | tar -xjf - + mv OpenWrt-SDK-* .$1-sdk-clean + fi + # Copy clean sdk + rm -rf .$1-sdk + cp -a .$1-sdk-clean .$1-sdk +} + if [ "$BOARD" = "omnia" ] || [ "$BOARD" = "all" ]; then - echo -e "\e[1;34mGetting current SDK for omnia\e[0m" - curl "https://repo.turris.cz/omnia/OpenWrt-SDK-mvebu_gcc-4.8-linaro_musl-1.1.15_eabi.Linux-x86_64.tar.bz2" \ - | tar -xjf - - mv OpenWrt-SDK-mvebu_* .omnia-sdk + pull_sdk omnia "https://repo.turris.cz/omnia/OpenWrt-SDK-mvebu_gcc-4.8-linaro_musl-1.1.15_eabi.Linux-x86_64.tar.bz2" fi if [ "$BOARD" = "turris" ] || [ "$BOARD" = "all" ]; then - echo -e "\e[1;34mGetting current SDK for turris\e[0m" - wget "https://repo.turris.cz/turris/OpenWrt-SDK-mpc85xx-p2020-nand_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2" \ - | tar -xjf - - mv OpenWrt-SDK-mpc85xx* .turris-sdk -fi - -if [ -f CONFIG ]; then - echo -e "\e[1;34mApply CONFIG\e[0m" - ([ "$BOARD" = "omnia" ] || [ "$BOARD" = "all" ]) && \ - cat CONFIG >> .omnia-sdk/.config - ([ "$BOARD" = "turris" ] || [ "$BOARD" = "all" ]) && \ - cat CONFIG >> .turris-sdk/.config + pull_sdk turris "https://repo.turris.cz/turris/OpenWrt-SDK-mpc85xx-p2020-nand_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2" fi echo -e "\e[1;34mCopy packages\e[0m" for d in *; do [ -f $d/Makefile ] || continue + echo -e "\e[1;35mpackage: $d\e[0m" [ -d .omnia-sdk ] && cp -r $d .omnia-sdk/package/ [ -d .turris-sdk ] && cp -r $d .turris-sdk/package/ done +if [ -f CONFIG ]; then + echo -e "\e[1;34mApply CONFIG\e[0m" + ([ "$BOARD" = "omnia" ] || [ "$BOARD" = "all" ]) && \ + cat CONFIG >> .omnia-sdk/.config + ([ "$BOARD" = "turris" ] || [ "$BOARD" = "all" ]) && \ + cat CONFIG >> .turris-sdk/.config +fi + if [ "$BOARD" = "omnia" ] || [ "$BOARD" = "all" ]; then echo -e "\e[1;34mBuilding omnia\e[0m" (cd .omnia-sdk; make $@) |