some code cleanup and variable naming fixes

This commit is contained in:
inxi-svn 2010-01-09 04:49:55 +00:00
parent 80a3db7925
commit d48147d79d

40
inxi
View file

@ -236,11 +236,11 @@ B_ASOUND_CARDS='false'
B_ASOUND_VERSION='false'
B_BASH_ARRAY='false'
B_IFCONFIG='false'
B_LSB_DIR='false'
B_SCSI_DIR='false'
B_MODULES_DIR='false' #
B_MOUNTS_DIR='false'
B_PARTITIONS_DIR='false' #
B_LSB_FILE='false'
B_SCSI_FILE='false'
B_MODULES_FILE='false' #
B_MOUNTS_FILE='false'
B_PARTITIONS_FILE='false' #
### File's used when present
FILE_CPUINFO='/proc/cpuinfo'
@ -543,11 +543,11 @@ initialize_script_data()
fi
if [[ -f $FILE_LSB_RELEASE ]];then
B_LSB_DIR='true'
B_LSB_FILE='true'
fi
if [[ -e $FILE_SCSI ]];then
B_SCSI_DIR='true'
B_SCSI_FILE='true'
fi
# lack of ifconfig will throw an error only upon it's usage
@ -566,15 +566,15 @@ initialize_script_data()
fi
if [[ -e $FILE_MODULES ]];then
B_MODULES_DIR='true'
B_MODULES_FILE='true'
fi
if [[ -e $FILE_MOUNTS ]];then
B_MOUNTS_DIR='true'
B_MOUNTS_FILE='true'
fi
if [[ -e $FILE_PARTITIONS ]];then
B_PARTITIONS_DIR='true'
B_PARTITIONS_FILE='true'
fi
# gfx output will require this flag
if [[ $( whoami ) == 'root' ]];then
@ -2070,7 +2070,7 @@ get_distro_data()
# because Mint does not use such, it must be done as below
## this if statement requires the spaces and * as it is, else it won't work
##
if [[ " $DISTROS_LSB_GOOD " == *" ${i} "* ]] && [[ $B_LSB_DIR == 'true' ]];then
if [[ " $DISTROS_LSB_GOOD " == *" ${i} "* ]] && [[ $B_LSB_FILE == 'true' ]];then
distro_file='lsb-release'
else
distro_file="${i}"
@ -2097,7 +2097,7 @@ get_distro_data()
elif [[ -f /etc/issue ]];then
# lsb gives more manageable and accurate output than issue, but mint should use issue for now
# some bashism, boolean must be in parenthesis to work correctly, ie [[ $(boolean) ]] not [[ $boolean ]]
if [[ $B_LSB_DIR == 'true' ]] && [[ -z $( grep -i 'mint' /etc/issue ) ]];then
if [[ $B_LSB_FILE == 'true' ]] && [[ -z $( grep -i 'mint' /etc/issue ) ]];then
distro=$( get_distro_lsb_data )
else
distro=$( gawk '
@ -2121,7 +2121,7 @@ get_distro_data()
# : ${distro:=Unknown distro o_O}
## test for /etc/lsb-release as a backup in case of failure, in cases where > one version/release file
## were found but the above resulted in null distro value
if [[ -z $distro ]] && [[ $B_LSB_DIR == 'true' ]];then
if [[ -z $distro ]] && [[ $B_LSB_FILE == 'true' ]];then
distro=$( get_distro_lsb_data )
fi
## finally, if all else has failed, give up
@ -2145,7 +2145,7 @@ get_distro_lsb_data()
eval $LOGFS
local distro=''
if [[ $B_LSB_DIR == 'true' ]] && [[ $1 != 'app' ]];then
if [[ $B_LSB_FILE == 'true' ]] && [[ $1 != 'app' ]];then
distro=$( gawk -F '=' '
BEGIN {
IGNORECASE=1
@ -2406,7 +2406,7 @@ get_graphics_agp_data()
eval $LOGFS
local agp_module=''
if [[ $B_MODULES_DIR == 'true' ]];then
if [[ $B_MODULES_FILE == 'true' ]];then
## not used currently
agp_module=$( gawk '
/agp/ && !/agpgart/ && $3 > 0 {
@ -2513,7 +2513,7 @@ get_hdd_data_basic()
# final item is the total of the disk
IFS=$'\n'
if [[ $B_PARTITIONS_DIR == 'true' ]];then
if [[ $B_PARTITIONS_FILE == 'true' ]];then
A_HDD_DATA=( $(
gawk -v hddused="$hdd_used" '
/[hs]d[a-z]$/ {
@ -2593,7 +2593,7 @@ get_hard_drive_data_advanced()
## then handle libata names
# first get the ata device names, put them into an array
IFS=$'\n'
if [[ $B_SCSI_DIR == 'true' ]]; then
if [[ $B_SCSI_FILE == 'true' ]]; then
a_temp_scsi=( $( gawk '
BEGIN {
IGNORECASE=1
@ -3001,7 +3001,7 @@ get_partition_data_advanced()
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_FILE == 'true' ]];then
for (( i=0; i < ${#A_PARTITION_DATA[@]}; i++ ))
do
IFS=","
@ -3546,6 +3546,7 @@ get_unmounted_partition_data()
local a_unmounted_working='' a_unmounted_temp='' mounted_partitions='' separator=''
local dev_disk_label='' dev_disk_uuid='' dev_working='' uuid_working='' label_working=''
if [[ $B_PARTITIONS_FILE == 'true' ]];then
if [[ -d /dev/disk/by-label ]];then
dev_disk_label="$( ls -l /dev/disk/by-label )"
fi
@ -3565,7 +3566,7 @@ get_unmounted_partition_data()
fi
done
A_UNMOUNTED_PARTITION_DATA=( $( cat /proc/partitions | grep -Ev '('$mounted_partitions')' | gawk '
A_UNMOUNTED_PARTITION_DATA=( $( grep -Ev '('$mounted_partitions')' $FILE_PARTITIONS | gawk '
BEGIN {
IGNORECASE=1
}
@ -3592,6 +3593,7 @@ get_unmounted_partition_data()
A_UNMOUNTED_PARTITION_DATA[i]=${a_unmounted_working[0]}","${a_unmounted_working[1]}","$label_working","$uuid_working
IFS="$ORIGINAL_IFS"
done
fi
# echo "${A_UNMOUNTED_PARTITION_DATA[@]}"
eval $LOGFE