From 942fef8ba1dcc74571a4a8c67214301ec8d47635 Mon Sep 17 00:00:00 2001 From: Anton Hermann Date: Fri, 12 Nov 2021 23:54:13 +0100 Subject: [PATCH] Add ACCESSIBLE env var support for 'install.sh' If environment variable ACCESSIBLE is set to a nonempty value, suppress output of `curl` or `wget` --- install.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index f6f4f30..d12b572 100644 --- a/install.sh +++ b/install.sh @@ -7,6 +7,10 @@ DOWNLOAD_LOCATION="/tmp/ouch-binary" INSTALLATION_LOCATION="/usr/local/bin/ouch" REPO_URL="https://github.com/ouch-org/ouch" +# If env var ACCESSIBLE is set (to a nonempty value), suppress output of +# `curl` or `wget` + + # Panics script if anything fails set -e @@ -55,12 +59,15 @@ install() { echo "" # Set $downloader + downloader_quiet_flag="" if [ $(which curl) ]; then downloader="curl" - downloader_command="curl -fSL $binary_url -o $DOWNLOAD_LOCATION" + if [ "$ACCESSIBLE" ]; then downloader_quiet_flag="--silent"; fi + downloader_command="curl $downloader_quiet_flag -fSL $binary_url -o $DOWNLOAD_LOCATION" elif [ $(which wget) ]; then downloader="wget" - downloader_command="wget $binary_url -O $DOWNLOAD_LOCATION" + if [ "$ACCESSIBLE" ]; then downloader_quiet_flag="--quiet"; fi + downloader_command="wget $downloader_quiet_flag $binary_url -O $DOWNLOAD_LOCATION" else echo "ERROR: have not found 'curl' nor 'wget' to donwload ouch binary." exit 1