diff --git a/inxi b/inxi index 3230c2c..839fbf4 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.1.4 -#### Date: 31 July 2009 +#### version: 1.1.5 +#### Date: August 2 2009 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -1220,6 +1220,8 @@ show_options() print_screen_output " 5 - For multicore systems, also show per core clock speeds; shows audio card." print_screen_output "-x Show extra data: bogomips on Cpu; driver version (if available) for Network/Audio;" print_screen_output " direct rendering status for Graphics (in X). Only works with verbose or line output." + print_screen_output " Shows hdd temp with disk data if you have hddtemp installed, if you are root OR if you " + print_screen_output " have added to /etc/sudoers: ALL = NOPASSWD: /usr/sbin/hddtemp (path to hddtemp)" print_screen_output "" print_screen_output "Additional Options:" print_screen_output "-h - this help menu." @@ -2597,6 +2599,25 @@ get_hard_drive_data_advanced() eval $LOGFE } +# a few notes, normally hddtemp requires root, but you can set user rights in /etc/sudoers. +# args: $1 - /dev/ to be tested for +get_hdd_temp_data() +{ + local hdd_temp='' sudo_command='' + + if [[ -n $( which hddtemp ) && -n $1 ]];then + # only use sudo if not root + if [[ $B_ROOT != 'true' ]];then + sudo_command='sudo -n ' + fi + # important: -n makes it non interactive, no prompt for password + hdd_temp=$( eval $sudo_command hddtemp -nq -u C $1 ) + if [[ -n $hdd_temp && -n $( grep -E '^([0-9]+)$' <<< $hdd_temp ) ]];then + echo $hdd_temp + fi + fi +} + get_lspci_data() { eval $LOGFS @@ -3841,7 +3862,7 @@ print_gfx_data() print_hard_disk_data() { eval $LOGFS - local hdd_data='' hdd_data_2='' a_hdd_working='' + local hdd_data='' hdd_data_2='' a_hdd_working='' hdd_temp_data='' local dev_data='' size_data='' hdd_model='' hdd_model_2='' hdd_model_3='' usb_data='' # load A_HDD_DATA @@ -3873,12 +3894,19 @@ print_hard_disk_data() dev_data="/dev/${a_hdd_working[0]} " size_data=" ${a_hdd_working[1]}" fi + + if [[ $B_EXTRA_DATA == 'true' && -n $dev_data ]];then + hdd_temp_data=$( get_hdd_temp_data "$dev_data" ) + # error handling is done in get data function + if [[ -n $hdd_temp_data ]];then + hdd_temp_data=" ${hdd_temp_data}C" + fi + fi # wrap to avoid long lines - if [[ $i -gt 1 && $B_SHOW_DISK == 'true' ]] || [[ $i -gt 3 ]];then - hdd_model_2="${hdd_model_2}${hdd_model_2+${C1}$(($i+1)):${C2}} $usb_data$dev_data${a_hdd_working[2]}$size_data " + hdd_model_2="${hdd_model_2}${hdd_model_2+${C1}$(($i+1)):${C2}} $usb_data$dev_data${a_hdd_working[2]}$size_data$hdd_temp_data " else - hdd_model="${hdd_model}${hdd_model+ ${C1}$(($i+1)):${C2}} $usb_data$dev_data${a_hdd_working[2]}$size_data" + hdd_model="${hdd_model}${hdd_model+ ${C1}$(($i+1)):${C2}} $usb_data$dev_data${a_hdd_working[2]}$size_data$hdd_temp_data" fi done if [[ -z $hdd_model ]];then