mirror of
https://github.com/bensuperpc/dockcross.git
synced 2026-07-26 04:48:08 +02:00
chore(imagesfiles): Refactor script introducing fetch_source function
Update options preferring their more explicit long form: `-f` is `--fail` `-s` is `--silent` `-S` is `--show-error` `-L` is `--location` Additionally, `-O` is removed in favor of explicitly specifying the output file using `-o`
This commit is contained in:
@@ -3,6 +3,12 @@
|
||||
set -ex
|
||||
set -o pipefail
|
||||
|
||||
# Get script directory
|
||||
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
|
||||
|
||||
# Get build utilities
|
||||
source $SCRIPT_DIR/utils.sh
|
||||
|
||||
ARCH="x86_64"
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
@@ -18,11 +24,6 @@ while [ $# -gt 0 ]; do
|
||||
shift
|
||||
done
|
||||
|
||||
if ! command -v curl &> /dev/null; then
|
||||
echo >&2 'error: "curl" not found!'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v tar &> /dev/null; then
|
||||
echo >&2 'error: "tar" not found!'
|
||||
exit 1
|
||||
@@ -36,15 +37,11 @@ fi
|
||||
cd /usr/src
|
||||
|
||||
CMAKE_ROOT=cmake-${CMAKE_VERSION}-Centos5-${ARCH}
|
||||
url=https://github.com/dockbuild/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_ROOT}.tar.gz
|
||||
echo "Downloading $url"
|
||||
curl --connect-timeout 30 \
|
||||
--max-time 10 \
|
||||
--retry 5 \
|
||||
--retry-delay 10 \
|
||||
--retry-max-time 30 \
|
||||
-# -LO $url
|
||||
CMAKE_DOWNLOAD_URL=https://github.com/dockbuild/CMake/releases/download/v${CMAKE_VERSION}
|
||||
|
||||
echo "Downloading ${CMAKE_DOWNLOAD_URL}/${CMAKE_ROOT}.tar.gz"
|
||||
|
||||
fetch_source "${CMAKE_ROOT}.tar.gz" "${CMAKE_DOWNLOAD_URL}"
|
||||
tar -xzvf "${CMAKE_ROOT}.tar.gz"
|
||||
rm -f "${CMAKE_ROOT}.tar.gz"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user