added additional failovers and checks to run-from-url()
This commit is contained in:
parent
4c8211b4f8
commit
0c1d593673
1 changed files with 24 additions and 0 deletions
24
functions
24
functions
|
|
@ -587,15 +587,39 @@ run-from-url(){
|
|||
# check the interpreter using the shebang at the top of the file
|
||||
interpreter=$(curl -ks $url | head -n 1 | sed -n -e 's\/\#//g' 2>/dev/null)
|
||||
# boxline "interpreter=$interpreter"
|
||||
# In case of missing shebang, default to local shells
|
||||
# In case of missing shebang, default to bash
|
||||
# In case of missing shebang, default to local shells
|
||||
if [ -z $interpreter ] ; then
|
||||
if [ -x /bin/bash ] ; then
|
||||
if [ -x /bin/bash ] ; then
|
||||
interpreter="/bin/bash"
|
||||
interpreter="/bin/bash"
|
||||
interpreter="/bin/bash"
|
||||
elif [ -x /bin/sh ] ; then
|
||||
interpreter="/bin/sh"
|
||||
elif [ -x /bin/zsh ] ; then
|
||||
interpreter="/bin/zsh"
|
||||
elif [ -x /bin/sh ] ; then
|
||||
interpreter="/bin/sh"
|
||||
elif [ -x /bin/zsh ] ; then
|
||||
interpreter="/bin/zsh"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
logger boxline "Running online script $url with args $args"
|
||||
boxline "Running online script $url with args $args"
|
||||
fi
|
||||
logger boxline "Running online script $url with args $args"
|
||||
if [[ "$interpreter" == "/bin/bash" ]] ; then
|
||||
run curl -H 'Cache-Control: no-cache' -kLs $url | $interpreter -s -- $args
|
||||
run curl -H 'Cache-Control: no-cache' -ks $url | $interpreter -s -- $args
|
||||
run curl -H 'Cache-Control: no-cache' -kLs $url | $interpreter -s -- $args
|
||||
else
|
||||
run curl -H 'Cache-Control: no-cache' -kLs $url > ${url##*/}
|
||||
run curl -H 'Cache-Control: no-cache' -ks $url > ${url##*/}
|
||||
run curl -H 'Cache-Control: no-cache' -kLs $url > ${url##*/}
|
||||
run $interpreter ${url##*/} $args
|
||||
ec=$?
|
||||
run rm ${url##*/}
|
||||
|
|
|
|||
Loading…
Reference in a new issue