Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # This script will install ARDUINO
- ### ###
- # Install Arduino IDE #
- #####################################################################################
- function fun_install()
- {
- #Variables
- download="$1"
- directory="$2"
- mkdir $directory/Arduino
- cd $directory/Arduino
- wget https://downloads.arduino.cc/arduino-${download}.tar.xz
- tar xvJf arduino-${download}.tar.xz
- cd arduino*/
- ./install.sh
- rm ../arduino-${download}.tar.xz
- exit
- }
- ### ###
- # Arduino IDE version #
- #####################################################################################
- function fun_version()
- {
- correct_platform=0
- plataform
- while [ $correct_platform -eq 0 ];
- do
- clear
- cat << HELP_ARDUINO_VERSION
- #####################################################################################
- What version would you like to install? First select the platform, then the version.
- Example:
- $ Which plataform are you using? [1] 32 [2] 64 [3] ARM
- ~ 1
- $ Introduce the version number X.X.X or 0 for nightly
- ~ 1.8.0
- #####################################################################################
- HELP_ARDUINO_VERSION
- cat << ARDUINO_PLATFORM
- 1/2##################################################################################
- Which plataform are you using?
- [1] ARM
- [2] 32
- [3] 64
- ##################################################################################1/2
- ARDUINO_PLATFORM
- read platformid
- case $platformid in
- 1 ) platform=arm
- correct_platform=1
- ;;
- 2 ) arduino=32
- correct_platform=1
- ;;
- 3 ) arduino=64
- correct_platform=1
- ;;
- * ) echo "Please, select a valid platform"
- exit
- esac
- cat << ARDUINO_VERSION
- 2/2##################################################################################
- Introduce the version number X.X.X or 0 for nightly
- ##################################################################################2/2
- ARDUINO_VERSION
- read version
- version_string="${version}-linux${platform}"
- done
- export "$version_string"
- }
- ### ###
- # Arduino IDE directory #
- #####################################################################################
- function fun_directory()
- {
- clear
- echo "#####################################################################################"
- echo "Select directory to install arduino"
- echo "#####################################################################################"
- read directory
- export "$directory"
- }
- ### ###
- # Display usage #
- #####################################################################################
- function fun_usage () {
- clear
- cat << HELP_USAGE
- START################################################################################
- # Program writed for 85 characters lenght #
- #####################################################################################
- # Usage: $0 [-v platform version] [-d directory] [-c platform version directory] #
- # #
- # -v : If you know what version you want to install EX i.sh -v arm 1.8.2 #
- # -d : If you know where to install EX i.sh -d . #
- # -c : If you know version and where EX i.sh -c arm 1.8.2 . #
- # #
- # If no parameter is chosen, the program will ask for them. #
- # #
- # Currently only -c is working, I will try to fix it for Thuersday #
- # (V)(;,,;)(V) #
- ##################################################################################END
- HELP_USAGE
- exit
- }
- ### ###
- # MAIN #
- #####################################################################################
- #Variables
- arduino=0
- platform=""
- version=""
- director=""
- download=""
- if [ -n $1 ]
- then
- case $1 in
- -v ) arduino=1
- shift
- platform="$1"
- shift
- version="$1"
- download="${version}\-linux${platform}"
- ;;
- -w ) arduino=2
- shift
- directory="$1"
- ;;
- -c ) arduino=3
- shift
- platform="$1"
- shift
- version="$1"
- shift
- directory="$1"
- download="${version}\-linux${platform}"
- ;;
- * ) ;;
- esac
- fi
- if [ $arduino != 3 ]
- then
- case arduino in
- 0 ) download=$(fun_version)
- directory=$(fun_directory)
- ;;
- 1 ) directory="$(fun_directory)"
- ;;
- 2 ) download="$(fun_version)"
- ;;
- esac
- fi
- fun_install $download $directory
- exit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement