trying to add finch as a new irc client

This commit is contained in:
inxi-svn 2009-06-07 01:49:43 +00:00
parent 07d2d6d760
commit 36cf99d1a9

254
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.0.13-b2 #### version: 1.0.16-b1
#### Date: 28 May 2009 #### Date: 6 June 2009
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
######################################################################## ########################################################################
@ -119,6 +119,10 @@
#### -! 13 - triggers an update from svn branch three - if present, of course #### -! 13 - triggers an update from svn branch three - if present, of course
#### -! 14 - triggers an update from svn branch four - if present, of course #### -! 14 - triggers an update from svn branch four - if present, of course
#### -! <http://......> - Triggers an update from whatever server you list. #### -! <http://......> - Triggers an update from whatever server you list.
#### LOG FLAGS (logs to $HOME/.inxi/inxi.log with rotate 3 total)
#### -@ 8 - Basic data logging of generated data / array values
#### -@ 9 - Full logging of all data used, including cat of files and system data
#### -@ 10 - Basic data logging plus color code logging
######################################################################## ########################################################################
#### VARIABLES #### VARIABLES
######################################################################## ########################################################################
@ -161,6 +165,7 @@ B_EXTRA_DATA='false'
# override certain errors due to currupted data # override certain errors due to currupted data
B_HANDLE_CORRUPT_DATA='false' B_HANDLE_CORRUPT_DATA='false'
B_LOG_COLORS='false' B_LOG_COLORS='false'
B_LOG_FULL_DATA='false'
B_ROOT='false' B_ROOT='false'
# Running in a shell? Defaults to false, and is determined later. # Running in a shell? Defaults to false, and is determined later.
B_RUNNING_IN_SHELL='false' B_RUNNING_IN_SHELL='false'
@ -222,7 +227,7 @@ DIR_IFCONFIG='/sbin/ifconfig'
### Variable initializations: constants ### Variable initializations: constants
DCOPOBJ="default" DCOPOBJ="default"
DEBUG=0 # Set debug levels from 1-10 DEBUG=0 # Set debug levels from 1-10 (8-10 trigger logging levels)
# Debug Buffer Index, index into a debug buffer storing debug messages until inxi is 'all up' # Debug Buffer Index, index into a debug buffer storing debug messages until inxi is 'all up'
DEBUG_BUFFER_INDEX=0 DEBUG_BUFFER_INDEX=0
## note: the debugger rerouting to /dev/null has been moved to the end of the get_parameters function ## note: the debugger rerouting to /dev/null has been moved to the end of the get_parameters function
@ -234,7 +239,7 @@ DEFAULT_SCHEME=2
# Default indentation level # Default indentation level
INDENT=10 INDENT=10
# logging eval variables, start and end function: Insert to LOGFS LOGFE when debug level == 10 # logging eval variables, start and end function: Insert to LOGFS LOGFE when debug level >= 8
LOGFS_STRING='log_function_data fs $FUNCNAME "$( echo $@ )"' LOGFS_STRING='log_function_data fs $FUNCNAME "$( echo $@ )"'
LOGFE_STRING='log_function_data fe $FUNCNAME' LOGFE_STRING='log_function_data fe $FUNCNAME'
LOGFS='' LOGFS=''
@ -341,17 +346,19 @@ BAN_LIST_CPU=''
main() main()
{ {
eval $LOGFS eval $LOGFS
# first init function must be set first for colors etc. Remember, no debugger
# stuff works on this function unless you set the debugging flag manually.
# Debugging flag -@ [number] will not work until get_parameters runs.
# This function just initializes variables
initialize_script_data
# Check for dependencies BEFORE running ANYTHING else except above functions # Check for dependencies BEFORE running ANYTHING else except above functions
# Not all distro's have these depends installed by default # Not all distro's have these depends installed by default
check_script_depends check_script_depends
check_script_suggested_apps check_script_suggested_apps
# first init function must be set first for colors etc. Remember, no debugger
# stuff works on this function unless you set the debugging flag manually.
# Debugging flag -@ [number] will not work until get_parameters runs.
# This function just initializes variables
initialize_script_data
### Only continue if depends ok ### Only continue if depends ok
SCRIPT_PATH=$( dirname $0 ) SCRIPT_PATH=$( dirname $0 )
SCRIPT_VERSION_NUMBER=$( grep -im 1 'version:' $SCRIPT_PATH/$SCRIPT_NAME | gawk '{print $3}' ) SCRIPT_VERSION_NUMBER=$( grep -im 1 'version:' $SCRIPT_PATH/$SCRIPT_NAME | gawk '{print $3}' )
@ -753,11 +760,11 @@ script_debugger()
# NOTE: no logging available until get_parameters is run, since that's what sets logging # NOTE: no logging available until get_parameters is run, since that's what sets logging
# in order to trigger earlier logging manually set B_USE_LOGGING to true in top variables. # in order to trigger earlier logging manually set B_USE_LOGGING to true in top variables.
# $1 alone: logs data; $2 with or without $3 logs func start/end. # $1 alone: logs data; $2 with or without $3 logs func start/end.
# $1 type (fs/fe) or logged data; [$2 is $FUNCNAME; [$3 - function args]] # $1 type (fs/fe/cat/raw) or logged data; [$2 is $FUNCNAME; [$3 - function args]]
log_function_data() log_function_data()
{ {
if [ "$B_USE_LOGGING" == 'true' ];then if [ "$B_USE_LOGGING" == 'true' ];then
local logged_data='' spacer=" " local logged_data='' spacer=' ' line='----------------------------------------'
case $1 in case $1 in
fs) fs)
logged_data="Function: $2 - Primary: Start" logged_data="Function: $2 - Primary: Start"
@ -770,16 +777,30 @@ log_function_data()
logged_data="Function: $2 - Primary: End" logged_data="Function: $2 - Primary: End"
spacer='' spacer=''
;; ;;
cat)
if [[ $B_LOG_FULL_DATA == 'true' ]];then
logged_data="\n$line\nFull file data: cat $2\n\n$( cat $2 )\n$line\n"
spacer=''
fi
;;
raw)
if [[ $B_LOG_FULL_DATA == 'true' ]];then
logged_data="\n$line\nRaw system data:\n\n$2\n$line\n"
spacer=''
fi
;;
*) *)
logged_data="$1" logged_data="$1"
;; ;;
esac esac
# Create any required line breaks and strip out escape color code, either ansi (case 1)or irc (case 2). # Create any required line breaks and strip out escape color code, either ansi (case 1)or irc (case 2).
# This pattern doesn't work for irc colors, if we need that someone can figure it out # This pattern doesn't work for irc colors, if we need that someone can figure it out
if [[ $B_LOG_COLORS != 'true' ]];then if [[ -n $logged_data ]];then
echo -e "${spacer}$logged_data" | sed 's/\x1b\[[0-9]\{1,2\}\(;[0-9]\{1,2\}\)\{0,2\}m//g' >> $LOG_FILE if [[ $B_LOG_COLORS != 'true' ]];then
else echo -e "${spacer}$logged_data" | sed -r 's/\x1b\[[0-9]{1,2}(;[0-9]{1,2}){0,2}m//g' >> $LOG_FILE
echo -e "${spacer}$logged_data" >> $LOG_FILE else
echo -e "${spacer}$logged_data" >> $LOG_FILE
fi
fi fi
fi fi
} }
@ -1033,10 +1054,12 @@ get_parameters()
@) if [[ -n $( egrep "^([1-9]|10)$" <<< $OPTARG ) ]];then @) if [[ -n $( egrep "^([1-9]|10)$" <<< $OPTARG ) ]];then
DEBUG=$OPTARG DEBUG=$OPTARG
exec 2>&1 exec 2>&1
# switch on logging only for -@ 10 # switch on logging only for -@ 8-10
if [[ $OPTARG -ge 9 ]];then if [[ $OPTARG -ge 8 ]];then
if [[ $OPTARG -eq 10 ]];then if [[ $OPTARG -eq 10 ]];then
B_LOG_COLORS='true' B_LOG_COLORS='true'
elif [[ $OPTARG -eq 9 ]];then
B_LOG_FULL_DATA='true'
fi fi
B_USE_LOGGING='true' B_USE_LOGGING='true'
# pack the logging data for evals function start/end # pack the logging data for evals function start/end
@ -1151,7 +1174,8 @@ show_options()
fi fi
print_screen_output "-V $SCRIPT_NAME version information. Prints information then exits." print_screen_output "-V $SCRIPT_NAME version information. Prints information then exits."
print_screen_output "-% Overrides defective or corrupted data." print_screen_output "-% Overrides defective or corrupted data."
print_screen_output "-@ Triggers debugger output. Requires debugging level 1-10." print_screen_output "-@ Triggers debugger output. Requires debugging level 1-10 (8-10 - logging)."
print_screen_output " 8 - basic logging; 9 - full file/sys info logging; 10 - color logging."
if [[ $1 == 'full' ]];then if [[ $1 == 'full' ]];then
print_screen_output "" print_screen_output ""
print_screen_output "Developer and Testing Options (Advanced):" print_screen_output "Developer and Testing Options (Advanced):"
@ -1234,6 +1258,46 @@ get_start_client()
# replacing loose detection with tight detection, bugs will be handled with app names # replacing loose detection with tight detection, bugs will be handled with app names
# as they appear. # as they appear.
case $app_working_name in case $app_working_name in
# check for shell first
bash|dash|sh)
unset IRC_CLIENT_VERSION
IRC_CLIENT="Shell wrapper"
;;
# now start on irc clients, alphabetically
bitchx)
IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk '
/Version/ {
a=tolower($2)
gsub(/[()]|bitchx-/,"",a)
print a
exit
}
$2 == "version" {
a=tolower($3)
sub(/bitchx-/,"",a)
print a
exit
}' )"
IRC_CLIENT="BitchX"
;;
finch)
IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 {
print $2
}' )"
IRC_CLIENT="Finch"
;;
gaim)
IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 {
print $2
}' )"
IRC_CLIENT="Gaim"
;;
ircii)
IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 {
print $3
}' )"
IRC_CLIENT="ircII"
;;
irssi-text|irssi) irssi-text|irssi)
IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 {
print $2 print $2
@ -1286,45 +1350,27 @@ get_start_client()
fi fi
IRC_CLIENT="Konversation" IRC_CLIENT="Konversation"
;; ;;
xchat-gnome) kopete)
IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { IRC_CLIENT_VERSION=" $( kopete -v | gawk '
/Kopete:/ {
print $2 print $2
}' )"
IRC_CLIENT="X-Chat-Gnome"
;;
xchat)
IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 {
print $2
}' )"
IRC_CLIENT="X-Chat"
;;
bitchx)
IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk '
/Version/ {
a=tolower($2)
gsub(/[()]|bitchx-/,"",a)
print a
exit
}
$2 == "version" {
a=tolower($3)
sub(/bitchx-/,"",a)
print a
exit exit
}' )" }' )"
IRC_CLIENT="BitchX" IRC_CLIENT="Kopete"
;; ;;
ircii) kvirc)
IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { IRC_CLIENT_VERSION=" $( $irc_client_path -v 2>&1 | gawk '{
print $3 for ( i=2; i<=NF; i++) {
}' )" if ( i == NF ) {
IRC_CLIENT="ircII" print $i
;; }
gaim) else {
IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { printf $i" "
print $2 }
}' )" }
IRC_CLIENT="Gaim" exit
}' )"
IRC_CLIENT="KVIrc"
;; ;;
pidgin) pidgin)
IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 {
@ -1371,28 +1417,19 @@ get_start_client()
IRC_CLIENT_VERSION=" $( $irc_client_path -v ) " IRC_CLIENT_VERSION=" $( $irc_client_path -v ) "
IRC_CLIENT="Weechat" IRC_CLIENT="Weechat"
;; ;;
kvirc) xchat-gnome)
IRC_CLIENT_VERSION=" $( $irc_client_path -v 2>&1 | gawk '{ IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 {
for ( i=2; i<=NF; i++) {
if ( i == NF ) {
print $i
}
else {
printf $i" "
}
}
exit
}' )"
IRC_CLIENT="KVIrc"
;;
kopete)
IRC_CLIENT_VERSION=" $( kopete -v | gawk '
/Kopete:/ {
print $2 print $2
exit
}' )" }' )"
IRC_CLIENT="Kopete" IRC_CLIENT="X-Chat-Gnome"
;; ;;
xchat)
IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 {
print $2
}' )"
IRC_CLIENT="X-Chat"
;;
# then do some perl type searches, do this last since it's a wildcard search
perl*|ksirc|dsirc) perl*|ksirc|dsirc)
unset IRC_CLIENT_VERSION unset IRC_CLIENT_VERSION
# KSirc is one of the possibilities now. KSirc is a wrapper around dsirc, a perl client # KSirc is one of the possibilities now. KSirc is a wrapper around dsirc, a perl client
@ -1423,10 +1460,7 @@ get_start_client()
IRC_CLIENT="Unknown Perl client" IRC_CLIENT="Unknown Perl client"
fi fi
;; ;;
bash|dash|sh) # then unset, set unknown data
unset IRC_CLIENT_VERSION
IRC_CLIENT="Shell wrapper"
;;
*) *)
IRC_CLIENT="Unknown : ${irc_client_path##*/}" IRC_CLIENT="Unknown : ${irc_client_path##*/}"
unset IRC_CLIENT_VERSION unset IRC_CLIENT_VERSION
@ -1502,6 +1536,7 @@ get_audio_data()
print driver print driver
} }
}' $DIR_ASOUND_DEVICE ) }' $DIR_ASOUND_DEVICE )
log_function_data 'cat' "$DIR_ASOUND_DEVICE"
fi fi
# this is to safeguard against line breaks from results > 1, which if inserted into following # this is to safeguard against line breaks from results > 1, which if inserted into following
@ -1605,6 +1640,7 @@ get_audio_data()
# corresponding line. Finally, strip out commas as they will change the driver :) # corresponding line. Finally, strip out commas as they will change the driver :)
usb_id=$( cat $usb_proc_file/usbid ) usb_id=$( cat $usb_proc_file/usbid )
usb_data=$( lsusb -v 2>/dev/null | grep "$usb_id" ) usb_data=$( lsusb -v 2>/dev/null | grep "$usb_id" )
log_function_data 'raw' "usb_data:\n$usb_data"
usb_data=$( gawk '{ usb_data=$( gawk '{
gsub( /,/, " ", $0 ) gsub( /,/, " ", $0 )
for( i=7; i <= NF; i++ ) { for( i=7; i <= NF; i++ ) {
@ -1652,6 +1688,7 @@ get_audio_alsa_data()
print $0 print $0
} }
}' $DIR_ASOUND_VERSION ) }' $DIR_ASOUND_VERSION )
log_function_data 'cat' "$DIR_ASOUND_VERSION"
fi fi
echo "$alsa_data" echo "$alsa_data"
log_function_data "alsa_data: $alsa_data" log_function_data "alsa_data: $alsa_data"
@ -1773,6 +1810,7 @@ get_cpu_data()
printf("%s %s\n", max, "Mhz") printf("%s %s\n", max, "Mhz")
} }
}' $DIR_CPUINFO ) ) }' $DIR_CPUINFO ) )
log_function_data 'cat' "$DIR_CPUINFO"
fi fi
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
@ -1863,8 +1901,7 @@ get_cpu_ht_multicore_smp_data()
} }
print type " " physical_cpu_count " " core_count print type " " physical_cpu_count " " core_count
} }
' $DIR_CPUINFO ' $DIR_CPUINFO ) )
) )
fi fi
log_function_data "A_CPU_TYPE_PCNT_CCNT: ${A_CPU_TYPE_PCNT_CCNT[@]}" log_function_data "A_CPU_TYPE_PCNT_CCNT: ${A_CPU_TYPE_PCNT_CCNT[@]}"
eval $LOGFE eval $LOGFE
@ -1909,14 +1946,14 @@ get_distro_data()
fi fi
done done
fi fi
log_function_data "distro_file: $distro_file"
# first test for the legacy antiX distro id file # first test for the legacy antiX distro id file
if [[ -e /etc/antiX ]];then if [[ -e /etc/antiX ]];then
distro="$( egrep -oi 'antix.*\.iso' <<< $( remove_erroneous_chars '/etc/antiX' ) | sed 's/\.iso//' )" distro="$( egrep -oi 'antix.*\.iso' <<< $( remove_erroneous_chars '/etc/antiX' ) | sed 's/\.iso//' )"
# this handles case where only one release/version file was found, and it's lsb-release. This would # this handles case where only one release/version file was found, and it's lsb-release. This would
# never apply for ubuntu or debian, which will filter down to the following conditions. In general # never apply for ubuntu or debian, which will filter down to the following conditions. In general
# if there's a specific distro release file available, that's to be preferred, but this is a good backup. # if there's a specific distro release file available, that's to be preferred, but this is a good backup.
elif [[ -n $distro_file && -f /etc/lsb_release && " $DISTROS_LSB_GOOD" == *" $distro_file "* ]];then elif [[ -n $distro_file && -f $DIR_LSB_RELEASE && " $DISTROS_LSB_GOOD" == *" $distro_file "* ]];then
distro=$( get_distro_lsb_data ) distro=$( get_distro_lsb_data )
elif [[ $distro_file == 'lsb-release' ]];then elif [[ $distro_file == 'lsb-release' ]];then
distro=$( get_distro_lsb_data ) distro=$( get_distro_lsb_data )
@ -2006,6 +2043,7 @@ get_distro_lsb_data()
END { END {
print distroId distroRelease distroCodename print distroId distroRelease distroCodename
}' $DIR_LSB_RELEASE ) }' $DIR_LSB_RELEASE )
log_function_data 'cat' "$DIR_LSB_RELEASE"
fi fi
# this is HORRIBLY slow, but I don't know why, it runs fast in shell # this is HORRIBLY slow, but I don't know why, it runs fast in shell
# if [[ -n $( which lsb_release ) && $1 == 'app' ]];then # if [[ -n $( which lsb_release ) && $1 == 'app' ]];then
@ -2131,7 +2169,7 @@ get_graphics_glx_data()
get_graphics_res_data() get_graphics_res_data()
{ {
eval $LOGFS eval $LOGFS
local screen_resolution='' local screen_resolution=''
if [[ $B_X_RUNNING == 'true' && $B_ROOT != 'true' ]];then if [[ $B_X_RUNNING == 'true' && $B_ROOT != 'true' ]];then
# Added the two ?'s , because the resolution is now reported without spaces around the 'x', as in # Added the two ?'s , because the resolution is now reported without spaces around the 'x', as in
@ -2172,12 +2210,13 @@ get_graphics_agp_data()
eval $LOGFS eval $LOGFS
local agp_module='' local agp_module=''
if [[ B_MODULES_DIR == 'true' ]];then if [[ $B_MODULES_DIR == 'true' ]];then
## not used currently ## not used currently
agp_module=$( gawk ' agp_module=$( gawk '
/agp/ && !/agpgart/ && $3 > 0 { /agp/ && !/agpgart/ && $3 > 0 {
print(gensub(/(.*)_agp.*/,"\\1","g",$1)) print(gensub(/(.*)_agp.*/,"\\1","g",$1))
}' $DIR_MODULES ) }' $DIR_MODULES )
log_function_data 'cat' "$DIR_MODULES"
fi fi
log_function_data "agp_module: $agp_module" log_function_data "agp_module: $agp_module"
eval $LOGFE eval $LOGFE
@ -2236,8 +2275,10 @@ get_hdd_data_basic()
{ {
eval $LOGFS eval $LOGFS
local hdd_used='' local hdd_used=''
local hdd_data="$( df --exclude-type=aufs --exclude-type=tmpfs --exclude-type=iso9660 )"
hdd_used=$( df --exclude-type=aufs --exclude-type=tmpfs --exclude-type=iso9660 | gawk ' log_function_data 'raw' "hdd_data:\n$hdd_data"
hdd_used=$( echo "$hdd_data" | gawk '
# also handles odd dm-1 type, from lvm # also handles odd dm-1 type, from lvm
/^\/dev\/(mapper\/|[hs]d[a-z][0-9]+|dm[-]?[0-9]+)/ { /^\/dev\/(mapper\/|[hs]d[a-z][0-9]+|dm[-]?[0-9]+)/ {
# this handles the case where the first item is too long # this handles the case where the first item is too long
@ -2310,8 +2351,8 @@ get_hdd_data_basic()
else { else {
print "NA,-" # print an empty array, this will be further handled in the print out function print "NA,-" # print an empty array, this will be further handled in the print out function
} }
}' $DIR_PARTITIONS }' $DIR_PARTITIONS ) )
) ) log_function_data 'cat' "$DIR_PARTITIONS"
fi fi
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
log_function_data "A_HDD_DATA: ${A_HDD_DATA[@]}" log_function_data "A_HDD_DATA: ${A_HDD_DATA[@]}"
@ -2383,6 +2424,7 @@ get_hard_drive_data_advanced()
} }
} }
}' $DIR_SCSI ) ) }' $DIR_SCSI ) )
log_function_data 'cat' "$DIR_SCSI"
fi fi
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
@ -2445,7 +2487,7 @@ get_lspci_data()
}' )" }' )"
echo "$lspci_data" echo "$lspci_data"
log_function_data "lspci_data: $lspci_data" log_function_data 'raw' "lspci_data:\n$lspci_data"
eval $LOGFE eval $LOGFE
} }
@ -2454,19 +2496,20 @@ get_memory_data()
{ {
eval $LOGFS eval $LOGFS
local memory='' local memory=''
if [[ $B_MEMINFO == 'true' ]];then
memory=$( gawk ' memory=$( gawk '
/^MemTotal:/ { /^MemTotal:/ {
tot = $2 tot = $2
} }
/^(MemFree|Buffers|Cached):/ { /^(MemFree|Buffers|Cached):/ {
notused+=$2 notused+=$2
} }
END { END {
used = tot-notused used = tot-notused
printf("%.1f/%.1fMB\n", used/1024, tot/1024) printf("%.1f/%.1fMB\n", used/1024, tot/1024)
}' $DIR_MEMINFO ) }' $DIR_MEMINFO )
log_function_data 'cat' "$DIR_MEMINFO"
fi
echo "$memory" echo "$memory"
log_function_data "memory: $memory" log_function_data "memory: $memory"
eval $LOGFE eval $LOGFE
@ -2643,13 +2686,16 @@ get_partition_data()
eval $LOGFS eval $LOGFS
#local excluded_file_types='--exclude-type=aufs --exclude-type=tmpfs --exclude-type=iso9660' #local excluded_file_types='--exclude-type=aufs --exclude-type=tmpfs --exclude-type=iso9660'
# df doesn't seem to work in script with variables like at the command line # df doesn't seem to work in script with variables like at the command line
local main_partition_data="$( df -h -T --exclude-type=aufs --exclude-type=tmpfs --exclude-type=iso9660 )"
local swap_data="$( swapon -s )"
log_function_data 'raw' "main_partition_data:\n$main_partition_data\n\nswap_data:\n$swap_data"
IFS=$'\n' IFS=$'\n'
# sample line: /dev/sda2 ext3 15G 8.9G 4.9G 65% /home # sample line: /dev/sda2 ext3 15G 8.9G 4.9G 65% /home
# $NF = partition name; $(NF - 4) = partition size; $(NF - 3) = used, in gB; $(NF - 1) = percent used # $NF = partition name; $(NF - 4) = partition size; $(NF - 3) = used, in gB; $(NF - 1) = percent used
## note: by subtracting from the last field number NF, we avoid a subtle issue with LVM df output, where if ## note: by subtracting from the last field number NF, we avoid a subtle issue with LVM df output, where if
## the first field is too long, it will occupy its own line, this way we are getting only the needed data ## the first field is too long, it will occupy its own line, this way we are getting only the needed data
A_PARTITION_DATA=( $( df -h -T --exclude-type=aufs --exclude-type=tmpfs --exclude-type=iso9660 | gawk ' A_PARTITION_DATA=( $( echo "$main_partition_data" | gawk '
BEGIN { BEGIN {
IGNORECASE=1 IGNORECASE=1
} }
@ -2691,7 +2737,7 @@ get_partition_data()
# now add the swap partition data, don't want to show swap files, just partitions, # now add the swap partition data, don't want to show swap files, just partitions,
# though this can include /dev/ramzswap0. Note: you can also use /proc/swaps for this # though this can include /dev/ramzswap0. Note: you can also use /proc/swaps for this
# data, it's the same exact output as swapon -s # data, it's the same exact output as swapon -s
$( swapon -s | gawk ' $( echo "$swap_data" | gawk '
BEGIN { BEGIN {
swapCounter = 1 swapCounter = 1
} }
@ -2726,6 +2772,7 @@ get_partition_data_advanced()
if [[ -d /dev/disk/by-uuid ]];then if [[ -d /dev/disk/by-uuid ]];then
dev_disk_uuid="$( ls -l /dev/disk/by-uuid )" dev_disk_uuid="$( ls -l /dev/disk/by-uuid )"
fi fi
log_function_data 'raw' "dev_disk_label:\n$dev_disk_label\n\ndev_disk_uuid:\n$dev_disk_uuid"
if [[ $B_MOUNTS_DIR == 'true' ]];then if [[ $B_MOUNTS_DIR == 'true' ]];then
for (( i=0; i < ${#A_PARTITION_DATA[@]}; i++ )) for (( i=0; i < ${#A_PARTITION_DATA[@]}; i++ ))
@ -2841,6 +2888,7 @@ get_partition_data_advanced()
A_PARTITION_DATA[i]=${a_partition_working[0]}","${a_partition_working[1]}","${a_partition_working[2]}","${a_partition_working[3]}","${a_partition_working[4]}","$dev_item","$dev_label","$dev_uuid A_PARTITION_DATA[i]=${a_partition_working[0]}","${a_partition_working[1]}","${a_partition_working[2]}","${a_partition_working[3]}","${a_partition_working[4]}","$dev_item","$dev_label","$dev_uuid
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
done done
log_function_data 'cat' "$DIR_MOUNTS"
fi fi
log_function_data "A_PARTITION_DATA: ${A_PARTITION_DATA[@]}" log_function_data "A_PARTITION_DATA: ${A_PARTITION_DATA[@]}"
eval $LOGFE eval $LOGFE