(Change Version)

Bug fix, removed scriptname from download path
This commit is contained in:
inxi-svn 2008-11-11 18:47:00 +00:00
parent df2d91cb37
commit 1fdc16d584

15
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.5.10 #### version: 0.5.11
#### 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
@ -547,7 +547,7 @@ get_parameters()
error_handler 4 "$OPTARG" error_handler 4 "$OPTARG"
fi fi
;; ;;
U) script_self_updater "$SCRIPT_DOWNLOAD$SCRIPT_NAME" 'svn server' U) script_self_updater "$SCRIPT_DOWNLOAD" 'svn server'
;; ;;
V) print_version_info V) print_version_info
exit 0 exit 0
@ -572,13 +572,13 @@ get_parameters()
case $OPTARG in case $OPTARG in
1) B_TESTING_FLAG='true' 1) B_TESTING_FLAG='true'
;; ;;
2) script_self_updater "$SCRIPT_DOWNLOAD_DEV$SCRIPT_NAME" 'dev server' 2) script_self_updater "$SCRIPT_DOWNLOAD_DEV" 'dev server'
;; ;;
http*) http*)
# first test provided url to avoid overwriting file with null # first test provided url to avoid overwriting file with null
wget --spider "$OPTARG$SCRIPT_NAME" wget --spider "$OPTARG$SCRIPT_NAME"
if [[ $? -eq 0 ]];then if [[ $? -eq 0 ]];then
script_self_updater "$OPTARG$SCRIPT_NAME" 'alt server' script_self_updater "$OPTARG" 'alt server'
else else
error_handler 10 "$OPTARG" error_handler 10 "$OPTARG"
fi fi
@ -668,12 +668,19 @@ script_self_updater()
print_screen_output "Starting $SCRIPT_NAME self updater." print_screen_output "Starting $SCRIPT_NAME self updater."
print_screen_output "Currently running $SCRIPT_NAME version number: $SCRIPT_VERSION_NUMBER" print_screen_output "Currently running $SCRIPT_NAME version number: $SCRIPT_VERSION_NUMBER"
print_screen_output "Updating $SCRIPT_NAME in $SCRIPT_PATH using $2 as download source..." print_screen_output "Updating $SCRIPT_NAME in $SCRIPT_PATH using $2 as download source..."
# first test if path is good
wget --spider $1$SCRIPT_NAME
# then do the actual download, need to make sure it's good because we're -O overwriting file
if [[ $? -eq 0 ]];then
wget -O $SCRIPT_PATH/$SCRIPT_NAME $1$SCRIPT_NAME || error_handler 8 "$?" wget -O $SCRIPT_PATH/$SCRIPT_NAME $1$SCRIPT_NAME || error_handler 8 "$?"
if [[ $? -eq 0 ]];then if [[ $? -eq 0 ]];then
SCRIPT_VERSION_NUMBER=$( grep -im 1 'version:' $SCRIPT_PATH/$SCRIPT_NAME | gawk '{print $3}' ) SCRIPT_VERSION_NUMBER=$( grep -im 1 'version:' $SCRIPT_PATH/$SCRIPT_NAME | gawk '{print $3}' )
print_screen_output "Successfully updated to $2 version: $SCRIPT_VERSION_NUMBER\nTo run the new version, just start $SCRIPT_NAME again." print_screen_output "Successfully updated to $2 version: $SCRIPT_VERSION_NUMBER\nTo run the new version, just start $SCRIPT_NAME again."
exit 0 exit 0
fi fi
else
error_handler 8 "$?"
fi
} }
######################################################################## ########################################################################