added more robust functions retrieval

This commit is contained in:
pyr0ball 2023-06-15 02:31:33 -07:00
parent 4d51caf316
commit 9b43c9a3f9

View file

@ -15,7 +15,21 @@ export PATH=\$PATH:/usr/local/go/bin
if [ ! -z $prbl_functions ] ; then if [ ! -z $prbl_functions ] ; then
source $prbl_functions source $prbl_functions
else else
source <(curl -ks 'https://raw.githubusercontent.com/pyr0ball/PRbL/master/functions') if [ -f ${rundir}/functions ] ; then
source ${rundir}/functions
else
# Iterate through get commands and fall back on next if unavailable
if command -v curl >/dev/null 2>&1; then
source <(curl -ks 'https://raw.githubusercontent.com/pyr0ball/PRbL/main/functions')
elif command -v wget >/dev/null 2>&1; then
source <(wget -qO- 'https://raw.githubusercontent.com/pyr0ball/PRbL/main/functions')
elif command -v fetch >/dev/null 2>&1; then
source <(fetch -qo- 'https://raw.githubusercontent.com/pyr0ball/PRbL/main/functions')
else
echo "Error: curl, wget, and fetch commands are not available. Please install one to retrieve PRbL functions."
exit 1
fi
fi
fi fi
logfile="${rundir}/${pretty_date}_${scriptname}.log" logfile="${rundir}/${pretty_date}_${scriptname}.log"