mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 08:57:57 +00:00
Changed partition data to work like other functions, create array of array data, then loop through it to print
This commit is contained in:
parent
17c4e56151
commit
4ebea16e5f
30
inxi
30
inxi
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 0.3.12
|
#### version: 0.3.13
|
||||||
#### Date: November 3 2008
|
#### Date: November 3 2008
|
||||||
########################################################################
|
########################################################################
|
||||||
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
||||||
|
@ -60,6 +60,7 @@ A_GFX_CARD_DATA=''
|
||||||
A_GLX_DATA=''
|
A_GLX_DATA=''
|
||||||
A_HDD_DATA=''
|
A_HDD_DATA=''
|
||||||
A_NETWORK_DATA=''
|
A_NETWORK_DATA=''
|
||||||
|
A_PARTITION_DATA=''
|
||||||
A_X_DATA=''
|
A_X_DATA=''
|
||||||
|
|
||||||
### Boolean true/false globals
|
### Boolean true/false globals
|
||||||
|
@ -1259,6 +1260,15 @@ get_networking_data()
|
||||||
IFS="$ORIGINAL_IFS"
|
IFS="$ORIGINAL_IFS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_partition_data()
|
||||||
|
{
|
||||||
|
IFS=$'\n'
|
||||||
|
# sample line: /dev/sda2 ext3 15G 8.9G 4.9G 65% /home
|
||||||
|
# $7 = partition name; $3 = partition size; $4 = used, in gB; $6 = percent used
|
||||||
|
A_PARTITION_DATA=( $( df -h -T | egrep '(/|/boot|/var|/home)$' | awk '{print $7 "," $3 "," $4 "," $6 }' ) )
|
||||||
|
IFS="$ORIGINAL_IFS"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
## return uptime string
|
## return uptime string
|
||||||
get_uptime()
|
get_uptime()
|
||||||
|
@ -1406,10 +1416,7 @@ print_gfx_data()
|
||||||
|
|
||||||
print_hard_disk_data()
|
print_hard_disk_data()
|
||||||
{
|
{
|
||||||
local hdd_data=''
|
local hdd_data='' partition_data='' a_partition_working=''
|
||||||
local root_home_data="$( df -h -T | egrep '(/|/boot|/var|/home)$' | C1=${C1} C2=${C2} awk '{print ENVIRON["C1"]"ID:"ENVIRON["C2"], $7, ENVIRON["C1"]"size:"ENVIRON["C2"], $3, ENVIRON["C1"]"used:"ENVIRON["C2"], $4, "(", $6, ")"}' )"
|
|
||||||
#local root_home_data="$( df -h -T | egrep '(/|/boot|/var|/home)$' | awk '{print "'"${C1}"'ID:'"${C2}"'", $7, "'"${C1}"'size:'"${C2}"'", $3, "'"${C1}"'used:'"${C2}"'", $4, "(", $6, ")"}' )"
|
|
||||||
root_home_data=$( echo $root_home_data ) # get rid of linebreaks
|
|
||||||
|
|
||||||
if [ "$VERBOSITY_LEVEL" -ge 3 ];then
|
if [ "$VERBOSITY_LEVEL" -ge 3 ];then
|
||||||
hdd_data=$( create_print_line "Disks:" "${C1}HDD${C2}${hdd_model} ${C1}Size${C2} ${hdd_capacity} (${hdd_used})${CN}" )
|
hdd_data=$( create_print_line "Disks:" "${C1}HDD${C2}${hdd_model} ${C1}Size${C2} ${hdd_capacity} (${hdd_used})${CN}" )
|
||||||
|
@ -1419,7 +1426,18 @@ print_hard_disk_data()
|
||||||
print_screen_output "$hdd_data"
|
print_screen_output "$hdd_data"
|
||||||
|
|
||||||
if [ "$VERBOSITY_LEVEL" -ge 4 ];then
|
if [ "$VERBOSITY_LEVEL" -ge 4 ];then
|
||||||
hdd_data=$( create_print_line " " "${C1}Partition:${C2} ${root_home_data}" )
|
# set A_PARTITION_DATA
|
||||||
|
get_partition_data
|
||||||
|
|
||||||
|
for (( i=0; i < ${#A_PARTITION_DATA[@]}; i++ ))
|
||||||
|
do
|
||||||
|
IFS=","
|
||||||
|
a_partition_working=(${A_PARTITION_DATA[i]})
|
||||||
|
IFS="$ORIGINAL_IFS"
|
||||||
|
partition_data="$partition_data ${C1}ID:${C2} ${a_partition_working[0]} ${C1}size:${C2} ${a_partition_working[1]} ${C1}used:${C2} ${a_partition_working[2]} (${a_partition_working[3]})"
|
||||||
|
done
|
||||||
|
# hdd_data=$( create_print_line " " "${C1}Partition:${C2} ${root_home_data}" )
|
||||||
|
hdd_data=$( create_print_line " " "${C1}Partition:${C2}${partition_data}" )
|
||||||
print_screen_output "$hdd_data"
|
print_screen_output "$hdd_data"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue