mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 08:57:57 +00:00
fine tuned special cases, spaces in file names, etc
This commit is contained in:
parent
6fa7b8fb87
commit
a5d5324797
15
inxi
15
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 0.7.1-b1-t6
|
||||
#### version: 0.7.1-b1-t7
|
||||
#### Date: December 3 2008
|
||||
########################################################################
|
||||
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
|
||||
|
@ -704,8 +704,9 @@ show_options()
|
|||
print_screen_output "-I Show information: processes, uptime, memory, irc client, inxi version."
|
||||
print_screen_output "-N Show network card information."
|
||||
print_screen_output "-p Show full partition information (-P plus all other detected partitions)."
|
||||
print_screen_output " If any of your partitions have spaces in their names, they will not show with -p"
|
||||
print_screen_output "-P Show partition information (shows what -v4 would show, but without extra data)."
|
||||
print_screen_output " Shows, if detected, /, /home/, /var, /boot. Use -p for All partitions."
|
||||
print_screen_output " Shows, if detected: / /boot /home /tmp /usr /var. Use -p for All partitions."
|
||||
print_screen_output "-S Show system information: host name, kernel, distro"
|
||||
print_screen_output "-v Script verbosity levels. Verbosity level number is required."
|
||||
print_screen_output " Supported levels: 0-${VERBOSITY_LEVELS} Example: $SCRIPT_NAME -v 4"
|
||||
|
@ -1927,16 +1928,20 @@ get_partition_data()
|
|||
# $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
|
||||
## 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 | gawk '
|
||||
A_PARTITION_DATA=( $( df -h -T --exclude-type=aufs --exclude-type=tmpfs --exclude-type=iso9660 | gawk '
|
||||
BEGIN { IGNORECASE=1 }
|
||||
/\/$|\/boot$|\/var$|\/home$|\/tmp$|\/usr$/ && ! /aufs/ {
|
||||
print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",main"
|
||||
}
|
||||
! /\/$|\/boot$|\/var$|\/home$|\/tmp$|\/usr$|tmpfs|udev|^filesystem/ && ! /aufs|.iso|9660/ {
|
||||
! /\/$|\/boot$|\/var$|\/home$|\/tmp$|\/usr$|^filesystem/ {
|
||||
# this is to avoid file systems with spaces in their names, that will make
|
||||
# the test show the wrong data in each of the fields, if no x%, then do not use
|
||||
if ( $(NF - 1) ~ /[0-9]+\%/ ) {
|
||||
# cleaning up user name here to avoid showing too much info on irc
|
||||
partitionName=gensub( /^\/home\/(.*)\/(.*)/, "/home/<username>/\\2", 1, $NF )
|
||||
print partitionName "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",secondary"
|
||||
}
|
||||
}
|
||||
' )
|
||||
# now add the swap partition data, doesn't show percent used, someone can figure that in the future
|
||||
# don't want to show swap files, just partitions
|
||||
|
@ -2621,7 +2626,7 @@ print_partition_data()
|
|||
{
|
||||
local a_partition_working='' partition_used='' swap='' partition_data='' partition_data_2=''
|
||||
local partition_data_3='' partition_data_4='' partition_data_5='' partition_data_6=''
|
||||
local partition_data_7='' partition_data_8='' counter=1 line_max=150
|
||||
local partition_data_7='' partition_data_8='' counter=1 line_max=160
|
||||
|
||||
# this handles the different, shorter, irc colors strings embedded in variable data
|
||||
if [[ $B_RUNNING_IN_SHELL != 'true' ]];then
|
||||
|
|
Loading…
Reference in a new issue