Commit e817b7fb authored by Konrad Grochowski's avatar Konrad Grochowski

Addons: DownloadToTemp extracted to common.sh

parent c8919acf
#!/bin/bash
function InstallBSP() {
DESCRIPTION="$1"
URL="$2"
......@@ -19,6 +21,26 @@ function InstallBSP() {
exit 1
fi
sudo rm -rf "${FOLDER}" 2>/dev/null
wget -q -O - "${URL}" | \
wget -q --show-progress -O - "${URL}" | \
( cd "${BASE}" || exit 1 ; sudo tar jxvf - )
}
function DownloadToTemp() {
local DESCRIPTION="$1"
local URL="$2"
local TMP_DIR="${3:-/tmp}"
DOWNLOADED_FILE=$(mktemp --tmpdir="$TMP_DIR")
echo "[-]"
echo "[-] Downloading ${DESCRIPTION}..."
echo "[-]"
wget -q --show-progress -O "${DOWNLOADED_FILE}" "${URL}"
if [ $? -ne 0 ] ; then
echo "Downloading ${DESCRIPTION} has failed."
echo "Aborting..."
exit 1
fi
}
......@@ -4,10 +4,11 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
FREERTOS_VERSION="10.2.1"
DESCRIPTION="FreeRTOS"
PREFIX="/opt"
INSTALL_PATH="$PREFIX/FreeRTOSv$FREERTOS_VERSION"
ZIP_FILE="FreeRTOS.zip"
TMP_DIR="/tmp"
echo "[-] Checking if FreeRTOS is already under ${INSTALL_PATH}..."
echo "[-]"
......@@ -19,22 +20,13 @@ fi
echo "[-] No FreeRTOS present - installing."
echo "[-]"
echo "[-] Downloading FreeRTOS..."
echo "[-]"
cd "$TMP_DIR" || exit 1
wget -q -O $ZIP_FILE https://sourceforge.net/projects/freertos/files/FreeRTOS/V$FREERTOS_VERSION/FreeRTOSv$FREERTOS_VERSION.zip/download
if [ $? -ne 0 ] ; then
echo "Downloading FreeRTOS has failed."
echo Aborting...
exit 1
fi
DownloadToTemp "${DESCRIPTION}" "https://sourceforge.net/projects/freertos/files/FreeRTOS/V${FREERTOS_VERSION}/FreeRTOSv${FREERTOS_VERSION}.zip/download"
echo "[-] Installing FreeRTOS..."
echo "[-]"
sudo unzip "$ZIP_FILE" -d "$PREFIX"
rm "$ZIP_FILE"
sudo unzip "$DOWNLOADED_FILE" -d "$PREFIX"
rm "$DOWNLOADED_FILE"
echo "[-] Creating FREERTOS_PATH enviroment variable"
echo -e "\n# FreeRTOS\nexport FREERTOS_PATH=\"$INSTALL_PATH\"" >> ~/.bashrc.taste
......
......@@ -2,6 +2,8 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "${DIR}/common.sh"
DESCRIPTION="MSP430 GCC Toolchain"
echo "[-] Checking if Texas Instruments MSP430-GCC is already under /opt/msp430-gcc..."
echo "[-]"
......@@ -21,27 +23,18 @@ else
echo "[-] Selected 32bit version."
fi
echo "[-]"
echo "[-] Downloading MSP430-GCC..."
echo "[-]"
cd ~/Downloads || exit 1
wget -q -O msp430-gcc-installer.run 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
if [ $? -ne 0 ] ; then
echo "Downloading MSP430-GCC toolchain has failed."
echo Aborting...
exit 1
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
echo "[-] Installing MSP430-GCC..."
echo "[-]"
chmod +x msp430-gcc-installer.run
sudo ./msp430-gcc-installer.run \
chmod +x ${DOWNLOADED_FILE}
sudo ${DOWNLOADED_FILE} \
--mode unattended \
--unattendedmodeui minimal \
--prefix /opt/msp430-gcc
rm msp430-gcc-installer.run
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
......
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