Commit 6e4b872f authored by Konrad Grochowski's avatar Konrad Grochowski

Addons: CheckTargetFolder extracted to common.sh

parent e817b7fb
#!/bin/bash
function InstallBSP() {
DESCRIPTION="$1"
URL="$2"
BASE="$3"
FOLDER="${BASE}/$4"
echo '[-] This will install '"${DESCRIPTION}"','
echo '[-] under:'
echo '[-] '
echo '[-] '"${FOLDER}"
echo '[-] '
[ -e "${FOLDER}" ] && { \
echo '[-] It will remove anything that is currently there.'
echo '[-] '
}
echo -n '[-] Are you sure you want this? (y/n) '
function CheckTargetFolder() {
local DESCRIPTION="$1"
local FOLDER="$2"
echo "[-]"
echo "[-] This script will install ${DESCRIPTION}"
echo "[-] under:"
echo "[-]"
echo "[-] ${FOLDER}"
echo "[-]"
if [ -e "${FOLDER}" ] ; then
echo "[-] WARNING: It will remove everything that is currently there."
echo "[-]"
fi
echo -n "[-] Are you sure you want this? (y/n)"
read -r ANS
if [ "$ANS" != "y" ] ; then
echo '[-] Response was not "y", aborting...'
exit 1
fi
sudo rm -rf "${FOLDER}" 2>/dev/null
}
function InstallBSP() {
local DESCRIPTION="$1"
local URL="$2"
local BASE="$3"
local FOLDER="${BASE}/$4"
CheckTargetFolder "$DESCRIPTION" "$FOLDER"
wget -q --show-progress -O - "${URL}" | \
( cd "${BASE}" || exit 1 ; sudo tar jxvf - )
}
......
......@@ -2,23 +2,13 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "${DIR}/common.sh"
FREERTOS_VERSION="10.2.1"
DESCRIPTION="FreeRTOS"
FREERTOS_VERSION="10.2.1"
PREFIX="/opt"
INSTALL_PATH="$PREFIX/FreeRTOSv$FREERTOS_VERSION"
ZIP_FILE="FreeRTOS.zip"
echo "[-] Checking if FreeRTOS is already under ${INSTALL_PATH}..."
echo "[-]"
if [ -e "$INSTALL_PATH" ] ; then
echo '[-] ${INSTALL_PATH} is there already. Aborting...'
exit 1
fi
echo "[-] No FreeRTOS present - installing."
CheckTargetFolder "${DESCRIPTION}" "${INSTALL_PATH}"
DownloadToTemp "${DESCRIPTION}" "https://sourceforge.net/projects/freertos/files/FreeRTOS/V${FREERTOS_VERSION}/FreeRTOSv${FREERTOS_VERSION}.zip/download"
......
......@@ -2,15 +2,15 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "${DIR}/common.sh"
echo "[-] Checking if Gaisler's RTEMS 4.10 is already under /opt/rtems-4.10..."
if [ -e /opt/rtems-4.10 ] ; then
echo '[-] /opt/rtems-4.10 is there already. Aborting...'
exit 1
fi
DESCRIPTION="Gaisler's RTEMS 4.10"
PREFIX="/opt"
INSTALL_PATH="$PREFIX/rtems-4.10"
CheckTargetFolder "${DESCRIPTION}" "${INSTALL_PATH}"
echo "[-] Downloading and uncompressing Gaisler's RTEMS 4.10..."
echo "[-]"
cd /opt || exit 1
cd "${PREFIX}" || exit 1
wget -q -O - http://www.gaisler.com/j25/anonftp/rcc/bin/linux/sparc-rtems-4.10-gcc-4.4.6-1.2.21-linux.tar.bz2 | sudo tar jxvf -
if [ $? -ne 0 ] ; then
echo "Downloading Gaisler's RTEMS 4.10 toolchain has failed."
......
......@@ -2,11 +2,11 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "${DIR}/common.sh"
echo "[-] Checking if Gaisler's RCC1.3-rc5 is already under /opt/..."
if [ -e /opt/rcc-1.3-rc5-gcc ] ; then
echo '[-] /opt/rcc-1.3-rc5-gcc is there already. All good.'
exit 1
fi
DESCRIPTION="Gaisler's RCC1.3-rc5"
PREFIX="/opt"
INSTALL_PATH="$PREFIX/rcc-1.3.-rc5"
CheckTargetFolder "${DESCRIPTION}" "${INSTALL_PATH}"
echo "[-] Downloading and uncompressing Gaisler's RCC1.3-rc5-gcc..."
echo "[-]"
......
......@@ -3,24 +3,17 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "${DIR}/common.sh"
DESCRIPTION="MSP430 GCC Toolchain"
INSTALL_PATH="/opt/msp430-gcc"
echo "[-] Checking if Texas Instruments MSP430-GCC is already under /opt/msp430-gcc..."
echo "[-]"
if [ -e /opt/msp430-gcc ] ; then
echo '[-] /opt/msp430-gcc is there already. Aborting...'
exit 1
fi
echo "[-] No MSP430-GCC present - installing."
CheckTargetFolder "${DESCRIPTION}" "${INSTALL_PATH}"
MACHINE_TYPE=`uname -m`
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
ARCH_INFIX="-x64"
echo "[-] Selected 64bit version."
ARCH_INFIX="-x64"
echo "[-] Selected 64bit version."
else
ARCH_INFIX=""
echo "[-] Selected 32bit version."
ARCH_INFIX=""
echo "[-] Selected 32bit version."
fi
DownloadToTemp "${DESCRIPTION}" http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/8_3_1_0/export/msp430-gcc-full-linux${ARCH_INFIX}-installer-8.3.1.0.run
......@@ -36,6 +29,6 @@ sudo ${DOWNLOADED_FILE} \
rm ${DOWNLOADED_FILE}
echo "[-] Appending /opt/msp430-gcc/bin to PATH"
echo -e "\n# MSP-430 support\nexport PATH=\$PATH:/opt/msp430-gcc/bin" >> ~/.bashrc.taste
echo "[-] Appending ${INSTALL_PATH}/bin to PATH"
echo -e "\n# MSP-430 support\nexport PATH=\$PATH:${INSTALL_PATH}/bin" >> ~/.bashrc.taste
echo "[-] Reload terminal (or source ~/.bashrc.taste) to apply change"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment