Commit c0b5f287 authored by Konrad Grochowski's avatar Konrad Grochowski

Addons: DownloadAndExtract extracted to common.sh

parent fa25797d
......@@ -26,6 +26,26 @@ function CheckTargetFolder() {
sudo rm -rf "${FOLDER}" 2>/dev/null
}
function DownloadAndExtract() {
local DESCRIPTION="$1"
local URL="$2"
local PREFIX="${3:-/opt}"
local COMPRESSION="${4:-j}"
echo "[-]"
echo "[-] Downloading and uncompressing ${DESCRIPTION}..."
echo "[-]"
wget -q --show-progress -O - "${URL}" | \
( cd "${PREFIX}" || exit 1 ; sudo tar xv${COMPRESSION}f - )
if [ $? -ne 0 ] ; then
echo "Downloading ${DESCRIPTION} has failed."
echo Aborting...
exit 1
fi
}
function InstallBSP() {
local DESCRIPTION="$1"
local URL="$2"
......@@ -33,9 +53,7 @@ function InstallBSP() {
local FOLDER="${BASE}/$4"
CheckTargetFolder "$DESCRIPTION" "$FOLDER"
wget -q --show-progress -O - "${URL}" | \
( cd "${BASE}" || exit 1 ; sudo tar jxvf - )
DownloadAndExtract "$DESCRIPTION" "$URL" "$BASE"
}
function DownloadToTemp() {
......
......@@ -5,15 +5,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DESCRIPTION="Gaisler's RTEMS 4.10"
PREFIX="/opt"
INSTALL_PATH="$PREFIX/rtems-4.10"
URL="http://www.gaisler.com/j25/anonftp/rcc/bin/linux/sparc-rtems-4.10-gcc-4.4.6-1.2.21-linux.tar.bz2"
CheckTargetFolder "${DESCRIPTION}" "${INSTALL_PATH}"
echo "[-] Downloading and uncompressing Gaisler's RTEMS 4.10..."
echo "[-]"
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."
echo Aborting...
exit 1
fi
DownloadAndExtract "${DESCRIPTION}" "${URL}" "${PREFIX}"
......@@ -5,15 +5,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DESCRIPTION="Gaisler's RCC1.3-rc5"
PREFIX="/opt"
INSTALL_PATH="$PREFIX/rcc-1.3.-rc5"
URL="https://www.gaisler.com/anonftp/rcc/bin/linux/sparc-rtems-5-gcc-7.2.0-1.3-rc5-linux.txz"
CheckTargetFolder "${DESCRIPTION}" "${INSTALL_PATH}"
echo "[-] Downloading and uncompressing Gaisler's RCC1.3-rc5-gcc..."
echo "[-]"
cd /opt || exit 1
wget -q -O - https://www.gaisler.com/anonftp/rcc/bin/linux/sparc-rtems-5-gcc-7.2.0-1.3-rc5-linux.txz | sudo tar Jxvf -
if [ $? -ne 0 ] ; then
echo "Downloading Gaisler's RCC1.3-rc5-gcc toolchain has failed."
echo Aborting...
exit 1
fi
DownloadAndExtract "${DESCRIPTION}" "${URL}" "${PREFIX}" "J"
......@@ -5,15 +5,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DESCRIPTION="Gaisler's RCC1.3-rc6"
PREFIX="/opt"
INSTALL_PATH="$PREFIX/rcc-1.3.-rc6"
URL="https://www.gaisler.com/anonftp/rcc/bin/linux/sparc-rtems-5-gcc-7.2.0-1.3-rc6-linux.txz"
CheckTargetFolder "${DESCRIPTION}" "${INSTALL_PATH}"
echo "[-] Downloading and uncompressing Gaisler's RCC1.3-rc6..."
echo "[-]"
cd /opt || exit 1
wget -q -O - https://www.gaisler.com/anonftp/rcc/bin/linux/sparc-rtems-5-gcc-7.2.0-1.3-rc6-linux.txz | sudo tar xJvf -
if [ $? -ne 0 ] ; then
echo "Downloading Gaisler's RCC1.3-rc6 toolchain has failed."
echo Aborting...
exit 1
fi
DownloadAndExtract "${DESCRIPTION}" "${URL}" "${PREFIX}" "J"
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