(Change Version)

Cleaned up and refactored download error handling, put it all in download function, out
of get_params, which should only set params, not execute special case code blocks. Sorry cathbard ;-)
This commit is contained in:
inxi-svn 2008-11-13 02:18:33 +00:00
parent c848609967
commit 30f749bc6d

12
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.5.21 #### version: 0.5.22
#### Date: November 11 2008 #### Date: November 11 2008
######################################################################## ########################################################################
#### inxi is a fork of infobash, the original bash sys info script by locsmif #### inxi is a fork of infobash, the original bash sys info script by locsmif
@ -600,13 +600,7 @@ get_parameters()
4) script_self_updater "$SCRIPT_DOWNLOAD_BRANCH_2" 'svn: branch two server' 4) script_self_updater "$SCRIPT_DOWNLOAD_BRANCH_2" 'svn: branch two server'
;; ;;
http*) http*)
# first test provided url to avoid overwriting file with null script_self_updater "$OPTARG" 'alt server'
wget -q --spider "$OPTARG$SCRIPT_NAME"
if [[ $? -eq 0 ]];then
script_self_updater "$OPTARG" 'alt server'
else
error_handler 10 "$OPTARG"
fi
;; ;;
*) error_handler 11 "$OPTARG" *) error_handler 11 "$OPTARG"
;; ;;
@ -723,6 +717,8 @@ script_self_updater()
else else
if [[ $2 == 'svn server' ]];then if [[ $2 == 'svn server' ]];then
error_handler 8 "$?" error_handler 8 "$?"
elif [[ $2 == 'alt server' ]];then
error_handler 10 "$OPTARG"
else else
error_handler 12 "$1" error_handler 12 "$1"
fi fi