1234567891011121314151617181920212223242526272829 |
- #!/bin/bash
- cwd=$(pwd)
- archi=$(uname -m | awk {'print$1'} | head -c3)
- echo -e "AVR Toolchain packer v1.0"
- if (( $EUID != 0 )); then
- echo -e "$(tput setaf 11)This must be run as root. Try 'sudo bash $0'.$(tput setaf 7)\n"
- exit 1
- fi
- if ! [ -x "$(command -v pv)" ]
- then
- sudo apt-get install pv -y
- fi
- if ! [ -x "$(command -v pixz)" ]
- then
- sudo apt-get install pixz -y
- fi
- echo "Compressing:"
- cp -r -f /usr/local/avr .
- SIZE=`du -sk avr | cut -f 1`
- if [ $archi = "arm" ]
- then
- tar cf - avr | pv -p -s ${SIZE}k | pixz > avr_toolchain_arm.tar.xz
- sudo chown pi avr_toolchain_arm.tar.xz
- else
- tar cf - avr | pv -p -s ${SIZE}k | pixz > avr_toolchain.tar.xz
- fi
- rm -r -f avr
- echo -e "\nDone."
|