aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamian Rouson <damian@sourceryinstitute.org>2021-04-07 13:04:53 -0700
committerGitHub <noreply@github.com>2021-04-07 22:04:53 +0200
commitb15db3c999b9cd7dceaa2ac55960ea92d198355b (patch)
treeea37ad03184b7dc28abcd3d295577bbfa892e38c
parentd9dc9f2ae5f196c15a7d35cddabc805c40ff86ce (diff)
downloadfpm-b15db3c999b9cd7dceaa2ac55960ea92d198355b.tar.gz
fpm-b15db3c999b9cd7dceaa2ac55960ea92d198355b.zip
feat(install.sh): use wget if curl is missing (#429)
-rwxr-xr-xinstall.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/install.sh b/install.sh
index 7f3908b..6c51304 100755
--- a/install.sh
+++ b/install.sh
@@ -52,7 +52,18 @@ if [ -z ${FFLAGS+x} ]; then
fi
mkdir -p $BOOTSTRAP_DIR
-curl -LJ $SOURCE_URL > $BOOTSTRAP_DIR/fpm.f90
+
+if command -v curl > /dev/null 2>&1; then
+ FETCH="curl -L"
+elif command -v wget > /dev/null 2>&1; then
+ FETCH="wget -O -"
+else
+ echo "No download mechanism found. Install curl or wget first."
+ exit 1
+fi
+
+$FETCH $SOURCE_URL > $BOOTSTRAP_DIR/fpm.f90
+
$FC $FFLAGS -J $BOOTSTRAP_DIR $BOOTSTRAP_DIR/fpm.f90 -o $BOOTSTRAP_DIR/fpm
$BOOTSTRAP_DIR/fpm install --compiler "$FC" --flag "$FFLAGS" --prefix "$PREFIX"