release_package.sh 684 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. cwd=$(pwd)
  3. archi=$(uname -m | awk {'print$1'} | head -c3)
  4. echo -e "AVR Toolchain packer v1.0"
  5. if (( $EUID != 0 )); then
  6. echo -e "$(tput setaf 11)This must be run as root. Try 'sudo bash $0'.$(tput setaf 7)\n"
  7. exit 1
  8. fi
  9. if ! [ -x "$(command -v pv)" ]
  10. then
  11. sudo apt-get install pv -y
  12. fi
  13. if ! [ -x "$(command -v pixz)" ]
  14. then
  15. sudo apt-get install pixz -y
  16. fi
  17. echo "Compressing:"
  18. cp -r -f /usr/local/avr .
  19. SIZE=`du -sk avr | cut -f 1`
  20. if [ $archi = "arm" ]
  21. then
  22. tar cf - avr | pv -p -s ${SIZE}k | pixz > avr_toolchain_arm.tar.xz
  23. sudo chown pi avr_toolchain_arm.tar.xz
  24. else
  25. tar cf - avr | pv -p -s ${SIZE}k | pixz > avr_toolchain.tar.xz
  26. fi
  27. rm -r -f avr
  28. echo -e "\nDone."