Fixed weak wan ip handling, using wget -q -O - now to send to stdout

This commit is contained in:
inxi-svn 2008-11-21 22:23:19 +00:00
parent 1c4cc83cb6
commit 5bd6dede93

23
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.6.0-b1-t15 #### version: 0.6.0-b1-t16
#### Date: November 20 2008 #### Date: November 20 2008
######################################################################## ########################################################################
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif #### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
@ -38,7 +38,6 @@
#### Also the proc filesystem should be present and mounted #### Also the proc filesystem should be present and mounted
#### ####
#### RECOMMENDS (Needed to run certain features) #### RECOMMENDS (Needed to run certain features)
#### One of the following console browsers (for Wan IP test): elinks links links2 lynx w3m
#### For local interfaces/IP test: ifconfig (in net-tools for Debian systems) #### For local interfaces/IP test: ifconfig (in net-tools for Debian systems)
######################################################################## ########################################################################
#### CONVENTIONS: #### CONVENTIONS:
@ -676,7 +675,7 @@ show_options()
print_screen_output "-f Show all cpu flags used, not just the short list. Not shown with -F to avoid spamming." print_screen_output "-f Show all cpu flags used, not just the short list. Not shown with -F to avoid spamming."
print_screen_output "-F Show Full, all possible, output for $SCRIPT_NAME." print_screen_output "-F Show Full, all possible, output for $SCRIPT_NAME."
print_screen_output "-G Show graphic card information (+ glx driver and version for non free video drivers)." print_screen_output "-G Show graphic card information (+ glx driver and version for non free video drivers)."
print_screen_output "-i Show Wan IP address and local interfaces if ifconfig is installed." print_screen_output "-i Show Wan IP address, and shows local interfaces (requires ifconfig network tool)."
print_screen_output " Not shown with -F for user security reasons, you shouldn't paste your local/wan IP." print_screen_output " Not shown with -F for user security reasons, you shouldn't paste your local/wan IP."
print_screen_output "-I Show information: processes, uptime, memory, irc client, inxi version." print_screen_output "-I Show information: processes, uptime, memory, irc client, inxi version."
print_screen_output "-N Show network card information." print_screen_output "-N Show network card information."
@ -1795,26 +1794,14 @@ get_networking_data()
get_networking_wan_ip_data() get_networking_wan_ip_data()
{ {
local extras_data='' ip='' use_browser='' browser='' local extras_data='' ip='' use_browser='' browser=''
local browsers='elinks links links2 lynx w3m'
# first find a browser to use, these all support -dump
for browser in $browsers
do
if [[ -n $( which $browser ) ]];then
use_browser=$browser
break
fi
done
# get ip or show console browser missing error # get ip or show console browser missing error
if [[ -n $use_browser ]];then
ip=$( $use_browser -dump techpatterns.com/ip | awk -F 'is: ' '{ ip=$( wget -q -O - http://techpatterns.com/resources/ip.php | awk -F 'is: ' '{
#gsub("\n","",$2") #gsub("\n","",$2")
print $2 print $2
}' ) }' )
else
ip='Requires Console Browser!'
fi
if [[ -z $ip ]];then if [[ -z $ip ]];then
ip='None Detected!' ip='None Detected!'
fi fi