diff options
author | Unit 193 <unit193@ubuntu.com> | 2014-03-31 17:41:36 -0400 |
---|---|---|
committer | Unit 193 <unit193@ubuntu.com> | 2014-03-31 17:41:36 -0400 |
commit | d129954ed952d6d01ae1181ce60729f11a447c81 (patch) | |
tree | 94992204dfc29222268a32c174e9a18b1038b6ba | |
parent | 20be4e31ac2b317af85be4e5022f3931b229ad6e (diff) | |
download | inxi-d129954ed952d6d01ae1181ce60729f11a447c81.tar.bz2 inxi-d129954ed952d6d01ae1181ce60729f11a447c81.tar.xz inxi-d129954ed952d6d01ae1181ce60729f11a447c81.tar.zst |
Imported Upstream version 2.1.13upstream/2.1.13
-rwxr-xr-x | inxi | 199 | ||||
-rwxr-xr-x | inxi.changelog | 27 |
2 files changed, 158 insertions, 68 deletions
@@ -1,8 +1,8 @@ #!/usr/bin/env bash ######################################################################## #### Script Name: inxi -#### Version: 2.1.11 -#### Date: 2014-03-26 +#### Version: 2.1.13 +#### Date: 2014-03-30 #### Patch Number: 00 ######################################################################## #### 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 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 @@ -1602,9 +1600,13 @@ debug_data_collector() 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 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 +2874,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 +2886,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 @@ -7613,13 +7615,20 @@ get_raid_data_bsd() { eval $LOGFS local zpool_path=$( type -p zpool 2>/dev/null ) - local zpool_data='' + local zpool_data='' zpool_arg='v' if [[ -n $zpool_path ]];then B_BSD_RAID='true' # bsd sed does not support inserting a true \n so use this trick - zpool_data="$( $zpool_path list -v | sed $SED_RX 's/^([^[:space:]])/\ + # some zfs does not have -v + if $zpool_path list -v &>/dev/null;then + zpool_data="$( $zpool_path list -v 2>/dev/null | sed $SED_RX 's/^([^[:space:]])/\ \1/' )" + else + zpool_data="$( $zpool_path list 2>/dev/null | sed $SED_RX 's/^([^[:space:]])/\ +\1/' )" + zpool_arg='no-v' + fi # echo "$zpool_data" IFS=$'\n' A_RAID_DATA=( $( @@ -7667,12 +7676,14 @@ get_raid_data_bsd() print raidString }' <<< "$zpool_data" ) ) IFS="$ORIGINAL_IFS" - get_raid_component_data_bsd + # pass the zpool type, so we know how to get the components + get_raid_component_data_bsd "$zpool_arg" fi eval $LOGFE } # note, we've already tested for zpool so no further tests required +# args: $1 - zpool type, v will have a single row output, no-v has stacked for components get_raid_component_data_bsd() { eval $LOGFS @@ -7692,24 +7703,54 @@ get_raid_component_data_bsd() zpool_status="$( zpool status $device )" # we will remove ONLINE for status and only use OFFLINE/DEGRADED as tests # for print output display of issues with components - for component in ${a_raid_data[3]} - do - component_status=$( gawk ' + # note: different zfs outputs vary, some have the components listed by line + if [[ $1 == 'v' ]];then + for component in ${a_raid_data[3]} + do + component_status=$( gawk ' + BEGIN { + IGNORECASE=1 + separator="" + } + $1 ~ /^'$component'$/ { + sub( /ONLINE/, "", $2 ) + print "'$component'" $2 + exit + }' <<< "$zpool_status" ) + component_string="$component_string$separator$component_status" + separator=' ' + done + array_string="$device,${a_raid_data[1]},${a_raid_data[2]},$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]}" + else + component_string=$( gawk ' BEGIN { IGNORECASE=1 - } - $1 ~ /^'$component'$/ { - sub( /ONLINE/, "", $2 ) - print "'$component'" $2 - exit + separator="" + components="" + raidLevel="" + } + $1 ~ /^'$device'$/ { + while ( getline && !/^$/ ) { + # raid level is the second item in the output + if ( $1 != "" && raidLevel == "" ) { + raidLevel="zfs " $1 + getline + } + sub( /ONLINE/, "", $2 ) + components=components separator $1 separator $2 + separator=" " + } + print raidLevel "," components }' <<< "$zpool_status" ) - component_string="$component_string$separator$component_status" - separator=' ' - done - array_string="$device,${a_raid_data[1]},${a_raid_data[2]},$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]}" + # 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 IFS="," A_RAID_DATA[i]=$array_string IFS="$ORIGINAL_IFS" @@ -9088,7 +9129,7 @@ print_short_data() local cpu_clock="${a_cpu_working[1]}" # old CPU3 # this gets that weird min/max final array item, which almost never contains any data of use local min_max_clock_nu=$(( ${#A_CPU_DATA[@]} - 1 )) - local min_max_clock=${A_CPU_DATA[$min_max_clock_nu]} + local min_max_clock=${A_CPU_DATA[$min_max_clock_nu]/.* Mhz/ Mhz} # this handles the case of for example ARM cpus, which will not have data for # min/max, since they don't have speed. Since that sets a flag, not found, just # look for that and use the speed from the first array array, same where we got @@ -9289,7 +9330,7 @@ print_cpu_data() local cpc_plural='' cpu_count_print='' model_plural='' cpu_data_string='' local cpu_physical_count='' cpu_core_count='' cpu_core_alpha='' cpu_type='' local cpu_2_data='' working_cpu='' - local line_starter="CPU$SEP3" multi_cpu_starter="${C1}Clock Speeds$SEP3${C2} " + local line_starter="CPU:" multi_cpu_starter="${C1}Clock Speeds$SEP3${C2} " ##print_screen_output "A_CPU_DATA[0]=\"${A_CPU_DATA[0]}\"" # Array A_CPU_DATA always has one extra element: max clockfreq found. @@ -9328,7 +9369,7 @@ print_cpu_data() cpu_count_print="$cpu_physical_count " model_plural='s' fi - line_starter="CPU$cpc_plural$SEP3" + line_starter="CPU$cpc_plural:" cpu_data_string="$cpu_count_print$cpu_core_alpha core" cpu_data="${C1}$cpu_data_string${C2} ${a_cpu_working[0]}$model_plural ($cpu_type)" if [[ $B_SHOW_CPU == 'true' ]];then @@ -9736,7 +9777,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 @@ -9748,10 +9788,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 @@ -9793,41 +9834,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 @@ -9838,7 +9901,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 @@ -10179,7 +10242,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 diff --git a/inxi.changelog b/inxi.changelog index 3d5d785..95cdb62 100755 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,4 +1,31 @@ ===================================================================================== +Version: 2.1.13 +Patch Version: 00 +Script Date: 2014-03-30 +----------------------------------- +Changes: +----------------------------------- +New version, only relevant to Porteus distro, a slackware derived distro, should now id it +correctly. No other changes. + +----------------------------------- +-- Harald Hope - Sun, 30 Mar 2014 11:54:12 -0700 + +===================================================================================== +Version: 2.1.12 +Patch Version: 00 +Script Date: 2014-03-27 +----------------------------------- +Changes: +----------------------------------- +new version, fixed zfs raid failure to report raid devices on some systems. Added wrapping +for -D disk option. Note that -d is not correctly wrapping because the lines are too long with +extra data, but it's ok for now. + +----------------------------------- +-- Harald Hope - Thu, 27 Mar 2014 15:33:33 -0700 + +===================================================================================== Version: 2.1.11 Patch Version: 00 Script Date: 2014-03-26 |