mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
testing new ip features and bug fixes
This commit is contained in:
parent
cf29f83108
commit
ff58282b96
62
inxi
62
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 0.6.0-b1-t7
|
||||
#### version: 0.6.0-b1-t8
|
||||
#### Date: November 20 2008
|
||||
########################################################################
|
||||
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
|
||||
|
@ -120,6 +120,7 @@ B_SHOW_GRAPHICS='false'
|
|||
# Set this to 'false' to avoid printing the hostname
|
||||
B_SHOW_HOST='true'
|
||||
B_SHOW_INFO='false'
|
||||
B_SHOW_IP='false'
|
||||
B_SHOW_NETWORK='false'
|
||||
# either -v > 3 or -p will show partitions
|
||||
B_SHOW_PARTITIONS='false'
|
||||
|
@ -518,7 +519,7 @@ get_parameters()
|
|||
# the short form only runs if no args output args are used
|
||||
# no need to run through these if there are no args
|
||||
if [[ -n $1 ]];then
|
||||
while getopts Ac:CdDfFGhHINPSv:Vx%@:${update_flags} opt
|
||||
while getopts Ac:CdDfFGhHiINPSv:Vx%@:${update_flags} opt
|
||||
do
|
||||
case $opt in
|
||||
A) B_SHOW_AUDIO='true'
|
||||
|
@ -549,7 +550,6 @@ get_parameters()
|
|||
use_short='false'
|
||||
;;
|
||||
F) VERBOSITY_LEVEL=$VERBOSITY_LEVELS
|
||||
B_CPU_FLAGS_FULL='true'
|
||||
B_EXTRA_DATA='true'
|
||||
B_SHOW_DISK='true'
|
||||
B_SHOW_PARTITIONS='true'
|
||||
|
@ -559,6 +559,10 @@ get_parameters()
|
|||
G) B_SHOW_GRAPHICS='true'
|
||||
use_short='false'
|
||||
;;
|
||||
i) B_SHOW_IP='true'
|
||||
B_SHOW_NETWORK='true'
|
||||
use_short='false'
|
||||
;;
|
||||
I) B_SHOW_INFO='true'
|
||||
use_short='false'
|
||||
;;
|
||||
|
@ -653,7 +657,7 @@ show_options()
|
|||
print_screen_output ""
|
||||
print_screen_output "If you start $SCRIPT_NAME with no arguments, it will show the short form."
|
||||
print_screen_output "The following options if used without -d or -v will show just that complete line:"
|
||||
print_screen_output "A,C,f,D,G,I,N,P,S - you can use these together to show just the lines you want to see."
|
||||
print_screen_output "A,C,D,G,I,N,P,S - you can use these together to show just the lines you want to see."
|
||||
print_screen_output "If you use them with a -v level (or -d), it will show the full output for that line "
|
||||
print_screen_output "along with the output for the chosen verbosity level."
|
||||
print_screen_output "- - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
|
||||
|
@ -664,9 +668,11 @@ show_options()
|
|||
print_screen_output "-C Show full CPU output, including per CPU clockspeed."
|
||||
print_screen_output "-d Default output verbosity level, same as: $SCRIPT_NAME -v 1"
|
||||
print_screen_output "-D Show full hard disk info, not only model, ie: /dev/sda ST380817AS 80.0GB."
|
||||
print_screen_output "-f Show all cpu flags used, not just the short list."
|
||||
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 "-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 " 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 "-N Show network card information."
|
||||
print_screen_output "-P Show partition information (shows what -v4 would show, but without extra data)."
|
||||
|
@ -1781,6 +1787,36 @@ get_networking_data()
|
|||
IFS="$ORIGINAL_IFS"
|
||||
}
|
||||
|
||||
get_networking_wan_ip_data()
|
||||
{
|
||||
local extras_data='' ip='' browser=''
|
||||
|
||||
# first find a client to use:
|
||||
if [[ -n $( which lynx ) ]];then
|
||||
browser='lynx'
|
||||
elif [[ -n $( which links2 ) ]];then
|
||||
browser='links2'
|
||||
fi
|
||||
|
||||
if [[ -n $browser ]];then
|
||||
ip=$( $browser -dump techpatterns.com/ip | awk -F 'is: ' '{
|
||||
#gsub("\n","",$2")
|
||||
print $2
|
||||
}' )
|
||||
fi
|
||||
if [[ -z $ip ]];then
|
||||
ip='N/A'
|
||||
fi
|
||||
echo "$ip"
|
||||
|
||||
|
||||
}
|
||||
|
||||
get_networking_local_ip_data()
|
||||
{
|
||||
:
|
||||
}
|
||||
|
||||
get_partition_data()
|
||||
{
|
||||
IFS=$'\n'
|
||||
|
@ -2391,6 +2427,8 @@ print_networking_data()
|
|||
a_network_working=(${A_NETWORK_DATA[0]})
|
||||
IFS="$ORIGINAL_IFS"
|
||||
|
||||
# will never be null because null is handled in get_network_data, but in case we change
|
||||
# that leaving this test in place.
|
||||
if [[ -n ${A_NETWORK_DATA[@]} ]];then
|
||||
if [[ ${#A_NETWORK_DATA[@]} -le 1 ]];then
|
||||
card_one='Card'
|
||||
|
@ -2425,6 +2463,20 @@ print_networking_data()
|
|||
print_screen_output "$network_data"
|
||||
done
|
||||
fi
|
||||
if [[ $B_SHOW_IP == 'true' ]];then
|
||||
print_networking_ip_data
|
||||
fi
|
||||
}
|
||||
|
||||
print_networking_ip_data()
|
||||
{
|
||||
local ip=$( get_networking_wan_ip_data ) ip_data=''
|
||||
|
||||
# first print output for wan ip line. Null is handled in the get function
|
||||
ip_data=$( create_print_line " " "${C1}Wan IP:${C2} $ip" )
|
||||
print_screen_output "$ip_data"
|
||||
|
||||
# then create the list of local interface/ip
|
||||
}
|
||||
|
||||
print_system_data()
|
||||
|
|
Loading…
Reference in a new issue