12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #!/bin/bash
- function print_centered {
- [[ $# == 0 ]] && return 1
- declare -i TERM_COLS="$(tput cols)"
- declare -i str_len="${#1}"
- [[ $str_len -ge $TERM_COLS ]] && {
- echo "$1";
- return 0;
- }
- declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
- [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
- filler=""
- for (( i = 0; i < filler_len; i++ )); do
- filler="${filler}${ch}"
- done
- printf "%s%s%s" "$filler" "$1" "$filler"
- [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
- printf "\n"
- return 0
- }
- print_centered "$(tput setaf 10)"
- print_centered ""
- print_centered " ---- "
- print_centered "-| |-"
- print_centered "-| |-"
- print_centered "-| |-"
- print_centered "-| |-"
- print_centered " ---- "
- print_centered "ChipTools v1.0"
- echo -n "$(tput setaf 7)"
- sudo apt install libudev-dev curl libelf-dev libusb-1.0-0-dev libusb-dev libftdi-dev libftdi1-dev libhidapi-dev build-essential -y
- sudo apt install python3-pip python3-sphinx -y
- curl http://wareck.free.fr/cross_compilation/avr_toolchain/avr_toolchain.tar.xz | tar -xJ
- sudo cp -r avr /usr/local
- rm -r -f avr
- cd ~
- wget -c https://github.com/flashrom/flashrom/archive/refs/tags/v1.3.0.tar.gz
- tar xvfz v1.3.0.tar.gz
- rm v1.3.0.tar.gz
- cd flashrom-1.3.0
- make
- sudo make install
- cd ~
- rm -r -f flashrom-1.3.0
- if ! grep "/usr/local/avr/bin" ~/.bashrc >/dev/null
- then
- echo "export PATH=XXXXPATH::/usr/local/avr/bin" >> ~/.bashrc
- sed -i -e "s/XXXX/$/g" ~/.bashrc
- source ~/.bashrc
- fi
- echo -e "\nDone."
|