branches one, test

This commit is contained in:
inxi-svn 2014-04-01 20:20:14 +00:00
parent a5cc3d4706
commit 40a74416cb

238
inxi
View file

@ -1,9 +1,9 @@
#!/usr/bin/env bash
########################################################################
#### Script Name: inxi
#### Version: 2.1.11
#### Date: 2014-03-26
#### Patch Number: 10-b1
#### Version: 2.1.15
#### Date: 2014-04-01
#### Patch Number: 01-b1
########################################################################
#### SPECIAL THANKS
########################################################################
@ -593,7 +593,7 @@ BLUE,WHITE,NORMAL
## DISTRO DATA/ID ##
# In cases of derived distros where the version file of the base distro can also be found under /etc,
# the derived distro's version file should go first. (Such as with Sabayon / Gentoo)
DISTROS_DERIVED="antix-version aptosid-version kanotix-version knoppix-version mandrake-release pardus-release sabayon-release siduction-version sidux-version solusos-release turbolinux-release zenwalk-version"
DISTROS_DERIVED="antix-version aptosid-version kanotix-version knoppix-version mandrake-release pardus-release porteus-version sabayon-release siduction-version sidux-version slitaz-release solusos-release turbolinux-release zenwalk-version"
# debian_version excluded from DISTROS_PRIMARY so Debian can fall through to /etc/issue detection. Same goes for Ubuntu.
DISTROS_EXCLUDE_LIST="debian_version ubuntu_version"
DISTROS_PRIMARY="arch-release gentoo-release redhat-release slackware-version SuSE-release"
@ -815,8 +815,7 @@ main()
initialize_data()
{
eval $LOGFS
BSD_VERSION=$( uname -s 2>/dev/null )
BSD_VERSION=${BSD_VERSION,,}
BSD_VERSION=$( uname -s 2>/dev/null | tr '[A-Z]' '[a-z]' )
# note: archbsd says they are a freebsd distro, so assuming it's the same as freebsd
if [[ -z ${BSD_VERSION/*bsd*/} ]];then
# GNU/kfreebsd will by definition have GNU tools like sed/grep
@ -1541,10 +1540,9 @@ debug_data_collector()
local completed_gz_file='' xiin_file='xiin.py' ftp_upload='ftp.techpatterns.com/incoming'
local Line='-------------------------'
local start_directory=$( pwd )
local host=$HOSTNAME
local host=$( tr '[A-Z]' '[a-z]' <<< "$HOSTNAME" )
if [[ -n $host ]];then
host=${host// /-}
host="-${host,,}"
else
host="-no-host"
fi
@ -1552,7 +1550,7 @@ debug_data_collector()
bsd_string="-$BSD_TYPE"
fi
debug_data_dir="inxi$bsd_string$host-$(date +%Y%m%d-%H%M%S)-$1"
debug_data_dir="inxi$bsd_string-$host-$(date +%Y%m%d-%H%M%S)-$1"
if [[ $B_IRC == 'false' ]];then
if [[ -n $ALTERNATE_FTP ]];then
@ -1601,10 +1599,22 @@ debug_data_collector()
systemctl list-units --type=target &> $debug_data_dir/systemctl-list-units-target.txt
initctl list &> $debug_data_dir/initctl-list.txt
sensors &> $debug_data_dir/sensors.txt
strings --version &> $debug_data_dir/strings.txt
nvidia-smi -q &> $debug_data_dir/nvidia-smi-q.txt
nvidia-smi -q -x &> $debug_data_dir/nvidia-smi-xq.txt
if type -p strings &>/dev/null;then
touch $debug_data_dir/strings-present
else
touch $debug_data_dir/strings-absent
fi
# leaving this commented out to remind that some systems do not
# support strings --version, but will just simply hang at that command
# which you can duplicate by simply typing: strings then hitting enter, you will get hang.
# strings --version &> $debug_data_dir/strings.txt
if type -p nvidia-smi &>/dev/null;then
nvidia-smi -q &> $debug_data_dir/nvidia-smi-q.txt
nvidia-smi -q -x &> $debug_data_dir/nvidia-smi-xq.txt
else
touch $debug_data_dir/nvidia-smi-absent
fi
head -n 1 /proc/asound/card*/codec* &> $debug_data_dir/proc-asound-card-codec.txt
ls /usr/bin/gcc* &> $debug_data_dir/gcc-sys-versions.txt
gcc --version &> $debug_data_dir/gcc-version.txt
cat /etc/issue &> $debug_data_dir/etc-issue.txt
@ -2872,7 +2882,7 @@ get_start_client()
Irc_Client_Path=$( readlink /proc/$PPID/exe )
# Irc_Client_Path=$( ps -p $PPID | gawk '!/[[:space:]]*PID/ {print $5}' )
# echo $( ps -p $PPID )
irc_client_path_lower=${Irc_Client_Path,,}
irc_client_path_lower=$( tr '[A-Z]' '[a-z]' <<< $Irc_Client_Path )
App_Working_Name=${irc_client_path_lower##*/}
# handles the xchat/sh/bash/dash cases, and the konversation/perl cases, where clients
# report themselves as perl or unknown shell. IE: when konversation starts inxi
@ -2884,7 +2894,7 @@ get_start_client()
pppid="$( ps -p $PPID -o ppid --no-headers | sed 's/[[:space:]]//g' )"
if [[ -n $pppid && -f /proc/$pppid/exe ]];then
Irc_Client_Path="$( readlink /proc/$pppid/exe )"
irc_client_path_lower=${Irc_Client_Path,,}
irc_client_path_lower=$( tr '[A-Z]' '[a-z]' <<< $Irc_Client_Path )
App_Working_Name=${irc_client_path_lower##*/}
B_Non_Native_App='true'
fi
@ -7743,12 +7753,12 @@ get_raid_component_data_bsd()
}
print raidLevel "," components
}' <<< "$zpool_status" )
# note: component_string is raid type AND components
array_string="$device,${a_raid_data[1]},$component_string,${a_raid_data[4]}"
array_string="$array_string,${a_raid_data[5]},${a_raid_data[6]},${a_raid_data[7]},${a_raid_data[8]}"
array_string="$array_string,${a_raid_data[9]},${a_raid_data[10]},${a_raid_data[11]},${a_raid_data[12]},"
array_string="$array_string${a_raid_data[13]},${a_raid_data[14]},${a_raid_data[15]}"
fi
# note: component_string is raid type AND components
array_string="$device,${a_raid_data[1]},$component_string,${a_raid_data[4]}"
array_string="$array_string,${a_raid_data[5]},${a_raid_data[6]},${a_raid_data[7]},${a_raid_data[8]}"
array_string="$array_string,${a_raid_data[9]},${a_raid_data[10]},${a_raid_data[11]},${a_raid_data[12]},"
array_string="$array_string${a_raid_data[13]},${a_raid_data[14]},${a_raid_data[15]}"
IFS=","
A_RAID_DATA[i]=$array_string
IFS="$ORIGINAL_IFS"
@ -9296,15 +9306,15 @@ print_audio_data()
# print the line
else
# keep the driver on the same line no matter what, looks weird alone on its own line
if [[ $B_EXTRA_DATA != 'true' ]];then
print_data=$( create_print_line "$line_starter" "$card_string$audio_data${CN}" )
print_screen_output "$print_data"
else
if [[ $( calculate_line_length "$card_string$audio_data" ) -gt $COLS_INNER ]];then
print_data=$( create_print_line "$line_starter" "$card_string${CN}" )
print_screen_output "$print_data"
line_starter=' '
print_data=$( create_print_line "$line_starter" "$audio_data${CN}" )
print_screen_output "$print_data"
else
print_data=$( create_print_line "$line_starter" "$card_string$audio_data${CN}" )
print_screen_output "$print_data"
fi
fi
line_starter=' '
@ -9312,7 +9322,10 @@ print_audio_data()
done
fi
if [[ -n $alsa_data ]];then
alsa_data=$( sed 's/ALSA/Advanced Linux Sound Architecture/' <<< $alsa_data )
if [[ $( calculate_line_length "${alsa_data/ALSA/Advanced Linux Sound Architecture}" ) -lt $COLS_INNER ]];then
# alsa_data=$( sed 's/ALSA/Advanced Linux Sound Architecture/' <<< $alsa_data )
alsa_data=${alsa_data/ALSA/Advanced Linux Sound Architecture}
fi
alsa_data=$( create_print_line "$line_starter" "$alsa_data${CN}" )
print_screen_output "$alsa_data"
fi
@ -9775,7 +9788,6 @@ print_hard_disk_data()
local hdd_serial=''
local dev_data='' size_data='' hdd_model='' usb_data='' hdd_name='' divisor=5
local Line_Starter='Drives:' # inherited by print_optical_drives
# load A_HDD_DATA
get_hdd_data_basic
## note: if hdd_model is declared prior to use, whatever string you want inserted will
@ -9787,10 +9799,11 @@ print_hard_disk_data()
local hdd_capacity="${a_hdd_basic_working[0]}"
local hdd_used=${a_hdd_basic_working[1]}
local bsd_unsupported='Hard drive data not yet supported for BSD systems.'
local hdd_name_temp=''
local hdd_name_temp='' part_1_data='' part_2_data=''
local row_starter="${C1}HDD Total Size$SEP3${C2} $hdd_capacity ($hdd_used) "
if [[ $B_SHOW_BASIC_DISK == 'true' || $B_SHOW_DISK == 'true' ]];then
## note: the output part of this should be in the print hdd data function, not here
## note: the output part of this should be in the print hdd data function, not here
get_hard_drive_data_advanced
for (( i=0; i < ${#A_HDD_DATA[@]} - 1; i++ ))
do
@ -9832,41 +9845,63 @@ print_hard_disk_data()
else
hdd_name_temp='N/A'
fi
# echo "loop: $i"
hdd_name="${C1}model$SEP3${C2} $hdd_name_temp"
hdd_string="$usb_data$dev_data$hdd_name$size_data$hdd_serial$hdd_temp_data"
hdd_model="$hdd_model${C1}$(($i+1))$SEP3${C2} $hdd_string "
#hdd_model="$hdd_model${C1}$(($i+1))$SEP3${C2} $hdd_string "
part_1_data="$hdd_model${C1}$(($i+1))$SEP3${C2} $hdd_string "
# printing line one, then new lines according to $divisor setting, and after, if leftovers, print that line.
case $i in
0)
if [[ $divisor -eq 1 ]];then
hdd_data=$( create_print_line "$Line_Starter" "${C1}HDD Total Size$SEP3${C2} $hdd_capacity ($hdd_used)" )
print_screen_output "$hdd_data"
Line_Starter=' '
hdd_data=$( create_print_line "$Line_Starter" "$hdd_model" )
print_screen_output "$hdd_data"
hdd_model=''
else
hdd_data=$( create_print_line "$Line_Starter" "${C1}HDD Total Size$SEP3${C2} $hdd_capacity ($hdd_used) $hdd_model" )
print_screen_output "$hdd_data"
hdd_model=''
Line_Starter=' '
fi
;;
*)
# using modulus here, if divisible by $divisor, print line, otherwise skip
if [[ $(( $i % $divisor )) -eq 0 ]];then
hdd_data=$( create_print_line "$Line_Starter" "$hdd_model" )
print_screen_output "$hdd_data"
hdd_model=''
Line_Starter=' '
fi
;;
esac
if [[ $i -eq 0 ]];then
if [[ $( calculate_line_length "$row_starter$part_1_data" ) -gt $COLS_INNER ]];then
hdd_data=$( create_print_line "$Line_Starter" "$row_starter" )
print_screen_output "$hdd_data"
#echo 0
Line_Starter=' '
row_starter=''
hdd_data=$( create_print_line "$Line_Starter" "$part_1_data" )
print_screen_output "$hdd_data"
part_1_data=''
#echo 1
else
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_1_data" )
print_screen_output "$hdd_data"
Line_Starter=' '
row_starter=''
part_1_data=''
#echo 2
fi
fi
if [[ $( calculate_line_length "$row_starter$part_2_data$part_1_data" ) -gt $COLS_INNER ]];then
if [[ -n $( grep -vE '^[[:space:]]*$' <<< $part_2_data ) ]];then
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_2_data" )
print_screen_output "$hdd_data"
#echo 3
Line_Starter=' '
row_starter=''
part_2_data=''
fi
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_1_data" )
print_screen_output "$hdd_data"
part_1_data=''
#echo 4
elif [[ -n $part_2_data && \
$( calculate_line_length "$row_starter$part_2_data$part_1_data" ) -le $COLS_INNER ]];then
hdd_data=$( create_print_line "$Line_Starter" "$row_starter$part_2_data$part_1_data" )
print_screen_output "$hdd_data"
#echo 3
Line_Starter=' '
row_starter=''
part_1_data=''
part_2_data=''
else
part_2_data=$part_1_data
fi
done
# then print any leftover items
if [[ -n $hdd_model ]];then
hdd_data=$( create_print_line "$Line_Starter" "$hdd_model${CN}" )
if [[ -n $part_2_data ]];then
hdd_data=$( create_print_line "$Line_Starter" "$part_2_data" )
print_screen_output "$hdd_data"
#echo 5
fi
# temporary message to indicate not yet supported
if [[ $BSD_TYPE == 'bsd' ]];then
@ -9877,7 +9912,7 @@ print_hard_disk_data()
fi
else
# temporary message to indicate not yet supported
hdd_data="${C1}HDD Total Size$SEP3${C2} $hdd_capacity ($hdd_used)"
hdd_data="$row_starter"
if [[ $BSD_TYPE == 'bsd' ]];then
hdd_data=$bsd_unsupported
fi
@ -10218,7 +10253,7 @@ print_module_version()
if [[ -z $( grep -E '^snd' <<< $modules ) ]];then
prefix='snd_' # sound modules start with snd_
fi
modules=${modules,,}
modules=$( tr '[A-Z]' '[a-z]' <<< "$modules" )
modules=${modules//-/_}
# special intel processing, generally no version info though
if [[ $modules == 'hda intel' ]];then
@ -10248,7 +10283,7 @@ print_networking_data()
local i='' card_id='' network_data='' a_network_working='' port_data='' driver_data=''
local card_string='' port_plural='' module_version='' pci_bus_id='' bus_usb_text=''
local bus_usb_id='' line_starter='Network:' card_string='' card_data='' chip_id=''
local driver=''
local driver='' part_2_data=''
# set A_NETWORK_DATA
if [[ $BSD_TYPE == 'bsd' ]];then
if [[ $B_PCICONF_SET == 'false' ]];then
@ -10278,6 +10313,7 @@ print_networking_data()
port_data=''
port_plural=''
chip_id=''
part_2_data=''
if [[ ${#A_NETWORK_DATA[@]} -gt 1 ]];then
card_id="-$(( $i + 1 ))"
@ -10324,16 +10360,30 @@ print_networking_data()
fi
fi
card_string="${C1}Card$card_id$SEP3${C2} ${a_network_working[0]} "
card_data="$driver_data$port_data$pci_bus_id$chip_id"
if [[ $( calculate_line_length "$card_string$card_data" ) -gt $COLS_INNER ]];then
network_data=$( create_print_line "$line_starter" "$card_string${CN}" )
card_data="$driver_data$port_data"
part_2_data="$pci_bus_id$chip_id"
if [[ $( calculate_line_length "$card_string$card_data$part_2_data" ) -gt $COLS_INNER ]];then
network_data=$( create_print_line "$line_starter" "$card_string" )
line_starter=' '
card_string=''
print_screen_output "$network_data"
fi
network_data=$( create_print_line "$line_starter" "$card_string$card_data${CN}" )
line_starter=' '
print_screen_output "$network_data"
if [[ $( calculate_line_length "$card_string$card_data$part_2_data" ) -gt $COLS_INNER ]];then
network_data=$( create_print_line "$line_starter" "$card_string$card_data" )
print_screen_output "$network_data"
line_starter=' '
card_data=''
card_string=''
fi
if [[ -n $card_string$card_data$part_2_data ]];then
network_data=$( create_print_line "$line_starter" "$card_string$card_data$part_2_data" )
print_screen_output "$network_data"
line_starter=' '
card_data=''
card_string=''
part_2_data=''
fi
if [[ $B_SHOW_ADVANCED_NETWORK == 'true' ]];then
print_network_advanced_data
fi
@ -10353,7 +10403,7 @@ print_network_advanced_data()
{
eval $LOGFS
local network_data='' if_id='N/A' duplex='N/A' mac_id='N/A' speed='N/A' oper_state='N/A'
local b_is_wifi='false' speed_string='' duplex_string=''
local b_is_wifi='false' speed_string='' duplex_string='' part_2_data=''
# first check if it's a known wifi id'ed card, if so, no print of duplex/speed
if [[ -n $( grep -Esi '(wireless|wifi|wi-fi|wlan|802\.11|centrino)' <<< ${a_network_working[0]} ) ]];then
@ -10390,9 +10440,18 @@ print_network_advanced_data()
mac_id=${a_network_working[9]}
fi
fi
network_data="${C1}IF$SEP3${C2} $if_id ${C1}state$SEP3${C2} $oper_state $speed_string$duplex_string${C1}mac$SEP3${C2} $mac_id"
network_data=$( create_print_line " " "$network_data${CN}" )
print_screen_output "$network_data"
network_data="${C1}IF$SEP3${C2} $if_id ${C1}state$SEP3${C2} $oper_state $speed_string$duplex_string"
part_2_data="${C1}mac$SEP3${C2} $mac_id"
if [[ $( calculate_line_length "$network_data$part_2_data" ) -gt $COLS_INNER ]];then
network_data=$( create_print_line " " "$network_data${CN}" )
print_screen_output "$network_data"
network_data=''
fi
if [[ -n $network_data$part_2_data ]];then
network_data=$( create_print_line " " "$network_data$part_2_data${CN}" )
print_screen_output "$network_data"
network_data=''
fi
eval $LOGFE
}
@ -10401,10 +10460,9 @@ print_networking_ip_data()
{
eval $LOGFS
local ip=$( get_networking_wan_ip_data )
local wan_ip_data='' a_interfaces_working='' interfaces='' i=''
local wan_ip_data='' a_interfaces_working='' interfaces='' i=0
local if_id='' if_ip='' if_ipv6='' if_ipv6_string='' full_string='' if_string=''
local if_id_string='' if_ip_string=''
local line_max=$(( $COLS_INNER - 40 ))
local if_id_string='' if_ip_string='' if_string_holding=''
# set A_INTERFACES_DATA
get_networking_local_ip_data
@ -10451,19 +10509,37 @@ print_networking_ip_data()
if [[ -n ${a_interfaces_working[0]} ]];then
if_id=${a_interfaces_working[0]}
fi
if_string="$wan_ip_data$if_string${C1}IF$SEP3${C2} $if_id$if_ip_string$if_ipv6_string "
wan_ip_data=''
if [[ $( calculate_line_length "$if_string" ) -gt $line_max ]];then
full_string=$( create_print_line " " "$if_string${CN}" )
print_screen_output "$full_string"
if_string=''
if_string="${C1}IF$SEP3${C2} $if_id$if_ip_string$if_ipv6_string "
# first line, print wan on its own line if too long
if [[ $i -eq 0 ]];then
if [[ $( calculate_line_length "$wan_ip_data$if_string" ) -gt $COLS_INNER ]];then
full_string=$( create_print_line " " "$wan_ip_data${CN}" )
print_screen_output "$full_string"
wan_ip_data=''
full_string=$( create_print_line " " "$if_string${CN}" )
print_screen_output "$full_string"
if_string=''
else
full_string=$( create_print_line " " "$wan_ip_data$if_string${CN}" )
print_screen_output "$full_string"
wan_ip_data=''
if_string=''
fi
else
if [[ $( calculate_line_length "$if_string_holding$if_string" ) -lt $COLS_INNER ]];then
if_string_holding="$if_string_holding$if_string"
else
full_string=$( create_print_line " " "$if_string_holding${CN}" )
print_screen_output "$full_string"
if_string_holding="$if_string"
fi
fi
((i++))
done
# then print out anything not printed already
if [[ -n $if_string ]];then
full_string=$( create_print_line " " "$if_string${CN}" )
if [[ -n $if_string_holding ]];then
full_string=$( create_print_line " " "$if_string_holding${CN}" )
print_screen_output "$full_string"
fi
eval $LOGFE