only try to install prerequisites when missing, only offer node packages, if node installed

This commit is contained in:
2025-05-15 10:53:04 -04:00
parent 1f800151e5
commit b45bd31954
5 changed files with 57 additions and 51 deletions
+15 -15
View File
@@ -4,40 +4,40 @@
# keep trying until we get a result
# dig
if [[ -n $(command -v "dig") ]]; then
if [[ -n $(command -v 'dig') ]]; then
# via opendns
address=$(dig "@resolver1.opendns.com" -4 "myip.opendns.com" "A" "+short")
if [[ "$?" -ne "0" ]]; then
address=$(dig '@resolver1.opendns.com' -4 'myip.opendns.com' A '+short')
if [[ "$?" -ne '0' ]]; then
# dig was unsuccessful
echo "$address" 1>&2
address=""
echo "${address}" 1>&2
address=''
fi
fi
# curl
if [[ -z "$address" ]] && [[ -n $(command -v "curl") ]]; then
if [[ -z "${address}" ]] && [[ -n $(command -v 'curl') ]]; then
# via ipinfo.io
address=$(curl -4 --fail --silent --show-error "https://ipinfo.io/ip")
address=$(curl -4 --fail --silent --show-error 'https://ipinfo.io/ip')
if [[ -z "$address" ]]; then
if [[ -z "${address}" ]]; then
# via google
address=$(curl -4 --fail --silent --show-error "https://domains.google.com/checkip")
address=$(curl -4 --fail --silent --show-error 'https://domains.google.com/checkip')
fi
fi
# wget
if [[ -z "$address" ]] && [[ -n $(command -v "wget") ]]; then
if [[ -z "${address}" ]] && [[ -n $(command -v 'wget') ]]; then
# via ipinfo.io
address=$(wget -4 --quiet --output-document - "https://ipinfo.io/ip")
address=$(wget -4 --quiet --output-document - 'https://ipinfo.io/ip')
if [[ -z "$address" ]]; then
if [[ -z "${address}" ]]; then
# via google
address=$(wget -4 --quiet --output-document - "https://domains.google.com/checkip")
address=$(wget -4 --quiet --output-document - 'https://domains.google.com/checkip')
fi
fi
if [[ -n "$address" ]]; then
echo "$address"
if [[ -n "${address}" ]]; then
echo "${address}"
else
echo 'Tried everything, unable to resolve IP address.' 1>&2
fi