Improved -U error handler, added advice to output if wget fails.

This commit is contained in:
inxi-svn 2008-10-30 21:28:50 +00:00
parent c4764550e4
commit 13a9fba961

21
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.2.1 #### version: 0.2.2
#### Date: October 30 2008 #### Date: October 30 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
@ -156,33 +156,36 @@ fi
# Error handling # Error handling
error_handler() error_handler()
{ {
local error_message=''
case $1 in case $1 in
2) 2)
print_screen_output "$SCRIPT_NAME: large flood danger, debug buffer full!" error_message="$SCRIPT_NAME: large flood danger, debug buffer full!"
;; ;;
3) 3)
print_screen_output "$SCRIPT_NAME: error in colorscheme - unsupported number: $2" error_message="$SCRIPT_NAME: error in colorscheme - unsupported number: $2"
;; ;;
4) 4)
print_screen_output "$SCRIPT_NAME: unsupported verbosity level $2" error_message="$SCRIPT_NAME: unsupported verbosity level $2"
;; ;;
5) 5)
print_screen_output "$SCRIPT_NAME: dependency not met: $2 not found in path" error_message="$SCRIPT_NAME: dependency not met: $2 not found in path"
;; ;;
6) 6)
print_screen_output "$SCRIPT_NAME: /proc not found! Quitting..." error_message="$SCRIPT_NAME: /proc not found! Quitting..."
;; ;;
7) 7)
print_screen_output "$SCRIPT_NAME: unknown parameter: $2" error_message="$SCRIPT_NAME: unknown parameter: $2"
;; ;;
8) 8)
print_screen_output "$SCRIPT_NAME: the self-updater failed, wget exited with error: $2. You probably need to be root." error_message="$SCRIPT_NAME: the self-updater failed, wget exited with error: $2.\nYou probably need to be root.\nHint, to make for easy updates without being root, do: chown <user name> $SCRIPT_NAME"
;; ;;
*) *)
print_screen_output "$SCRIPT_NAME: error unknown: $@" error_message="$SCRIPT_NAME: error unknown: $@"
set -- 99 set -- 99
;; ;;
esac esac
print_screen_output "$error_message"
exit $1 exit $1
} }