diff options
Diffstat (limited to 'inxi')
-rwxr-xr-x | inxi | 106 |
1 files changed, 72 insertions, 34 deletions
@@ -1,8 +1,8 @@ #!/usr/bin/env bash ######################################################################## #### Script Name: inxi -#### Version: 2.1.18 -#### Date: 2014-04-04 +#### Version: 2.1.20 +#### Date: 2014-04-08 #### Patch Number: 00 ######################################################################## #### SPECIAL THANKS @@ -630,7 +630,7 @@ main() { eval $LOGFS - local color_scheme='' + local color_scheme='' kde_config_app='' # this will be used by all functions following local Ps_aux_Data="$( ps aux )" @@ -685,18 +685,28 @@ main() DCTARGET="$2" ##dbus testing shift 2 fi - + # always have the current stable kde version tested first, + # then use fallbacks and future proofing + if type -p kde4-config &>/dev/null;then + kde_config_app='kde4-config' + elif type -p kde5-config &>/dev/null;then + kde_config_app='kde5-config' + elif type -p kde-config &>/dev/null;then + kde_config_app='kde-config' + fi # The section below is on request of Argonel from the Konversation developer team: # it sources config files like $HOME/.kde/share/apps/konversation/scripts/inxi.conf - IFS=":" - for kde_config in $( kde-config --path data ) - do - if [[ -r $kde_config$KONVI_CFG ]];then - source "$kde_config$KONVI_CFG" - break - fi - done - IFS="$ORIGINAL_IFS" + if [[ -n $kde_config_app ]];then + IFS=":" + for kde_config in $( $kde_config_app --path data ) + do + if [[ -r $kde_config$KONVI_CFG ]];then + source "$kde_config$KONVI_CFG" + break + fi + done + IFS="$ORIGINAL_IFS" + fi fi ## leave this for debugging dcop stuff if we get that working @@ -2868,7 +2878,7 @@ print_version_info() if [[ -n $script_symbolic_start ]];then print_screen_output "Started via symbolic link: $script_symbolic_start" fi - print_lines_basic "0" "" "Website:^http://inxi.goooglecode.com" + print_lines_basic "0" "" "Website:^http://inxi.googlecode.com" print_lines_basic "0" "" "IRC:^irc.oftc.net channel:^#smxi" print_lines_basic "0" "" "Forums:^http://techpatterns.com/forums/forum-33.html" print_screen_output " " @@ -3290,7 +3300,7 @@ set_perl_python_client_data() is_this_qt4_konvi() { local konvi_qt4_client='' konvi_dbus_exist='' konvi_pid='' konvi_home_dir='' - local konvi='' konvi_qt4_ver='' b_is_qt4='' + local konvi='' b_is_qt4='' # fringe cases can throw error, always if untested app, use 2>/dev/null after testing if present if [[ $B_QDBUS == 'true' ]];then @@ -3303,11 +3313,10 @@ is_this_qt4_konvi() konvi=$( echo $konvi_home_dir | sed "s/\// /g" ) konvi=($konvi) - if [[ ${konvi[2]} == 'konversation' ]];then - konvi_qt4_ver=$( konversation -v | grep -i 'konversation' ) + if [[ ${konvi[2]} == 'konversation' ]];then # note: we need to change this back to a single dot number, like 1.3, not 1.3.2 - konvi_qt4_client=$( echo "$konvi_qt4_ver" | gawk '{ print $2 }' | cut -d '.' -f 1,2 ) - + konvi_qt4_client=$( konversation -v | grep -i 'konversation' | \ + gawk '{ print $2 }' | cut -d '.' -f 1,2 ) if [[ $konvi_qt4_client > 1.1 ]]; then b_is_qt4='true' fi @@ -3673,6 +3682,8 @@ get_cpu_data() nr = 0 count = 0 bArm = "false" + # ARM cpus are erratic in /proc/cpuinfo this hack can sometimes resolve it. Linux only. + sysSpeed="'$(get_cpu_speed_hack)'" } # TAKE STRONGER NOTE: \t+ does NOT always work, MUST be [ \t]+ # TAKE NOTE: \t+ will work for $FILE_CPUINFO, but SOME ARBITRARY FILE used for TESTING might contain SPACES! @@ -3750,7 +3761,12 @@ get_cpu_data() # note: assuming bogomips for arm at 1 x clock # http://en.wikipedia.org/wiki/BogoMips ARM could change so watch this # maybe add: && bArm == "true" but I think most of the bogomips roughly equal cpu speed if not amd/intel - if ( cpu[i, "bogomips"] != "" && cpu[i, "speed"] == "" ) { + # 2014-04-08: trying to use sysSpeed hack first, that is more accurate anyway. + if ( ( cpu[i, "speed"] == "" && sysSpeed != "" ) || \ + ( cpu[i, "speed"] == "" && cpu[i, "bogomips"] != "" && cpu[i, "bogomips"] < 50 ) ) { + cpu[i, "speed"] = sysSpeed + } + else if ( cpu[i, "bogomips"] != "" && cpu[i, "speed"] == "" ) { cpu[i, "speed"] = cpu[i, "bogomips"] } print cpu[i, "model"] "," cpu[i, "speed"] "," cpu[i, "cache"] "," cpu[i, "flags"] "," cpu[i, "bogomips"] "," cpu[nr, "vendor"] "," bArm @@ -3770,8 +3786,9 @@ get_cpu_data() printf("%s %s\n", max, "Mhz") } } - } - ' $FILE_CPUINFO ) ) + } + ' $FILE_CPUINFO ) ) + IFS="$ORIGINAL_IFS" log_function_data 'cat' "$FILE_CPUINFO" elif [[ -n $BSD_TYPE ]];then @@ -3784,6 +3801,17 @@ get_cpu_data() eval $LOGFE # echo getMainCpu: ${[@]} } +# this triggers in one and only one case, ARM cpus that have fake bogomips data +get_cpu_speed_hack() +{ + local speed=$( cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 2>/dev/null ) + + if [[ -n $speed ]];then + speed=${speed%[0-9][0-9][0-9]} # trim off last 3 digits + fi + echo $speed +} + get_cpu_data_bsd() { @@ -4893,6 +4921,7 @@ get_gcc_system_version() log_function_data "A_GCC_VERSIONS: $a_temp" eval $LOGFE } + get_gpu_temp_data() { local gpu_temp='' gpu_fan='' screens='' screen_nu='' gpu_temp_looper='' @@ -9163,6 +9192,10 @@ print_short_data() local cpu_model="${a_cpu_working[0]}" ## assemble data for output local cpu_clock="${a_cpu_working[1]}" # old CPU3 + # echo $cpu_clock + # if [[ -z ${a_cpu_working[1]} || ${a_cpu_working[1]} < 50 ]];then + # a_cpu_working[1]=$(get_cpu_speed_hack) + # fi # 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]/.* Mhz/ Mhz} @@ -9368,7 +9401,7 @@ print_cpu_data() local a_cpu_working='' cpu_model='' cpu_clock='' cpu_null_error='' 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 cpu_2_data='' working_cpu='' temp1='' local line_starter="CPU:" multi_cpu_starter="${C1}Clock Speeds$SEP3${C2} " ##print_screen_output "A_CPU_DATA[0]=\"${A_CPU_DATA[0]}\"" @@ -9393,9 +9426,7 @@ print_cpu_data() cpu_model="${a_cpu_working[0]}" ## assemble data for output cpu_clock="${a_cpu_working[1]}" - cpu_vendor=${a_cpu_working[5]} - # set A_CPU_CORE_DATA get_cpu_core_count cpu_physical_count=${A_CPU_CORE_DATA[0]} @@ -9418,7 +9449,10 @@ print_cpu_data() # ARM may use the faked 1 cpucorecount to make this work # echo $cpu_core_count $cpu_physical_count if [[ -n ${a_cpu_working[4]} ]];then - bmip_data=$( calculate_multicore_data "${a_cpu_working[4]}" "$(( $cpu_core_count * $cpu_physical_count ))" ) + # new arm shows bad bogomip value, so don't use it + if [[ ${a_cpu_working[4]%.*} -gt 50 ]];then + bmip_data=$( calculate_multicore_data "${a_cpu_working[4]}" "$(( $cpu_core_count * $cpu_physical_count ))" ) + fi bmip_data=${bmip_data%.*} fi # else @@ -9451,7 +9485,6 @@ print_cpu_data() if [[ ${a_cpu_working[6]} == 'true' ]];then flag_feature='features' fi - cpu_flags="${C1}$flag_feature$SEP3${C2} $cpu_flags " fi fi @@ -9467,7 +9500,15 @@ print_cpu_data() if [[ ${#A_CPU_DATA[@]} -gt 2 && $B_SHOW_CPU == 'true' ]];then cpu_clock_speed='' # null < verbosity level 5 else - cpu_data="$cpu_data ${C1}clocked at${C2} ${a_cpu_working[1]%.*} MHz" + if [[ -z ${a_cpu_working[1]} ]];then + if [[ -z ${cpu_data/*ARM*/} ]];then + temp1=' (ARM)' + fi + a_cpu_working[1]="N/A$temp1" + else + a_cpu_working[1]="${a_cpu_working[1]%.*} MHz" + fi + cpu_clock_speed="${C1}clocked at${C2} ${a_cpu_working[1]}" fi cpu_2_data="$cpu_2_data$cpu_clock_speed" else @@ -10764,7 +10805,7 @@ print_partition_data() { eval $LOGFS local a_partition_working='' partition_used='' partition_data='' - local counter=0 i=0 a_partition_data='' line_starter='' line_max=$(( $COLS_INNER - 25 )) + local counter=0 i=0 part_id=0 a_partition_data='' line_starter='' local partitionIdClean='' part_dev='' full_dev='' part_label='' full_label='' local part_uuid='' full_uuid='' dev_remote='' full_fs='' local b_non_dev='false' holder='' @@ -10833,7 +10874,7 @@ print_partition_data() else partitionIdClean=${a_partition_working[0]} fi - id_size_fs="${C1}ID-$((counter+1))$SEP3${C2} $partitionIdClean ${C1}size$SEP3${C2} ${a_partition_working[1]} $partition_used$full_fs$full_dev" + id_size_fs="${C1}ID-$((part_id+1))$SEP3${C2} $partitionIdClean ${C1}size$SEP3${C2} ${a_partition_working[1]} $partition_used$full_fs$full_dev" label_uuid="$full_label$full_uuid" # label/uuid always print one per line, so only wrap if it's very long if [[ $B_SHOW_UUIDS == 'true' || $B_SHOW_LABELS == 'true' ]] && \ @@ -10851,10 +10892,7 @@ print_partition_data() fi fi ((counter++)) -# # because these lines can vary widely, using dynamic length handling here -# if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]] || [[ $( calculate_line_length "${a_partition_data[$counter]}" ) -gt $line_max ]];then -# ((counter++)) -# fi + ((part_id++)) fi done # print out all lines, line starter on first line |