mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
added failed download due to file corruption error and tweaked regex
This commit is contained in:
parent
80ff3de839
commit
ddd3258580
9
inxi
9
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 1.4.84
|
||||
#### version: 1.4.85
|
||||
#### Date: April 26 2011
|
||||
########################################################################
|
||||
#### SPECIAL THANKS
|
||||
|
@ -1011,6 +1011,9 @@ error_handler()
|
|||
15)
|
||||
error_message="failed set execute permissions on $SCRIPT_NAME at location $SCRIPT_HOME.\nThis usually means you don't have permission to set permissions on files there, maybe you need to be root?\nThe operation failed with error: $2"
|
||||
;;
|
||||
16)
|
||||
error_message="$SCRIPT_NAME downloaded but the file data is corrupted. Purged data and using current version."
|
||||
;;
|
||||
*) error_message="error unknown: $@"
|
||||
set -- 99
|
||||
;;
|
||||
|
@ -1144,7 +1147,7 @@ script_self_updater()
|
|||
# then do the actual download
|
||||
if [[ $wget_error -eq 0 ]];then
|
||||
# make sure the whole file got downloaded and is in the variable
|
||||
if [[ -n $( grep '###**EOF**###' <<< "$file_contents" ) ]];then
|
||||
if [[ -n $( grep '###\*\*EOF\*\*###' <<< "$file_contents" ) ]];then
|
||||
echo "$file_contents" > $SCRIPT_PATH/$SCRIPT_NAME || error_handler 14 "$?"
|
||||
chmod +x $SCRIPT_PATH/$SCRIPT_NAME || error_handler 15 "$?"
|
||||
SCRIPT_VERSION_NUMBER=$( grep -im 1 'version:' $SCRIPT_PATH/$SCRIPT_NAME | gawk '{print $3}' )
|
||||
|
@ -1152,7 +1155,7 @@ script_self_updater()
|
|||
print_screen_output "To run the new version, just start $SCRIPT_NAME again."
|
||||
exit 0
|
||||
else
|
||||
error_handler
|
||||
error_handler 16
|
||||
fi
|
||||
fi
|
||||
# now run the error handlers on any wget failure
|
||||
|
|
Loading…
Reference in a new issue