some more fixes, still working on the puppy thing

This commit is contained in:
trash80.v2.0 2008-12-23 03:14:57 +00:00
parent 570bab1f91
commit c7caa8572a

25
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.8.13.b2.2 #### version: 0.8.13.b2.3
#### Date: December 22 2008 #### Date: December 22 2008
######################################################################## ########################################################################
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif #### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
@ -163,6 +163,7 @@ B_ASOUND_VERSION='false'
B_BASH_ARRAY='false' B_BASH_ARRAY='false'
B_IFCONFIG='false' B_IFCONFIG='false'
B_LSB_DIR='false' B_LSB_DIR='false'
B_SCSI_DIR='false'
### Directory's used when present ### Directory's used when present
CPUINFO='/proc/cpuinfo' CPUINFO='/proc/cpuinfo'
@ -170,6 +171,7 @@ MEMINFO='/proc/meminfo'
ASOUND_DEVICE='/proc/asound/cards' ASOUND_DEVICE='/proc/asound/cards'
ASOUND_VERSION='/proc/asound/version' ASOUND_VERSION='/proc/asound/version'
LSB_RELEASE='/etc/lsb-release' LSB_RELEASE='/etc/lsb-release'
SCSI_DIR='/proc/scsi/scsi'
### Variable initializations: constants ### Variable initializations: constants
DCOPOBJ="default" DCOPOBJ="default"
@ -377,6 +379,10 @@ init()
if [[ -f "$LSB_RELEASE" ]];then if [[ -f "$LSB_RELEASE" ]];then
B_LSB_DIR='true' B_LSB_DIR='true'
fi fi
if [[ -e "$SCSI_DIR" ]];then
B_SCSI_DIR='false'
fi
# lack of ifconfig will throw an error only upon it's usage # lack of ifconfig will throw an error only upon it's usage
if [[ -x ifconfig ]];then if [[ -x ifconfig ]];then
@ -1307,7 +1313,7 @@ get_audio_alsa_data()
local alsa_data='' local alsa_data=''
# now we'll get the alsa data if the file exists # now we'll get the alsa data if the file exists
if [[ -e "$B_ASOUND_VERSION" ]];then if [[ $B_ASOUND_VERSION ]];then
alsa_data=$( gawk ' alsa_data=$( gawk '
{ IGNORECASE=1 } { IGNORECASE=1 }
# some alsa strings have the build date in (...) # some alsa strings have the build date in (...)
@ -1320,7 +1326,7 @@ get_audio_alsa_data()
if ( $0 != "" ){ if ( $0 != "" ){
print $0 print $0
} }
}' $B_ASOUND_VERSION ) }' $ASOUND_VERSION )
fi fi
echo "$alsa_data" echo "$alsa_data"
} }
@ -1483,7 +1489,8 @@ get_distro_data()
# otherwise try the default debian/ubuntu /etc/issue file # otherwise try the default debian/ubuntu /etc/issue file
elif [[ -f /etc/issue ]];then elif [[ -f /etc/issue ]];then
# lsb gives more manageable and accurate output than issue, but mint should use issue for now # lsb gives more manageable and accurate output than issue, but mint should use issue for now
if [[ "$B_LSB_DIR" && -z $( grep -i 'mint' /etc/issue ) ]];then # something here allows puppy linux into the mint section
if [[ $B_LSB_DIR ]] && [[ -z $( grep -i 'mint' /etc/issue ) ]];then
distro=$( get_distro_lsb_data ) distro=$( get_distro_lsb_data )
else else
distro=$( gawk ' distro=$( gawk '
@ -1830,7 +1837,7 @@ get_hard_drive_data_advanced()
## then handle libata names ## then handle libata names
# first get the ata device names, put them into an array # first get the ata device names, put them into an array
IFS=$'\n' IFS=$'\n'
if [[ -e /proc/scsi/scsi ]]; then if [[ $B_SCSI_DIR ]]; then
a_temp_scsi=( $( gawk ' a_temp_scsi=( $( gawk '
BEGIN { IGNORECASE=1 } BEGIN { IGNORECASE=1 }
/host/ { /host/ {
@ -1855,7 +1862,7 @@ get_hard_drive_data_advanced()
print c print c
} }
} }
}' /proc/scsi/scsi) ) }' $SCSI_DIR ) )
fi fi
IFS="$ORIGINAL_IFS" IFS="$ORIGINAL_IFS"
@ -2038,7 +2045,7 @@ get_networking_wan_ip_data()
get_networking_local_ip_data() get_networking_local_ip_data()
{ {
if [[ B_IFCONFIG ]];then if [[ $B_IFCONFIG ]];then
IFS=$'\n' IFS=$'\n'
A_INTERFACES_DATA=( $( ifconfig | gawk ' A_INTERFACES_DATA=( $( ifconfig | gawk '
BEGIN { IGNORECASE=1 } BEGIN { IGNORECASE=1 }
@ -2083,14 +2090,14 @@ get_networking_local_ip_data()
get_partition_data() get_partition_data()
{ {
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'
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 "$excluded_file_types" | gawk ' A_PARTITION_DATA=( $( df -h -T --exclude-type=aufs --exclude-type=tmpfs --exclude-type=iso9660 | gawk '
BEGIN { IGNORECASE=1 } BEGIN { IGNORECASE=1 }
/\/$|\/boot$|\/var$|\/home$|\/tmp$|\/usr$/ && ! /aufs/ { /\/$|\/boot$|\/var$|\/home$|\/tmp$|\/usr$/ && ! /aufs/ {
print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",main" print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",main"