Merge pull request #84 from itoffshore/master

install-ngxblocker / setup-ngxblocker: print all curl errors
This commit is contained in:
Mitchell Krog 2017-08-27 09:56:26 +02:00 committed by GitHub
commit 04451bf466
2 changed files with 6 additions and 3 deletions

View file

@ -92,8 +92,8 @@ check_if_updating() {
}
download_files() {
local url= x= local_file= remote_path= remote_dir=$1 local_dir=$2 tmp= # rm leading whitespace
local file_list="$(echo $@ | awk '{$1=$2=""; print $0}' | sed -e 's/^[ \t]*//')"
local url= x= local_file= remote_path= remote_dir=$1 local_dir=$2 tmp= retval=
local file_list="$(echo $@ | awk '{$1=$2=""; print $0}' | sed -e 's/^[ \t]*//')" # rm leading whitespace
local col_size=$(( $(longest_str $file_list) + $(echo $remote_dir | wc -m) ))
if [ -n "$(check_if_updating $local_dir $file_list)" ]; then
@ -118,13 +118,15 @@ download_files() {
tmp=$(mktemp)
url=$REPO/$remote_path
curl --fail --connect-timeout 60 --retry 10 --retry-delay 5 -so $tmp $url
retval=$?
case "$?" in
case "$retval" in
0) printf "...OK\n"
mv $tmp $local_file
;;
22) printf "...ERROR 404: $url\n";;
28) printf "...ERROR TIMEOUT: $url\n";;
*) printf "...ERROR CURL: ($retval)\n";;
esac
else
printf "%-21s %-$(( $col_size +8 ))s %s\n" \

View file

@ -289,6 +289,7 @@ main() {
;;
22) printf "...${BOLDRED}ERROR 404: $url${RESET}\n\n";;
28) printf "...${BOLDRED}ERROR TIMEOUT: $url${RESET}\n\n";;
*) printf "...${BOLDRED}ERROR CURL: ($retval){RESET}\n\n";;
esac
# download new bots.d / conf.d files