mirror of
https://github.com/arkenfox/user.js.git
synced 2025-05-03 23:43:40 +02:00
abort if neither curl nor wget are available
Additionally, hide the output of those checks. fixes #537
This commit is contained in:
parent
c12eb0fdc6
commit
c878512a07
1 changed files with 10 additions and 5 deletions
15
updater.sh
15
updater.sh
|
@ -16,9 +16,14 @@ DOWNLOAD_TO_STDOUT="curl -s"
|
||||||
DOWNLOAD_TO_FILE="curl -O"
|
DOWNLOAD_TO_FILE="curl -O"
|
||||||
|
|
||||||
# Use wget if curl is not available.
|
# Use wget if curl is not available.
|
||||||
if [[ -z $(command -v "curl") ]]; then
|
if [[ -z $(command -v "curl") ]] > /dev/null 2>&1; then
|
||||||
DOWNLOAD_TO_STDOUT="wget --quiet --output-document=-"
|
if [[ $(command -v "wget") ]] > /dev/null 2>&1; then
|
||||||
DOWNLOAD_TO_FILE="wget"
|
DOWNLOAD_TO_STDOUT="wget --quiet --output-document=-"
|
||||||
|
DOWNLOAD_TO_FILE="wget"
|
||||||
|
else
|
||||||
|
echo -e "This script requires either curl or wget to be installed.\nProcess aborted"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## get the full path of this script (readlink for Linux, greadlink for Mac with coreutils installed)
|
## get the full path of this script (readlink for Linux, greadlink for Mac with coreutils installed)
|
||||||
|
@ -112,11 +117,11 @@ else
|
||||||
if [ $update_available = "no" ]; then
|
if [ $update_available = "no" ]; then
|
||||||
main
|
main
|
||||||
else
|
else
|
||||||
## there is an update available
|
## there is an update available
|
||||||
if [ $update_pref = "-update" ]; then
|
if [ $update_pref = "-update" ]; then
|
||||||
## update without asking
|
## update without asking
|
||||||
update_script
|
update_script
|
||||||
else
|
else
|
||||||
read -p "There is a newer version of updater.sh available. Download and execute? Y/N? " -n 1 -r
|
read -p "There is a newer version of updater.sh available. Download and execute? Y/N? " -n 1 -r
|
||||||
echo -e "\n\n"
|
echo -e "\n\n"
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue