Added administration scripts

This commit is contained in:
Kevin Veen-Birkenbach 2020-05-06 13:55:34 +02:00
parent 7f9f331de1
commit fa7758acf0
4 changed files with 90 additions and 0 deletions

6
.travis.yml Normal file
View File

@ -0,0 +1,6 @@
language: C++
git:
submodules: false
script:
- shellcheck ./administration/*.sh

28
scripts/board-update.sh Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
#
# This script updates or creates the support for the ESP8266 board
# @author Kevin Veen-Birkenbach [kevin@veen.world]
# @see https://arduino-esp8266.readthedocs.io/en/latest/installing.html#using-git-version
# set variables
ARDUINO_HARDWARE_PATH="$HOME/Arduino/hardware";
ESP8266_PATH="$ARDUINO_HARDWARE_PATH/esp8266com";
if [ -d "$ESP8266_PATH" ]
then
echo "Updates esp8266com..."
cd "$ESP8266_PATH/esp8266" || exit 1
git status
git pull
else
echo "Creates support for ESP8266..."
mkdir -p "$ESP8266_PATH" && echo "Arduino hardware folder created" && cd "$ESP8266_PATH" || exit 2;
git clone https://github.com/esp8266/Arduino.git esp8266
echo "Initialize the submodules..."
cd esp8266 || exit 3
git submodule update --init
cd tools || exit 4
python3 get.py
echo "esp8266com path looks now the follow:"
tree -dL 2 "$ESP8266_PATH"
fi
echo "Finished."

16
scripts/compile.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# @author Kevin Veen-Birkenbach [kevin@veen.world]
# This script compiles the program
# set variables
ARDUINO_PATH="$HOME/.local/share/umake/ide/arduino/arduino";
# test preconditions
if [ ! -f "$ARDUINO_PATH" ]
then
echo "This program expects to find the Arduino IDE in $ARDUINO_PATH, but the file doesn't exist."
echo "Feel free to optimize this script or install Arduino how described under the following url:"
echo "https://askubuntu.com/questions/1025753/how-to-install-latest-arduino-ide"
exit 1;
fi
bash "$ARDUINO_PATH" --upload ../main/main.ino

40
scripts/library-update.sh Normal file
View File

@ -0,0 +1,40 @@
#!/bin/bash
#
# This script updates the dependencies
# @author Kevin Veen-Birkenbach [kevin@veen.world]
# set variables
ARDUINO_LIBRARIES_PATH="$HOME/Arduino/libraries";
# test preconditions
if [ ! -d "$ARDUINO_LIBRARIES_PATH" ]
then
echo "This program expects to find the Arduino libraries in $ARDUINO_LIBRARIES_PATH, but the directory doesn't exist."
echo "Feel free to optimize this script for your individual purpose."
exit 1;
fi
# Pulls or clones a repository
# @param $1 Folder name
# @param $2 Git repository
pullOrClone(){
local FOLDER_PATH="$ARDUINO_LIBRARIES_PATH/$1";
echo "Trying to update $FOLDER_PATH..."
if [ -d "$FOLDER_PATH" ]
then
cd "$FOLDER_PATH" || exit 1;
if [ -d ".git" ]
then
git pull;
else
echo "Update not possible, because library hadn't been installed via git."
fi
else
cd "$ARDUINO_LIBRARIES_PATH" && git clone "$2";
fi
}
(
pullOrClone "Adafruit_Sensor" "https://github.com/adafruit/Adafruit_Sensor";
pullOrClone "DHT-sensor-library" "https://github.com/adafruit/DHT-sensor-library";
pullOrClone "NewRemoteSwitch" "https://github.com/1technophile/NewRemoteSwitch";
)