+ A_PARTITION_DATA[i]=${a_partition_working[0]}","${a_partition_working[1]}","${a_partition_working[2]}","${a_partition_working[3]}","${a_partition_working[4]}","${a_partition_working[5]}","$dev_item","$dev_label","$dev_uuid
+ IFS="$ORIGINAL_IFS"
+ done
+ log_function_data 'cat' "$FILE_MOUNTS"
+ fi
+ log_function_data "A_PARTITION_DATA: ${A_PARTITION_DATA[@]}"
+ eval $LOGFE
+}
+
+
+# args: $1 - uuid/label
+get_partition_uuid_label_data()
+{
+ eval $LOGFS
+
+ # only run these tests once per directory to avoid excessive queries to fs
+ case $1 in
+ label)
+ if [[ $B_LABEL_SET != 'true' ]];then
+ if [[ -d /dev/disk/by-label ]];then
+ DEV_DISK_LABEL="$( ls -l /dev/disk/by-label )"
+ fi
+ B_LABEL_SET='true'
+ fi
+ ;;
+ uuid)
+ if [[ $B_UUID_SET != 'true' ]];then
+ if [[ -d /dev/disk/by-uuid ]];then
+ DEV_DISK_UUID="$( ls -l /dev/disk/by-uuid )"
+ fi
+ B_UUID_SET='true'
+ fi
+ ;;
+ esac
+ log_function_data 'raw' "DEV_DISK_LABEL:\n$DEV_DISK_LABEL\n\nDEV_DISK_UUID:\n$DEV_DISK_UUID"
+ # debugging section, uncomment to insert user data
+# DEV_DISK_LABEL='
+#
+# '
+# DEV_DISK_UUID='
+#
+# '
+ eval $LOGFE
+}
+
+# args: $1 - type cpu/mem
+get_ps_data()
+{
+ eval $LOGFS
+ local array_length='' reorder_temp='' i=0 head_tail='' sort_type=''
+
+ # bummer, have to make it more complex here because of reverse sort
+ # orders in output, pesky lack of support of +rss in old systems
+ case $1 in
+ mem)
+ head_tail='head'
+ sort_type='-rss'
+ ;;
+ cpu)
+ head_tail='tail'
+ sort_type='%cpu'
+ ;;
+ esac
+
+ # throttle potential irc abuse
+ if [[ $B_RUNNING_IN_SHELL != 'true' && $PS_COUNT -gt 5 ]];then
+ PS_THROTTLED=$PS_COUNT
+ PS_COUNT=5
+ fi
+
+ IFS=$'\n'
+ # note that inxi can use a lot of cpu, and can actually show up here as the script runs
+ A_PS_DATA=( $( ps aux --sort $sort_type | grep -Ev "($SCRIPT_NAME|%CPU|[[:space:]]ps[[:space:]])" | $head_tail -n $PS_COUNT | gawk '
+ BEGIN {
+ IGNORECASE=1
+ appName=""
+ appPath=""
+ appStarterName=""
+ appStarterPath=""
+ cpu=""
+ mem=""
+ pid=""
+ user=""
+ rss=""
+ }
+ {
+ cpu=$3
+ mem=$4
+ pid=$2
+ user=$1
+ rss=sprintf( "%.2f", $6/1024 )
+ # have to get rid of [,],(,) eg: [lockd] which break the printout function compare in bash
+ gsub(/\[|\]|\(|\)/,"~", $0 )
+ if ( $12 ~ /^\// ){
+ appStarterPath=$11
+ appPath=$12
+ }
+ else {
+ appStarterPath=$11
+ appPath=$11
+ }
+ appStarterName=gensub( /(\/.*\/)(.*)/, "\\2", "1", appStarterPath )
+ appName=gensub( /(\/.*\/)(.*)/, "\\2", "1", appPath )
+ print appName "," appPath "," appStarterName "," appStarterPath "," cpu "," mem "," pid "," rss "," user
+ }
+ ' ) )
+ # make the array ordered highest to lowest so output looks the way we expect it to
+ # this isn't necessary for -rss, and we can't make %cpu ordered the other way, so
+ # need to reverse it here. -rss is used because on older systems +rss is not supported
+ if [[ $1 == 'cpu' ]];then
+ array_length=${#A_PS_DATA[@]};
+ while (( $i < $array_length/2 ))
+ do
+ reorder_temp=${A_PS_DATA[i]}f
+ A_PS_DATA[i]=${A_PS_DATA[$array_length-$i-1]}
+ A_PS_DATA[$array_length-$i-1]=$reorder_temp
+ (( i++ ))
+ done
+ fi
+
+ IFS="$ORIGINAL_IFS"
+
+# echo ${A_PS_DATA[@]}
+ eval $LOGFE
+}
+
+# Repos will be added as we get distro package manager data to create the repo data.
+# This method will output the file name also, which is useful to create output that's
+# neat and readable.
+get_repo_data()
+{
+ eval $LOGFS
+ local repo_file='' repo_data_working='' repo_data_working2='' repo_line=''
+ local apt_file='/etc/apt/sources.list' yum_repo_dir='/etc/yum.repos.d/' yum_conf='/etc/yum.conf'
+ local pacman_conf='/etc/pacman.conf' pacman_repo_dir='/etc/pacman.d/' pisi_dir='/etc/pisi/'
+
+ # apt - debian, buntus
+ if [[ -f $apt_file || -d $apt_file.d ]];then
+ REPO_DATA="$( grep -Esv '(^[[:space:]]*$|^[[:space:]]*#)' $apt_file $apt_file.d/*.list )"
+ REPO_FILE_ID='apt sources'
+ # yum - fedora, redhat, centos, etc
+ elif [[ -d $yum_repo_dir || -f $yum_conf ]];then
+ # older redhats put their yum data in /etc/yum.conf
+ for repo_file in $( ls $yum_repo_dir*.repo $yum_conf 2>/dev/null )
+ do
+ repo_data_working="$( gawk -v repoFile=$repo_file '
+ # construct the string for the print function to work with, file name: data
+ function print_line( fileName, repoId, repoUrl ){
+ print fileName ":" repoId repoUrl
+ }
+ BEGIN {
+ FS="\n"
+ IGNORECASE=1
+ enabledStatus=""
+ repoTitle=""
+ urlData=""
+ }
+ # this is a hack, assuming that each item has these fields listed, we collect the 3
+ # items one by one, then when the url/enabled fields are set, we print it out and
+ # reset the data. Not elegant but it works. Note that if enabled was not present
+ # we assume it is enabled then, and print the line, reset the variables. This will
+ # miss the last item, so it is printed if found in END
+ /^\[.+\]/ {
+ if ( urlData != "" && repoTitle != "" ){
+ print_line( repoFile, repoTitle, urlData )
+ enabledStatus=""
+ urlData=""
+ repoTitle=""
+ }
+ gsub( /\[|\]/, "", $1 ) # strip out the brackets
+ repoTitle = $1 " ~ "
+ }
+ /^(mirrorlist|baseurl)/ {
+ sub( /(mirrorlist|baseurl)=/, "", $1 ) # strip out the field starter
+ urlData = $1
+ }
+ /^enabled=/ {
+ enabledStatus = $1
+ }
+ # print out the line if all 3 values are found, otherwise if a new
+ # repoTitle is hit above, it will print out the line there instead
+ {
+ if ( urlData != "" && enabledStatus != "" && repoTitle != "" ){
+ if ( enabledStatus !~ /enabled=0/ ){
+ print_line( repoFile, repoTitle, urlData )
+ }
+ enabledStatus=""
+ urlData=""
+ repoTitle=""
+ }
+ }
+ END {
+ # print the last one if there is data for it
+ if ( urlData != "" && repoTitle != "" ){
+ print_line( repoFile, repoTitle, urlData )
+ }
+ }
+ ' $repo_file )"
+
+ # then load the global for each file as it gets filled
+ if [[ -n $repo_data_working ]];then
+ if [[ -z $REPO_DATA ]];then
+ REPO_DATA="$repo_data_working"
+ else
+ REPO_DATA="$REPO_DATA
+$repo_data_working"
+ fi
+ repo_data_working=''
+ fi
+ done
+ REPO_FILE_ID='yum repos'
+ # pisi - pardus
+ elif [[ -d $pisi_dir && -n $( type -p pisi ) ]];then
+ REPO_DATA="$( pisi list-repo )"
+ # now we need to create the structure: repo info: repo path
+ # we do that by looping through the lines of the output and then
+ # putting it back into the <data>:<url> format print repos expects to see
+ while read repo_line
+ do
+ repo_line=$( gawk '
+ {
+ # need to dump leading/trailing spaces and clear out color codes for irc output
+ sub(/^[[:space:]]+|[[:space:]]+$/,"",$0)
+# gsub(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/,"",$0) # leaving this pattern in case need it
+ gsub(/\e\[([0-9];)?[0-9]+m/,"",$0)
+ print $0
+ }' <<< $repo_line )
+ if [[ -n $( grep '://' <<< $repo_line ) ]];then
+ repo_data_working="$repo_data_working:$repo_line\n"
+ else
+ repo_data_working="$repo_data_working$repo_line"
+ fi
+ done <<< "$REPO_DATA"
+ # echo and execute the line breaks inserted
+ REPO_DATA="$( echo -e $repo_data_working )"
+ REPO_FILE_ID='pisi repo'
+ # pacman - archlinux
+ elif [[ -f $pacman_conf ]];then
+ # get list of mirror include files, trim white space off ends
+ repo_data_working="$( gawk '
+ BEGIN {
+ FS="="
+ IGNORECASE=1
+ }
+ /^[[:space:]]*Include/ {
+ sub(/^[[:space:]]+|[[:space:]]+$/,"",$2)
+ print $2
+ }
+ ' $pacman_conf )"
+ # sort into unique paths only, to be used to search for server = data
+ repo_data_working=$( sort -bu <<< "$repo_data_working" | uniq )
+ repo_data_working="$repo_data_working $pacman_conf"
+ for repo_file in $repo_data_working
+ do
+ if [[ -f $repo_file ]];then
+ # inserting a new line after each found / processed match
+ repo_data_working2="$repo_data_working2$( gawk -v repoFile=$repo_file '
+ BEGIN {
+ FS="="
+ IGNORECASE=1
+ }
+ /^[[:space:]]*Server/ {
+ sub(/^[[:space:]]+|[[:space:]]+$/,"",$2)
+ print repoFile ":" $2 "\\n"
+ }
+ ' $repo_file )"
+ else
+ echo "Error: file listed in $pacman_conf does not exist - $repo_file"
+ fi
+ done
+ # execute line breaks
+ REPO_DATA="$( echo -e $repo_data_working2 )"
+ REPO_FILE_ID='arch repo servers'
+ fi
+ eval $LOGFE
+}
+
+get_runlevel_data()
+{
+ eval $LOGFS
+ local runlvl=''
+ local runlevel_path=$( type -p runlevel )
+ if [[ -n $runlevel_path ]];then
+ runlvl="$( $runlevel_path | gawk '{ print $2 }' )"
+ fi
+ echo $runlvl
+ eval $LOGFE
+}
+
+get_sensors_data()
+{
+ eval $LOGFS
+
+ local sensors_path=$( type -p sensors )
+
+ IFS=$'\n'
+ if [[ -n $sensors_path ]];then
+ # note: non-configured sensors gives error message, which we need to redirect to stdout
+ # also, -F ':' no space, since some cases have the data starting right after,like - :1287
+ A_SENSORS_DATA=( $(
+ $sensors_path | gawk -F ':' -v userCpuNo="$SENSORS_CPU_NO" '
+ BEGIN {
+ IGNORECASE=1
+ core0Temp="" # only if all else fails...
+ cpuTemp=""
+ cpuTempReal=""
+ fanWorking=""
+ indexCountaFanMain=0
+ indexCountaFanDefault=0
+ i=""
+ j=""
+ moboTemp=""
+ moboTempReal=""
+ psuTemp=""
+ separator=""
+ sysFanString=""
+ temp1=""
+ temp2=""
+ tempFanType="" # set to 1 or 2
+ tempUnit=""
+ tempWorking=""
+ tempWorkingUnit=""
+ }
+ # dumping the extra + signs after testing for them, nobody has negative temps.
+ # also, note gawk treats ° as a space, so we have to get the C/F data
+ # there are some guesses here, but with more sensors samples it will get closer.
+ # note: using arrays starting at 1 for all fan arrays to make it easier overall
+ # more validation because gensub if fails to get match returns full string, so
+ # we have to be sure we are working with the actual real string before assiging
+ # data to real variables and arrays. Extracting C/F degree unit as well to use
+ # when constructing temp items for array.
+ # note that because of charset issues, no tempUnit="°" tempWorkingUnit degree sign
+ # used, but it is required in testing regex to avoid error.
+ /^(M\/B|MB|SIO|SYS)(.*)\+([0-9]+)(.*)[ \t°](C|F)/ && $2 ~ /^[ \t]*\+([0-9]+)/ {
+ moboTemp=gensub( /[ \t]+\+([0-9\.]*)(.*)/, "\\1", 1, $2 )
+ tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 )
+ if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){
+ tempUnit=tempWorkingUnit
+ }
+ }
+ /^CPU(.*)\+([0-9]+)(.*)[ \t°](C|F)/ && $2 ~ /^[ \t]*\+([0-9]+)/ {
+ cpuTemp=gensub( /[ \t]+\+([0-9\.]+)(.*)/, "\\1", 1, $2 )
+ tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 )
+ if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){
+ tempUnit=tempWorkingUnit
+ }
+ }
+ /^(P\/S|Power)(.*)\+([0-9]+)(.*)[ \t°](C|F)/ && $2 ~ /^[ \t]*\+([0-9]+)/ {
+ psuTemp=gensub( /[ \t]+\+([0-9\.]+)(.*)/, "\\1", 1, $2 )
+ tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 )
+ if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){
+ tempUnit=tempWorkingUnit
+ }
+ }
+ $1 ~ /^temp1$/ && $2 ~ /^[ \t]*\+([0-9]+)/ {
+ tempWorking=gensub( /[ \t]+\+([0-9\.]+)(.*)/, "\\1", 1, $2 )
+ if ( temp1 == "" || tempWorking > 0 ) {
+ temp1=tempWorking
+ }
+ tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 )
+ if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){
+ tempUnit=tempWorkingUnit
+ }
+ }
+ $1 ~ /^temp2$/ && $2 ~ /^[ \t]*\+([0-9]+)/ {
+ tempWorking=gensub( /[ \t]+\+([0-9\.]+)(.*)/, "\\1", 1, $2 )
+ if ( temp2 == "" || tempWorking > 0 ) {
+ temp2=tempWorking
+ }
+ tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 )
+ if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){
+ tempUnit=tempWorkingUnit
+ }
+ }
+
+ # final fallback if all else fails, funtoo user showed sensors putting
+ # temp on wrapped second line, not handled
+ /^(core0|core 0)(.*)\+([0-9]+)(.*)[ \t°](C|F)/ && $2 ~ /^[ \t]*\+([0-9]+)/ {
+ tempWorking=gensub( /[ \t]+\+([0-9\.]+)(.*)/, "\\1", 1, $2 )
+ if ( core0Temp == "" || tempWorking > 0 ) {
+ core0Temp=tempWorking
+ }
+ tempWorkingUnit=gensub( /[ \t]+\+([0-9\.]+)[ \t°]+([CF])(.*)/, "\\2", 1, $2 )
+ if ( tempWorkingUnit ~ /^C|F$/ && tempUnit == "" ){
+ tempUnit=tempWorkingUnit
+ }
+ }
+
+ # note: can be cpu fan:, cpu fan speed:, etc. Some cases have no space before
+ # $2 starts (like so :1234 RPM), so skip that space test in regex
+ /^CPU(.*)[ \t]*([0-9]+)[ \t]RPM/ {
+ aFanMain[1]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
+ }
+ /^(M\/B|MB|SYS)(.*)[ \t]*([0-9]+)[ \t]RPM/ {
+ aFanMain[2]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
+ }
+ /(Power|P\/S|POWER)(.*)[ \t]*([0-9]+)[ \t]RPM/ {
+ aFanMain[3]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
+ }
+ # note that the counters are dynamically set for fan numbers here
+ # otherwise you could overwrite eg aux fan2 with case fan2 in theory
+ # note: cpu/mobo/ps are 1/2/3
+ # NOTE: test: ! i in array does NOT work, this appears to be an awk/gawk bug
+ /^(AUX(1)? |CASE(1)? |CHASSIS(1)? )(.*)[ \t]*([0-9]+)[ \t]RPM/ {
+ for ( i = 4; i < 7; i++ ){
+ if ( i in aFanMain ){
+ ##
+ }
+ else {
+ aFanMain[i]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
+ break
+ }
+ }
+ }
+ /^(AUX([2-9]) |CASE([2-9]) |CHASSIS([2-9]) )(.*)[ \t]*([0-9]+)[ \t]RPM/ {
+ for ( i = 5; i < 30; i++ ){
+ if ( i in aFanMain ) {
+ ##
+ }
+ else {
+ sysFanNu = i
+ aFanMain[i]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
+ break
+ }
+ }
+ }
+ # in rare cases syntax is like: fan1: xxx RPM
+ /^(FAN(1)?[ \t:])(.*)[ \t]*([0-9]+)[ \t]RPM/ {
+ aFanDefault[1]=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
+ }
+ /^FAN([2-9]|1[0-9])(.*)[ \t]*([0-9]+)[ \t]RPM/ {
+ fanWorking=gensub( /[ \t]*([0-9]+)[ \t]+(.*)/, "\\1", 1, $2 )
+ sysFanNu=gensub( /fan([0-9]+)/, "\\1", 1, $1 )
+ if ( sysFanNu ~ /^([0-9]+)$/ ) {
+ # add to array if array index does not exist OR if number is > existing number
+ if ( sysFanNu in aFanDefault ) {
+ if ( fanWorking >= aFanDefault[sysFanNu] ) {
+ aFanDefault[sysFanNu]=fanWorking
+ }
+ }
+ else {
+ aFanDefault[sysFanNu]=fanWorking
+ }
+ }
+ }
+
+ END {
+ # first we need to handle the case where we have to determine which temp/fan to use for cpu and mobo:
+ # note, for rare cases of weird cool cpus, user can override in their prefs and force the assignment
+ if ( temp1 != "" && temp2 != "" ){
+ if ( userCpuNo != "" && userCpuNo ~ /(1|2)/ ) {
+ tempFanType=userCpuNo
+ }
+ else {
+ # first some fringe cases with cooler cpu than mobo: assume which is cpu temp based on fan speed
+ # but only if other fan speed is 0
+ if ( temp1 >= temp2 && 1 in aFanDefault && 2 in aFanDefault && aFanDefault[1] == 0 && aFanDefault[2] > 0 ) {
+ tempFanType=2
+ }
+ else if ( temp2 >= temp1 && 1 in aFanDefault && 2 in aFanDefault && aFanDefault[2] == 0 && aFanDefault[1] > 0 ) {
+ tempFanType=1
+ }
+ # then handle the standard case if these fringe cases are false
+ else if ( temp1 >= temp2 ) {
+ tempFanType=1
+ }
+ else {
+ tempFanType=2
+ }
+ }
+ }
+ # need a case for no temps at all reported, like with old intels
+ else if ( temp2 == "" && cpuTemp == "" ){
+ if ( temp1 == "" && moboTemp == "" ){
+ tempFanType=1
+ }
+ else if ( temp1 != "" && moboTemp == "" ){
+ tempFanType=1
+ }
+ else if ( temp1 != "" && moboTemp != "" ){
+ tempFanType=1
+ }
+ }
+
+ # then get the real cpu temp, best guess is hottest is real
+ if ( cpuTemp != "" ){
+ cpuTempReal=cpuTemp
+ }
+ else if ( tempFanType != "" ){
+ if ( tempFanType == 1 ){
+ cpuTempReal=temp1
+ }
+ else {
+ cpuTempReal=temp2
+ }
+ }
+ else {
+ cpuTempReal=temp1
+ }
+ # if all else fails, use core0 temp if it is present and cpu is null
+ if ( cpuTempReal == "" && core0Temp != "" ) {
+ cpuTempReal=core0Temp
+ }
+
+ # then the real mobo temp
+ if ( moboTemp != "" ){
+ moboTempReal=moboTemp
+ }
+ else if ( tempFanType != "" ){
+ if ( tempFanType == 1 ) {
+ moboTempReal=temp2
+ }
+ else {
+ moboTempReal=temp1
+ }
+ }
+ else {
+ moboTempReal=temp2
+ }
+ # then set the cpu fan speed
+ if ( aFanMain[1] == "" ) {
+ # note, you cannot test for aFanDefault[1] or [2] != ""
+ # because that creates an array item in gawk just by the test itself
+ if ( tempFanType == 1 && 1 in aFanDefault ) {
+ aFanMain[1]=aFanDefault[1]
+ aFanDefault[1]=""
+ }
+ else if ( tempFanType == 2 && 2 in aFanDefault ) {
+ aFanMain[1]=aFanDefault[2]
+ aFanDefault[2]=""
+ }
+ }
+
+ # then we need to get the actual numeric max array count for both fan arrays
+ for (i = 0; i <= 29; i++) {
+ if ( i in aFanMain && i > indexCountaFanMain ) {
+ indexCountaFanMain=i
+ }
+ }
+ for (i = 0; i <= 14; i++) {
+ if ( i in aFanDefault && i > indexCountaFanDefault ) {
+ indexCountaFanDefault=i
+ }
+ }
+
+ # clear out any duplicates. Primary fan real trumps fan working always if same speed
+ for (i = 1; i <= indexCountaFanMain; i++) {
+ if ( i in aFanMain && aFanMain[i] != "" && aFanMain[i] != 0 ) {
+ for (j = 1; j <= indexCountaFanDefault; j++) {
+ if ( j in aFanDefault && aFanMain[i] == aFanDefault[j] ) {
+ aFanDefault[j] = ""
+ }
+ }
+ }
+ }
+
+ # now see if you can find the fast little mobo fan, > 5000 rpm and put it as mobo
+ # note that gawk is returning true for some test cases when aFanDefault[j] < 5000
+ # which has to be a gawk bug, unless there is something really weird with arrays
+ # note: 500 > aFanDefault[j] < 1000 is the exact trigger, and if you manually
+ # assign that value below, the > 5000 test works again, and a print of the value
+ # shows the proper value, so the corruption might be internal in awk.
+ # Note: gensub is the culprit I think, assigning type string for range 501-1000 but
+ # type integer for all others, this triggers true for >
+ for (j = 1; j <= indexCountaFanDefault; j++) {
+ if ( j in aFanDefault && int( aFanDefault[j] ) > 5000 && aFanMain[2] == "" ) {
+ aFanMain[2] = aFanDefault[j]
+ aFanDefault[j] = ""
+ # then add one if required for output
+ if ( indexCountaFanMain < 2 ) {
+ indexCountaFanMain = 2
+ }
+ }
+ }
+
+ # then construct the sys_fan string for echo, note that iteration 1
+ # makes: fanDefaultString separator null, ie, no space or ,
+ for (j = 1; j <= indexCountaFanDefault; j++) {
+ fanDefaultString = fanDefaultString separator aFanDefault[j]
+ separator=","
+ }
+ separator="" # reset to null for next loop
+ # then construct the sys_fan string for echo
+ for (j = 1; j <= indexCountaFanMain; j++) {
+ fanMainString = fanMainString separator aFanMain[j]
+ separator=","
+ }
+
+ # and then build the temps:
+ if ( moboTempReal != "" ) {
+ moboTempReal = moboTempReal tempUnit
+ }
+ if ( cpuTempReal != "" ) {
+ cpuTempReal = cpuTempReal tempUnit
+ }
+
+ # if they are ALL null, print error message. psFan is not used in output currently
+ if ( cpuTempReal == "" && moboTempReal == "" && aFanMain[1] == "" && aFanMain[2] == "" && aFanMain[3] == "" && fanDefaultString == "" ) {
+ print "No active sensors found. Have you configured your sensors yet?"
+ }
+ else {
+ # then build array arrays:
+ print cpuTempReal "," moboTempReal "," psuTemp
+ # this is for output, a null print line does NOT create a new array index in bash
+ if ( fanMainString == "" ) {
+ fanMainString=","
+ }
+ print fanMainString
+ print fanDefaultString
+ }
+ }
+ '
+ ) )
+ # the error case needs to go here because we are setting special array delimiter ','
+ else
+ A_SENSORS_DATA=( "You do not have the sensors app installed." )
+ fi
+
+ IFS="$ORIGINAL_IFS"
+ log_function_data "A_SENSORS_DATA: ${A_SENSORS_DATA[@]}"
+# echo "A_SENSORS_DATA: ${A_SENSORS_DATA[@]}"
+ eval $LOGFE
+}
+
+get_unmounted_partition_data()
+{
+ eval $LOGFS
+ local a_unmounted_working='' mounted_partitions='' separator='' unmounted_fs=''
+ local dev_working='' uuid_working='' label_working=''
+
+ if [[ $B_PARTITIONS_FILE == 'true' ]];then
+ # set dev disk label/uuid data globals
+ get_partition_uuid_label_data 'label'
+ get_partition_uuid_label_data 'uuid'
+
+ # create list for slicing out the mounted partitions
+ for (( i=0; i < ${#A_PARTITION_DATA[@]}; i++ ))
+ do
+ IFS=","
+ a_unmounted_working=( ${A_PARTITION_DATA[i]} )
+ IFS="$ORIGINAL_IFS"
+ if [[ -n ${a_unmounted_working[6]} ]];then
+ mounted_partitions="$mounted_partitions$separator${a_unmounted_working[6]}"
+ separator='|'
+ fi
+ done
+
+ A_UNMOUNTED_PARTITION_DATA=( $( grep -Ev '('$mounted_partitions')' $FILE_PARTITIONS | gawk '
+ BEGIN {
+ IGNORECASE=1
+ }
+ # note that size 1 means it is a logical extended partition container
+ # lvm might have dm-1 type syntax
+ # need to exclude loop type file systems, squashfs for example
+ /[a-z][0-9]+$|dm-[0-9]+$/ && $3 != 1 && $NF !~ /loop/ {
+ size = sprintf( "%.2f", $3*1024/1000**3 )
+ print $4 "," size "G"
+ }' ) )
+
+ for (( i=0; i < ${#A_UNMOUNTED_PARTITION_DATA[@]}; i++ ))
+ do
+ IFS=","
+ a_unmounted_working=( ${A_UNMOUNTED_PARTITION_DATA[i]} )
+ IFS="$ORIGINAL_IFS"
+
+ label_working=$( grep -E "${a_unmounted_working[0]}$" <<< "$DEV_DISK_LABEL" | gawk '{
+ print $(NF - 2)
+ }' )
+ uuid_working=$( grep -E "${a_unmounted_working[0]}$" <<< "$DEV_DISK_UUID" | gawk '{
+ print $(NF - 2)
+ }' )
+ unmounted_fs=$( get_unmounted_partition_filesystem "/dev/${a_unmounted_working[0]}" )
+
+ IFS=","
+ A_UNMOUNTED_PARTITION_DATA[i]=${a_unmounted_working[0]}","${a_unmounted_working[1]}","$label_working","$uuid_working","$unmounted_fs