Votre Nom 2 years ago
parent
commit
b5727da998
1 changed files with 38 additions and 0 deletions
  1. 38 0
      options/avrtools.sh

+ 38 - 0
options/avrtools.sh

@@ -1,4 +1,42 @@
 #!/bin/bash
 #!/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 libelf-dev libusb-1.0-0-dev libusb-dev libftdi-dev libftdi1-dev libhidapi-dev -y
 sudo apt install libelf-dev libusb-1.0-0-dev libusb-dev libftdi-dev libftdi1-dev libhidapi-dev -y
 curl http://wareck.free.fr/cross_compilation/avr_toolchain/avr_toolchain.tar.xz | tar -xJ
 curl http://wareck.free.fr/cross_compilation/avr_toolchain/avr_toolchain.tar.xz | tar -xJ
 sudo cp -r avr /usr/local
 sudo cp -r avr /usr/local