From 9b43c9a3f9030bd7ec54b3a4add74d7e41bd2c46 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Thu, 15 Jun 2023 02:31:33 -0700 Subject: [PATCH] added more robust functions retrieval --- extras/golang.install | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/extras/golang.install b/extras/golang.install index 24775da..f243eec 100644 --- a/extras/golang.install +++ b/extras/golang.install @@ -15,7 +15,21 @@ export PATH=\$PATH:/usr/local/go/bin if [ ! -z $prbl_functions ] ; then source $prbl_functions 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 logfile="${rundir}/${pretty_date}_${scriptname}.log"