mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
totally synced separators in output, now if in console, uses : universally, or if color scheme is 0.
This is set dynamically as well. For irc it uses no : except for line starters and item starters, like: ID: or IF: or 1: and so on. Also made cpu per core clock speed the same, using now 1: instead of (1) that saves one character too per core, but makes it all the same, consistent. This also now becomes a user adjustable parameter, via config files, can set irc/console separator character(s) Ok, bored, now on with the day.
This commit is contained in:
parent
fb7467ea5a
commit
2627e355d5
205
inxi
205
inxi
|
@ -1,9 +1,9 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 1.7.14
|
||||
#### version: 1.7.15
|
||||
#### Date: July 6 2011
|
||||
#### Patch Number: 01
|
||||
#### Patch Number: 00
|
||||
########################################################################
|
||||
#### SPECIAL THANKS
|
||||
########################################################################
|
||||
|
@ -241,6 +241,9 @@ B_ROOT='false'
|
|||
B_RUN_COLOR_SELECTOR='false'
|
||||
# Running in a shell? Defaults to false, and is determined later.
|
||||
B_RUNNING_IN_SHELL='false'
|
||||
if tty >/dev/null;then
|
||||
B_RUNNING_IN_SHELL='true'
|
||||
fi
|
||||
# this sets the debug buffer
|
||||
B_SCRIPT_UP='false'
|
||||
B_SHOW_ADVANCED_NETWORK='false'
|
||||
|
@ -384,6 +387,11 @@ ORIGINAL_IFS="$IFS"
|
|||
# These two determine separators in single line output, to force irc clients not to break off sections
|
||||
SEP1='~'
|
||||
SEP2=' '
|
||||
# these will assign a separator to non irc states. Important! Using ':' can trigger stupid emoticon
|
||||
# behaviors in output on IRC, so do not use those.
|
||||
SEP3_IRC=''
|
||||
SEP3_CONSOLE=':'
|
||||
SEP3='' # do not set, will be set dynamically
|
||||
|
||||
### Script names/paths - must be non root writable
|
||||
SCRIPT_DATA_DIR="$HOME/.inxi"
|
||||
|
@ -616,6 +624,12 @@ main()
|
|||
set_color_scheme $color_scheme
|
||||
fi
|
||||
fi
|
||||
# too hard to read if no colors, so force that for users on irc
|
||||
if [[ $B_RUNNING_IN_SHELL == 'true' || $SCHEME == 0 ]];then
|
||||
SEP3=$SEP3_CONSOLE
|
||||
else
|
||||
SEP3=$SEP3_IRC
|
||||
fi
|
||||
|
||||
# all the pre-start stuff is in place now
|
||||
B_SCRIPT_UP='true'
|
||||
|
@ -1444,7 +1458,7 @@ check_recommends()
|
|||
local Line='-----------------------------------------------------------------------------------------'
|
||||
local gawk_version='N/A' sed_version='N/A' sudo_version='N/A' python_version='N/A'
|
||||
|
||||
if ! tty >/dev/null;then
|
||||
if [[ $B_RUNNING_IN_SHELL != 'true' ]];then
|
||||
print_screen_output "Sorry, you can't run this option in an IRC client."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -2076,7 +2090,7 @@ show_options()
|
|||
{
|
||||
local color_scheme_count=$(( ${#A_COLOR_SCHEMES[@]} - 1 ))
|
||||
|
||||
if ! tty >/dev/null;then
|
||||
if [[ $B_RUNNING_IN_SHELL != 'true' ]];then
|
||||
print_screen_output "Sorry, you can't run the help option in an IRC client."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -2248,10 +2262,9 @@ get_start_client()
|
|||
local b_non_native_app='false' pppid='' app_working_name=''
|
||||
local b_qt4_konvi='false'
|
||||
|
||||
if tty >/dev/null;then
|
||||
if [[ $B_RUNNING_IN_SHELL == 'true' ]];then
|
||||
IRC_CLIENT='Shell'
|
||||
unset IRC_CLIENT_VERSION
|
||||
B_RUNNING_IN_SHELL='true'
|
||||
elif [[ -n $PPID && -f /proc/$PPID/exe ]];then
|
||||
if [[ $B_OVERRIDE_FILTER != 'true' ]];then
|
||||
B_OUTPUT_FILTER='true'
|
||||
|
@ -6166,7 +6179,7 @@ print_audio_data()
|
|||
else
|
||||
alsa_version='N/A'
|
||||
fi
|
||||
alsa_data="${C1}Sound:${C2} $alsa ${C1}v:${C2} $alsa_version"
|
||||
alsa_data="${C1}Sound:${C2} $alsa ${C1}ver$SEP3${C2} $alsa_version"
|
||||
IFS="$ORIGINAL_IFS"
|
||||
fi
|
||||
# note, error handling is done in the get function, so this will never be null, but
|
||||
|
@ -6195,13 +6208,13 @@ print_audio_data()
|
|||
fi
|
||||
# we're testing for the presence of the 2nd array item here, which is the driver name
|
||||
if [[ -n ${a_audio_working[1]} ]];then
|
||||
alsa_driver=" ${C1}driver${C2} ${a_audio_working[1]}"
|
||||
alsa_driver=" ${C1}driver$SEP3${C2} ${a_audio_working[1]}"
|
||||
fi
|
||||
if [[ -n ${a_audio_working[2]} && $B_EXTRA_DATA == 'true' ]];then
|
||||
if [[ $( wc -w <<< ${a_audio_working[2]} ) -gt 1 ]];then
|
||||
port_plural='s'
|
||||
fi
|
||||
port_data=" ${C1}port$port_plural${C2} ${a_audio_working[2]}"
|
||||
port_data=" ${C1}port$port_plural$SEP3${C2} ${a_audio_working[2]}"
|
||||
fi
|
||||
if [[ -n ${a_audio_working[4]} && $B_EXTRA_DATA == 'true' ]];then
|
||||
if [[ ${a_audio_working[1]} != 'USB Audio' ]];then
|
||||
|
@ -6210,10 +6223,10 @@ print_audio_data()
|
|||
bus_usb_text='usb-ID'
|
||||
fi
|
||||
bus_usb_id=${a_audio_working[4]}
|
||||
pci_bus_id=" ${C1}$bus_usb_text:${C2} $bus_usb_id"
|
||||
pci_bus_id=" ${C1}$bus_usb_text$SEP3${C2} $bus_usb_id"
|
||||
fi
|
||||
if [[ -n ${a_audio_working[0]} ]];then
|
||||
audio_data="${C1}Card$card_id${C2} ${a_audio_working[0]}$alsa_driver$port_data$pci_bus_id"
|
||||
audio_data="${C1}Card$card_id:${C2} ${a_audio_working[0]}$alsa_driver$port_data$pci_bus_id"
|
||||
fi
|
||||
# only print alsa on last line if short enough, otherwise print on its own line
|
||||
if [[ $i -eq 0 ]];then
|
||||
|
@ -6294,7 +6307,7 @@ print_cpu_data()
|
|||
# else
|
||||
# bmip_data="${a_cpu_working[4]}"
|
||||
# fi
|
||||
bmip_data=" ${C1}bmips${C2} $bmip_data"
|
||||
bmip_data=" ${C1}bmips$SEP3${C2} $bmip_data"
|
||||
fi
|
||||
## note: this handles how intel reports L2, total instead of per core like AMD does
|
||||
# note that we need to multiply by number of actual cpus here to get true cache size
|
||||
|
@ -6306,9 +6319,9 @@ print_cpu_data()
|
|||
# only print shortened list
|
||||
if [[ $B_CPU_FLAGS_FULL != 'true' ]];then
|
||||
cpu_flags=$( process_cpu_flags "${a_cpu_working[3]}" )
|
||||
cpu_flags=" ${C1}flags${C2} ($cpu_flags)"
|
||||
cpu_flags=" ${C1}flags$SEP3${C2} ($cpu_flags)"
|
||||
fi
|
||||
cpu_data="$cpu_data${C2} ${C1}cache${C2} $cpu_cache$cpu_flags$bmip_data${CN}"
|
||||
cpu_data="$cpu_data${C2} ${C1}cache$SEP3${C2} $cpu_cache$cpu_flags$bmip_data${CN}"
|
||||
fi
|
||||
# we don't this printing out extra line unless > 1 cpu core
|
||||
if [[ ${#A_CPU_DATA[@]} -gt 2 && $B_SHOW_CPU == 'true' ]];then
|
||||
|
@ -6328,7 +6341,7 @@ print_cpu_data()
|
|||
a_cpu_working=(${A_CPU_DATA[i]})
|
||||
IFS="$ORIGINAL_IFS"
|
||||
# note: the first iteration will create a first space, for color code separation below
|
||||
cpu_multi_clock_data="$cpu_multi_clock_data ${C1}($(( i + 1 )))${C2} ${a_cpu_working[1]} MHz${CN}"
|
||||
cpu_multi_clock_data="$cpu_multi_clock_data ${C1}$(( i + 1 )):${C2} ${a_cpu_working[1]} MHz${CN}"
|
||||
# someone actually appeared with a 16 core system, so going to stop the cpu core throttle
|
||||
# if this had some other purpose which we can't remember we'll add it back in
|
||||
#if [[ $i -gt 10 ]];then
|
||||
|
@ -6368,7 +6381,7 @@ print_cpu_flags_full()
|
|||
for (( i=0; i < ${#a_cpu_flags[@]};i++ ))
|
||||
do
|
||||
if [[ $i -eq 0 ]];then
|
||||
line_starter="${C1}CPU Flags${C2} "
|
||||
line_starter="${C1}CPU Flags$SEP3${C2} "
|
||||
else
|
||||
line_starter=''
|
||||
fi
|
||||
|
@ -6443,7 +6456,7 @@ print_gfx_data()
|
|||
if [[ ${#A_GRAPHIC_DRIVERS[@]} -gt 1 ]];then
|
||||
x_driver_plural='s'
|
||||
fi
|
||||
x_driver_string="${C1}driver$x_driver_plural${C2}$x_driver "
|
||||
x_driver_string="${C1}driver$x_driver_plural$SEP3${C2}$x_driver "
|
||||
|
||||
# some basic error handling:
|
||||
if [[ -z $screen_resolution ]];then
|
||||
|
@ -6452,7 +6465,7 @@ print_gfx_data()
|
|||
if [[ -z $x_vendor || -z $x_version ]];then
|
||||
x_vendor_string="${C1}X-Vendor:${C2} N/A "
|
||||
else
|
||||
x_vendor_string="${C1}$x_vendor${C2} $x_version "
|
||||
x_vendor_string="${C1}$x_vendor$SEP3${C2} $x_version "
|
||||
fi
|
||||
|
||||
if [[ $B_ROOT == 'true' ]];then
|
||||
|
@ -6470,7 +6483,7 @@ print_gfx_data()
|
|||
root_x_string="${C1}Advanced Data:${C2} N/A $root_x_string"
|
||||
fi
|
||||
|
||||
display_full_string="$x_vendor_string$x_driver_string${C1}${res_tty}${C2} ${screen_resolution} $root_x_string"
|
||||
display_full_string="$x_vendor_string$x_driver_string${C1}${res_tty}$SEP3${C2} ${screen_resolution} $root_x_string"
|
||||
|
||||
if [[ ${#A_GFX_CARD_DATA[@]} -gt 0 ]];then
|
||||
for (( i=0; i < ${#A_GFX_CARD_DATA[@]}; i++ ))
|
||||
|
@ -6482,9 +6495,9 @@ print_gfx_data()
|
|||
gfx_card_data=${a_gfx_working[0]}
|
||||
if [[ $B_EXTRA_DATA == 'true' ]];then
|
||||
if [[ -n ${a_gfx_working[1]} ]];then
|
||||
gfx_bus_id=" ${C1}bus-ID:${C2} ${a_gfx_working[1]}"
|
||||
gfx_bus_id=" ${C1}bus-ID$SEP3${C2} ${a_gfx_working[1]}"
|
||||
else
|
||||
gfx_bus_id=" ${C1}bus-ID:${C2} N/A"
|
||||
gfx_bus_id=" ${C1}bus-ID$SEP3${C2} N/A"
|
||||
fi
|
||||
fi
|
||||
if [[ ${#A_GFX_CARD_DATA[@]} -gt 1 ]];then
|
||||
|
@ -6532,9 +6545,9 @@ print_gfx_data()
|
|||
glx_direct_render='N/A'
|
||||
fi
|
||||
if [[ $B_HANDLE_CORRUPT_DATA == 'true' || $B_EXTRA_DATA == 'true' ]];then
|
||||
direct_render_string=" ${C1}Direct Rendering${C2} ${glx_direct_render}${CN}"
|
||||
direct_render_string=" ${C1}Direct Rendering$SEP3${C2} ${glx_direct_render}${CN}"
|
||||
fi
|
||||
gfx_data="${C1}GLX Renderer${C2} ${glx_renderer} ${C1}GLX Version${C2} ${glx_version}${CN}$direct_render_string"
|
||||
gfx_data="${C1}GLX Renderer$SEP3${C2} ${glx_renderer} ${C1}GLX Version$SEP3${C2} ${glx_version}${CN}$direct_render_string"
|
||||
gfx_data=$( create_print_line " " "$gfx_data" )
|
||||
|
||||
print_screen_output "$gfx_data"
|
||||
|
@ -6594,7 +6607,7 @@ print_hard_disk_data()
|
|||
# printing line one, then new lines according to $divisor setting, and after, if leftovers, print that line.
|
||||
case $i in
|
||||
0)
|
||||
hdd_data=$( create_print_line "$Line_Starter" "${C1}HDD${C2} ${C1}Total Size:${C2} ${hdd_capacity} (${hdd_used}) ${hdd_model}" )
|
||||
hdd_data=$( create_print_line "$Line_Starter" "${C1}HDD Total Size:${C2} ${hdd_capacity} (${hdd_used}) ${hdd_model}" )
|
||||
print_screen_output "$hdd_data"
|
||||
hdd_model=''
|
||||
Line_Starter=' '
|
||||
|
@ -6648,28 +6661,28 @@ print_info_data()
|
|||
gcc_installed='N/A'
|
||||
fi
|
||||
if [[ $B_EXTRA_EXTRA_DATA == 'true' && -n ${A_GCC_VERSIONS[1]} ]];then
|
||||
gcc_others=" ${C1}alt${C2} $( tr ',' '/' <<< ${A_GCC_VERSIONS[1]} )"
|
||||
gcc_others=" ${C1}alt$SEP3${C2} $( tr ',' '/' <<< ${A_GCC_VERSIONS[1]} )"
|
||||
fi
|
||||
gcc_installed="${C1}Gcc sys${C2} $gcc_installed$gcc_others "
|
||||
gcc_installed="${C1}Gcc sys$SEP3${C2} $gcc_installed$gcc_others "
|
||||
fi
|
||||
fi
|
||||
|
||||
# Some code could look superfluous but BitchX doesn't like lines not ending in a newline. F*&k that bitch!
|
||||
# long_last=$( echo -ne "${C1}Processes${C2} ${processes}${CN} | ${C1}Uptime${C2} ${up_time}${CN} | ${C1}Memory${C2} ${MEM}${CN}" )
|
||||
info_data="${C1}Processes${C2} ${processes} ${C1}Uptime${C2} ${up_time} ${C1}Memory${C2} ${memory}${CN} "
|
||||
# long_last=$( echo -ne "${C1}Processes$SEP3${C2} ${processes}${CN} | ${C1}Uptime$SEP3${C2} ${up_time}${CN} | ${C1}Memory$SEP3${C2} ${MEM}${CN}" )
|
||||
info_data="${C1}Processes$SEP3${C2} ${processes} ${C1}Uptime$SEP3${C2} ${up_time} ${C1}Memory$SEP3${C2} ${memory}${CN} "
|
||||
|
||||
# this only triggers if no X data is present or if extra data switch is on
|
||||
if [[ $B_SHOW_X_DATA != 'true' || $B_EXTRA_DATA == 'true' ]];then
|
||||
runlvl="$( get_runlevel_data )"
|
||||
if [[ -n $runlvl ]];then
|
||||
info_data="${info_data}${C1}Runlevel${C2} ${runlvl} "
|
||||
info_data="${info_data}${C1}Runlevel$SEP3${C2} ${runlvl} "
|
||||
fi
|
||||
fi
|
||||
if [[ $SHOW_IRC -gt 0 ]];then
|
||||
client_data="${C1}Client${C2} ${IRC_CLIENT}${IRC_CLIENT_VERSION} "
|
||||
client_data="${C1}Client$SEP3${C2} ${IRC_CLIENT}${IRC_CLIENT_VERSION} "
|
||||
fi
|
||||
info_data="${info_data}$gcc_installed"
|
||||
closing_data="$client_data${C1}$SCRIPT_NAME${C2} $SCRIPT_VERSION_NUMBER$script_patch_number${CN}"
|
||||
closing_data="$client_data${C1}$SCRIPT_NAME$SEP3${C2} $SCRIPT_VERSION_NUMBER$script_patch_number${CN}"
|
||||
if [[ -n $info_data && $( calculate_line_length "$info_data$closing_data" ) -gt $LINE_MAX ]];then
|
||||
info_data=$( create_print_line "$line_starter" "$info_data" )
|
||||
print_screen_output "$info_data"
|
||||
|
@ -6737,16 +6750,16 @@ print_machine_data()
|
|||
chassis_vendor=" ${A_MACHINE_DATA[12]}"
|
||||
fi
|
||||
if [[ -n ${A_MACHINE_DATA[13]} ]];then
|
||||
chassis_type=" ${C1}type${C2} ${A_MACHINE_DATA[13]}"
|
||||
chassis_type=" ${C1}type$SEP3${C2} ${A_MACHINE_DATA[13]}"
|
||||
fi
|
||||
if [[ -n ${A_MACHINE_DATA[14]} ]];then
|
||||
chassis_version=" ${C1}version${C2} ${A_MACHINE_DATA[14]}"
|
||||
chassis_version=" ${C1}version$SEP3${C2} ${A_MACHINE_DATA[14]}"
|
||||
fi
|
||||
if [[ -n ${A_MACHINE_DATA[15]} && $B_OUTPUT_FILTER != 'true' ]];then
|
||||
chassis_serial=" ${C1}serial${C2} ${A_MACHINE_DATA[15]}"
|
||||
chassis_serial=" ${C1}serial$SEP3${C2} ${A_MACHINE_DATA[15]}"
|
||||
fi
|
||||
if [[ -n "$chassis_vendor$chassis_type$chassis_version$chassis_serial" ]];then
|
||||
chassis_line="${C1}Chassis${C2}$chassis_vendor$chassis_type$chassis_version$chassis_serial"
|
||||
chassis_line="${C1}Chassis$SEP3${C2}$chassis_vendor$chassis_type$chassis_version$chassis_serial"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -6761,10 +6774,10 @@ print_machine_data()
|
|||
mobo_model='N/A'
|
||||
fi
|
||||
if [[ -n ${A_MACHINE_DATA[7]} ]];then
|
||||
mobo_version=" ${C1}version${C2} ${A_MACHINE_DATA[7]}"
|
||||
mobo_version=" ${C1}version$SEP3${C2} ${A_MACHINE_DATA[7]}"
|
||||
fi
|
||||
if [[ -n ${A_MACHINE_DATA[8]} && $B_OUTPUT_FILTER != 'true' ]];then
|
||||
mobo_serial=" ${C1}serial${C2} ${A_MACHINE_DATA[8]}"
|
||||
mobo_serial=" ${C1}serial$SEP3${C2} ${A_MACHINE_DATA[8]}"
|
||||
fi
|
||||
if [[ -n ${A_MACHINE_DATA[9]} ]];then
|
||||
bios_vendor=${A_MACHINE_DATA[9]}
|
||||
|
@ -6781,8 +6794,8 @@ print_machine_data()
|
|||
else
|
||||
bios_date='N/A'
|
||||
fi
|
||||
mobo_line="${C1}Mobo${C2} $mobo_vendor ${C1}model${C2} $mobo_model$mobo_version$mobo_serial"
|
||||
bios_line="${C1}Bios${C2} $bios_vendor ${C1}version${C2} $bios_version ${C1}date${C2} $bios_date"
|
||||
mobo_line="${C1}Mobo$SEP3${C2} $mobo_vendor ${C1}model$SEP3${C2} $mobo_model$mobo_version$mobo_serial"
|
||||
bios_line="${C1}Bios$SEP3${C2} $bios_vendor ${C1}version$SEP3${C2} $bios_version ${C1}date$SEP3${C2} $bios_date"
|
||||
if [[ $( calculate_line_length "$mobo_line$bios_line" ) -lt $LINE_MAX ]];then
|
||||
mobo_line="$mobo_line $bios_line"
|
||||
bios_line=''
|
||||
|
@ -6802,12 +6815,12 @@ print_machine_data()
|
|||
product_name='N/A'
|
||||
fi
|
||||
if [[ -n ${A_MACHINE_DATA[2]} ]];then
|
||||
product_version=" ${C1}version${C2} ${A_MACHINE_DATA[2]}"
|
||||
product_version=" ${C1}version$SEP3${C2} ${A_MACHINE_DATA[2]}"
|
||||
fi
|
||||
if [[ -n ${A_MACHINE_DATA[3]} && $B_OUTPUT_FILTER != 'true' ]];then
|
||||
product_serial=" ${C1}serial${C2} ${A_MACHINE_DATA[3]} "
|
||||
product_serial=" ${C1}serial$SEP3${C2} ${A_MACHINE_DATA[3]} "
|
||||
fi
|
||||
system_line="${C1}System${C2} $system_vendor ${C1}product${C2} $product_name$product_version$product_serial"
|
||||
system_line="${C1}System$SEP3${C2} $system_vendor ${C1}product$SEP3${C2} $product_name$product_version$product_serial"
|
||||
if [[ -n $chassis_line && $( calculate_line_length "$system_line$chassis_line" ) -lt $LINE_MAX ]];then
|
||||
system_line="$system_line $chassis_line"
|
||||
chassis_line=''
|
||||
|
@ -6865,7 +6878,7 @@ print_module_version()
|
|||
done
|
||||
|
||||
if [[ -n $module_versions ]];then
|
||||
echo " ${C1}v:${C2}$module_versions"
|
||||
echo " ${C1}ver$SEP3${C2}$module_versions"
|
||||
fi
|
||||
eval $LOGFE
|
||||
}
|
||||
|
@ -6905,13 +6918,13 @@ print_networking_data()
|
|||
module_version=$( print_module_version "${a_network_working[1]}" )
|
||||
fi
|
||||
if [[ -n ${a_network_working[1]} ]];then
|
||||
driver_data="${C1}driver${C2} ${a_network_working[1]}$module_version "
|
||||
driver_data="${C1}driver$SEP3${C2} ${a_network_working[1]}$module_version "
|
||||
fi
|
||||
if [[ -n ${a_network_working[2]} && $B_EXTRA_DATA == 'true' ]];then
|
||||
if [[ $( wc -w <<< ${a_network_working[2]} ) -gt 1 ]];then
|
||||
port_plural='s'
|
||||
fi
|
||||
port_data="${C1}port$port_plural${C2} ${a_network_working[2]} "
|
||||
port_data="${C1}port$port_plural$SEP3${C2} ${a_network_working[2]} "
|
||||
fi
|
||||
if [[ -n ${a_network_working[4]} && $B_EXTRA_DATA == 'true' ]];then
|
||||
if [[ -z $( grep '^usb-' <<< ${a_network_working[4]} ) ]];then
|
||||
|
@ -6921,9 +6934,9 @@ print_networking_data()
|
|||
bus_usb_text='usb-ID'
|
||||
bus_usb_id=$( cut -d '-' -f '2-4' <<< ${a_network_working[4]} )
|
||||
fi
|
||||
pci_bus_id="${C1}$bus_usb_text:${C2} $bus_usb_id"
|
||||
pci_bus_id="${C1}$bus_usb_text$SEP3${C2} $bus_usb_id"
|
||||
fi
|
||||
card_string="${C1}Card$card_id${C2} ${a_network_working[0]} "
|
||||
card_string="${C1}Card$card_id$SEP3${C2} ${a_network_working[0]} "
|
||||
card_data="$driver_data$port_data$pci_bus_id"
|
||||
if [[ $( calculate_line_length "$card_string$card_data" ) -gt $LINE_MAX ]];then
|
||||
network_data=$( create_print_line "$line_starter" "$card_string" )
|
||||
|
@ -6971,11 +6984,11 @@ print_network_advanced_data()
|
|||
speed=${a_network_working[7]}
|
||||
fi
|
||||
fi
|
||||
speed_string="${C1}speed:${C2} $speed "
|
||||
speed_string="${C1}speed$SEP3${C2} $speed "
|
||||
if [[ -n ${a_network_working[8]} ]];then
|
||||
duplex=${a_network_working[8]}
|
||||
fi
|
||||
duplex_string="${C1}duplex:${C2} $duplex "
|
||||
duplex_string="${C1}duplex$SEP3${C2} $duplex "
|
||||
fi
|
||||
if [[ -n ${a_network_working[9]} ]];then
|
||||
if [[ $B_OUTPUT_FILTER == 'true' ]];then
|
||||
|
@ -6984,7 +6997,7 @@ print_network_advanced_data()
|
|||
mac_id=${a_network_working[9]}
|
||||
fi
|
||||
fi
|
||||
network_data="${C1}IF:${C2} $if_id ${C1}state:${C2} $oper_state $speed_string$duplex_string${C1}mac:${C2} $mac_id"
|
||||
network_data="${C1}IF:${C2} $if_id ${C1}state$SEP3${C2} $oper_state $speed_string$duplex_string${C1}mac$SEP3${C2} $mac_id"
|
||||
network_data=$( create_print_line " " "$network_data" )
|
||||
print_screen_output "$network_data"
|
||||
|
||||
|
@ -7030,7 +7043,7 @@ print_networking_ip_data()
|
|||
if_ip=${a_interfaces_working[1]}
|
||||
fi
|
||||
fi
|
||||
if_ip_string=" ${C1}ip${C2} $if_ip"
|
||||
if_ip_string=" ${C1}ip$SEP3${C2} $if_ip"
|
||||
if [[ $B_EXTRA_DATA == 'true' ]];then
|
||||
if [[ -n ${a_interfaces_working[3]} ]];then
|
||||
if [[ $B_OUTPUT_FILTER == 'true' ]];then
|
||||
|
@ -7039,13 +7052,13 @@ print_networking_ip_data()
|
|||
if_ipv6=${a_interfaces_working[3]}
|
||||
fi
|
||||
fi
|
||||
if_ipv6_string=" ${C1}ip-v6${C2} $if_ipv6"
|
||||
if_ipv6_string=" ${C1}ip-v6$SEP3${C2} $if_ipv6"
|
||||
fi
|
||||
fi
|
||||
if [[ -n ${a_interfaces_working[0]} ]];then
|
||||
if_id=${a_interfaces_working[0]}
|
||||
fi
|
||||
if_string="$wan_ip_data$if_string${C1}IF${C2} $if_id$if_ip_string$if_ipv6_string "
|
||||
if_string="$wan_ip_data$if_string${C1}IF$SEP3${C2} $if_id$if_ip_string$if_ipv6_string "
|
||||
wan_ip_data=''
|
||||
if [[ $( calculate_line_length "$if_string" ) -gt $line_max ]];then
|
||||
full_string=$( create_print_line " " "$if_string" )
|
||||
|
@ -7126,9 +7139,9 @@ print_optical_drive_data()
|
|||
else
|
||||
rev='N/A'
|
||||
fi
|
||||
rev=" ${C1}rev:${C2} $rev"
|
||||
rev=" ${C1}rev$SEP3${C2} $rev"
|
||||
fi
|
||||
drive_data="${C1}Optical${counter}:${C2} $drive_id ${C1}model:${C2} $vendor$rev ${C1}dev-links:${C2} $drive_links"
|
||||
drive_data="${C1}Optical${counter}:${C2} $drive_id ${C1}model$SEP3${C2} $vendor$rev ${C1}dev-links$SEP3${C2} $drive_links"
|
||||
drive_data=$( create_print_line "$Line_Starter" "$drive_data" )
|
||||
print_screen_output "$drive_data"
|
||||
Line_Starter=' '
|
||||
|
@ -7155,7 +7168,7 @@ print_optical_drive_data()
|
|||
else
|
||||
audio='no'
|
||||
fi
|
||||
audio=" ${C1}audio:${C2} $audio"
|
||||
audio=" ${C1}audio$SEP3${C2} $audio"
|
||||
if [[ -z ${a_drives[6]} ]];then
|
||||
multisession='N/A'
|
||||
elif [[ ${a_drives[6]} == 1 ]];then
|
||||
|
@ -7163,7 +7176,7 @@ print_optical_drive_data()
|
|||
else
|
||||
multisession='no'
|
||||
fi
|
||||
multisession=" ${C1}multisession:${C2} $multisession"
|
||||
multisession=" ${C1}multisession$SEP3${C2} $multisession"
|
||||
if [[ -z ${a_drives[11]} ]];then
|
||||
dvd='N/A'
|
||||
elif [[ ${a_drives[11]} == 1 ]];then
|
||||
|
@ -7177,7 +7190,7 @@ print_optical_drive_data()
|
|||
else
|
||||
state="${a_drives[14]}"
|
||||
fi
|
||||
state=" ${C1}state:${C2} $state"
|
||||
state=" ${C1}state$SEP3${C2} $state"
|
||||
fi
|
||||
if [[ -n ${a_drives[9]} && ${a_drives[9]} == 1 ]];then
|
||||
rw_support='cd-r'
|
||||
|
@ -7199,7 +7212,7 @@ print_optical_drive_data()
|
|||
rw_support='none'
|
||||
fi
|
||||
|
||||
drive_data="${C1}Features: speed:${C2} $speed$multisession$audio ${C1}dvd:${C2} $dvd ${C1}rw:${C2} $rw_support$state"
|
||||
drive_data="${C1}Features: speed$SEP3${C2} $speed$multisession$audio ${C1}dvd$SEP3${C2} $dvd ${C1}rw$SEP3${C2} $rw_support$state"
|
||||
drive_data=$( create_print_line "$Line_Starter" "$drive_data" )
|
||||
print_screen_output "$drive_data"
|
||||
fi
|
||||
|
@ -7231,7 +7244,7 @@ print_partition_data()
|
|||
|
||||
if [[ $B_SHOW_PARTITIONS_FULL == 'true' ]] || [[ ${a_partition_working[4]} == 'main' ]];then
|
||||
if [[ -n ${a_partition_working[2]} ]];then
|
||||
partition_used=" ${C1}used:${C2} ${a_partition_working[2]} (${a_partition_working[3]})"
|
||||
partition_used=" ${C1}used$SEP3${C2} ${a_partition_working[2]} (${a_partition_working[3]})"
|
||||
else
|
||||
partition_used='' # reset partition used to null
|
||||
fi
|
||||
|
@ -7240,7 +7253,7 @@ print_partition_data()
|
|||
else
|
||||
full_fs='N/A' # reset partition used to null
|
||||
fi
|
||||
full_fs=" ${C1}fs:${C2} $full_fs"
|
||||
full_fs=" ${C1}fs$SEP3${C2} $full_fs"
|
||||
|
||||
# don't show user names in output
|
||||
if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]];then
|
||||
|
@ -7256,14 +7269,14 @@ print_partition_data()
|
|||
dev_remote='dev'
|
||||
part_dev='N/A'
|
||||
fi
|
||||
full_dev=" ${C1}$dev_remote:${C2} $part_dev"
|
||||
full_dev=" ${C1}$dev_remote$SEP3${C2} $part_dev"
|
||||
if [[ $B_SHOW_LABELS == 'true' && $dev_remote != 'remote' ]];then
|
||||
if [[ -n ${a_partition_working[7]} ]];then
|
||||
part_label="${a_partition_working[7]}"
|
||||
else
|
||||
part_label='N/A'
|
||||
fi
|
||||
full_label=" ${C1}label:${C2} $part_label"
|
||||
full_label=" ${C1}label$SEP3${C2} $part_label"
|
||||
fi
|
||||
if [[ $B_SHOW_UUIDS == 'true' && $dev_remote != 'remote' ]];then
|
||||
if [[ -n ${a_partition_working[8]} ]];then
|
||||
|
@ -7271,7 +7284,7 @@ print_partition_data()
|
|||
else
|
||||
part_uuid='N/A'
|
||||
fi
|
||||
full_uuid=" ${C1}uuid:${C2} $part_uuid"
|
||||
full_uuid=" ${C1}uuid$SEP3${C2} $part_uuid"
|
||||
fi
|
||||
fi
|
||||
if [[ $B_OUTPUT_FILTER == 'true' ]];then
|
||||
|
@ -7280,7 +7293,7 @@ print_partition_data()
|
|||
partitionIdClean=${a_partition_working[0]}
|
||||
fi
|
||||
# because these lines can vary widely, using dynamic length handling here
|
||||
a_partition_data[$counter]="${a_partition_data[$counter]}${C1}ID:${C2}$partitionIdClean ${C1}size:${C2} ${a_partition_working[1]}$partition_used$full_fs$full_dev$full_label$full_uuid "
|
||||
a_partition_data[$counter]="${a_partition_data[$counter]}${C1}ID:${C2} $partitionIdClean ${C1}size$SEP3${C2} ${a_partition_working[1]}$partition_used$full_fs$full_dev$full_label$full_uuid "
|
||||
if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]] || [[ $( calculate_line_length "${a_partition_data[$counter]}" ) -gt $line_max ]];then
|
||||
((counter++))
|
||||
fi
|
||||
|
@ -7358,33 +7371,33 @@ print_ps_item()
|
|||
|
||||
# handle the converted app names, with ~..~ means it didn't have a path
|
||||
if [[ -n $( grep -E '^~.*~$' <<< ${a_ps_data[0]} ) ]];then
|
||||
app_daemon='daemon:'
|
||||
app_daemon='daemon'
|
||||
else
|
||||
app_daemon='command:'
|
||||
app_daemon='command'
|
||||
fi
|
||||
|
||||
app_name=" ${C1}$app_daemon${C2} ${a_ps_data[0]}"
|
||||
app_name=" ${C1}$app_daemon$SEP3${C2} ${a_ps_data[0]}"
|
||||
if [[ ${a_ps_data[0]} != ${a_ps_data[2]} ]];then
|
||||
app_name="$app_name ${C1}(started by:${C2} ${a_ps_data[2]}${C1})${C2}"
|
||||
app_name="$app_name ${C1}(started by$SEP3${C2} ${a_ps_data[2]}${C1})${C2}"
|
||||
fi
|
||||
app_pid=" ${C1}pid:${C2} ${a_ps_data[6]}"
|
||||
app_pid=" ${C1}pid$SEP3${C2} ${a_ps_data[6]}"
|
||||
# ${C1}user:${C2} ${a_ps_data[8]}
|
||||
case $1 in
|
||||
cpu)
|
||||
app_cpu=" ${C1}cpu:${C2} ${a_ps_data[4]}%"
|
||||
app_cpu=" ${C1}cpu$SEP3${C2} ${a_ps_data[4]}%"
|
||||
if [[ $B_EXTRA_DATA == 'true' ]];then
|
||||
extra_data=" ${C1}mem:${C2} ${a_ps_data[7]}MB (${a_ps_data[5]}%)${C2}"
|
||||
extra_data=" ${C1}mem$SEP3${C2} ${a_ps_data[7]}MB (${a_ps_data[5]}%)${C2}"
|
||||
fi
|
||||
;;
|
||||
mem)
|
||||
app_mem=" ${C1}mem:${C2} ${a_ps_data[7]}MB (${a_ps_data[5]}%)${C2}"
|
||||
app_mem=" ${C1}mem$SEP3${C2} ${a_ps_data[7]}MB (${a_ps_data[5]}%)${C2}"
|
||||
if [[ $B_EXTRA_DATA == 'true' ]];then
|
||||
extra_data=" ${C1}cpu:${C2} ${a_ps_data[4]}%"
|
||||
extra_data=" ${C1}cpu$SEP3${C2} ${a_ps_data[4]}%"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
(( line_counter++ ))
|
||||
count_nu="${C1}$line_counter -${C2}"
|
||||
count_nu="${C1}$line_counter:${C2}"
|
||||
full_line="$count_nu$app_cpu$app_mem$app_name$app_pid$extra_data"
|
||||
ps_data=$( create_print_line " " "$full_line" )
|
||||
print_screen_output "$ps_data"
|
||||
|
@ -7454,7 +7467,7 @@ print_repo_data()
|
|||
print_script_version()
|
||||
{
|
||||
local script_patch_number=$( get_patch_version_string )
|
||||
local script_version="${C1}$SCRIPT_NAME${C2} $SCRIPT_VERSION_NUMBER$script_patch_number${CN}"
|
||||
local script_version="${C1}$SCRIPT_NAME$SEP3${C2} $SCRIPT_VERSION_NUMBER$script_patch_number${CN}"
|
||||
# great trick from: http://ideatrash.net/2011/01/bash-string-padding-with-sed.html
|
||||
# left pad: sed -e :a -e 's/^.\{1,80\}$/& /;ta'
|
||||
# right pad: sed -e :a -e 's/^.\{1,80\}$/ &/;ta'
|
||||
|
@ -7497,17 +7510,17 @@ print_sensors_data()
|
|||
else
|
||||
cpu_temp='N/A'
|
||||
fi
|
||||
cpu_temp="${C1}System Temperatures: cpu:${C2} $cpu_temp "
|
||||
cpu_temp="${C1}System Temperatures: cpu$SEP3${C2} $cpu_temp "
|
||||
|
||||
if [[ -n ${a_sensors_working[1]} ]];then
|
||||
mobo_temp=${a_sensors_working[1]}
|
||||
else
|
||||
mobo_temp='N/A'
|
||||
fi
|
||||
mobo_temp="${C1}mobo:${C2} $mobo_temp "
|
||||
mobo_temp="${C1}mobo$SEP3${C2} $mobo_temp "
|
||||
|
||||
if [[ -n ${a_sensors_working[2]} ]];then
|
||||
psu_temp="${C1}psu:${C2} ${a_sensors_working[2]} "
|
||||
psu_temp="${C1}psu$SEP3${C2} ${a_sensors_working[2]} "
|
||||
fi
|
||||
gpu_temp=$( get_gpu_temp_data )
|
||||
# dump the unneeded screen data for single gpu systems
|
||||
|
@ -7515,7 +7528,7 @@ print_sensors_data()
|
|||
gpu_temp=$( cut -d ':' -f 2 <<< $gpu_temp )
|
||||
fi
|
||||
if [[ -n $gpu_temp ]];then
|
||||
gpu_temp="${C1}gpu:${C2} ${gpu_temp} "
|
||||
gpu_temp="${C1}gpu$SEP3${C2} ${gpu_temp} "
|
||||
fi
|
||||
;;
|
||||
# then the fan data from main fan array
|
||||
|
@ -7532,18 +7545,18 @@ print_sensors_data()
|
|||
else
|
||||
cpu_fan='N/A'
|
||||
fi
|
||||
cpu_fan="${C1}Fan Speeds (in rpm): cpu:${C2} $cpu_fan "
|
||||
cpu_fan="${C1}Fan Speeds (in rpm): cpu$SEP3${C2} $cpu_fan "
|
||||
(( fan_count++ ))
|
||||
;;
|
||||
1)
|
||||
if [[ -n ${a_sensors_working[1]} ]];then
|
||||
mobo_fan="${C1}mobo:${C2} ${a_sensors_working[1]} "
|
||||
mobo_fan="${C1}mobo$SEP3${C2} ${a_sensors_working[1]} "
|
||||
(( fan_count++ ))
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
if [[ -n ${a_sensors_working[2]} ]];then
|
||||
ps_fan="${C1}psu:${C2} ${a_sensors_working[2]} "
|
||||
ps_fan="${C1}psu$SEP3${C2} ${a_sensors_working[2]} "
|
||||
(( fan_count++ ))
|
||||
fi
|
||||
;;
|
||||
|
@ -7552,9 +7565,9 @@ print_sensors_data()
|
|||
fan_number=$(( $j - 2 )) # sys fans start on array key 5
|
||||
# wrap after fan 6 total
|
||||
if [[ $fan_count -lt 7 ]];then
|
||||
sys_fans="$sys_fans${C1}sys-$fan_number:${C2} ${a_sensors_working[$j]} "
|
||||
sys_fans="$sys_fans${C1}sys-$fan_number$SEP3${C2} ${a_sensors_working[$j]} "
|
||||
else
|
||||
sys_fans2="$sys_fans2${C1}sys-$fan_number:${C2} ${a_sensors_working[$j]} "
|
||||
sys_fans2="$sys_fans2${C1}sys-$fan_number$SEP3${C2} ${a_sensors_working[$j]} "
|
||||
fi
|
||||
(( fan_count++ ))
|
||||
fi
|
||||
|
@ -7571,9 +7584,9 @@ print_sensors_data()
|
|||
fan_number=$(( $j + 1 )) # sys fans start on array key 5
|
||||
# wrap after fan 6 total
|
||||
if [[ $fan_count -lt 7 ]];then
|
||||
sys_fans="$sys_fans${C1}fan-$fan_number:${C2} ${a_sensors_working[$j]} "
|
||||
sys_fans="$sys_fans${C1}fan-$fan_number$SEP3${C2} ${a_sensors_working[$j]} "
|
||||
else
|
||||
sys_fans2="$sys_fans2${C1}fan-$fan_number:${C2} ${a_sensors_working[$j]} "
|
||||
sys_fans2="$sys_fans2${C1}fan-$fan_number$SEP3${C2} ${a_sensors_working[$j]} "
|
||||
fi
|
||||
(( fan_count++ ))
|
||||
fi
|
||||
|
@ -7631,11 +7644,11 @@ print_system_data()
|
|||
desktop_environment="tty$tty_session"
|
||||
desktop_type='Console'
|
||||
fi
|
||||
de_distro_string="${C1}$desktop_type${C2} $desktop_environment ${C1}Distro${C2} $distro"
|
||||
de_distro_string="${C1}$desktop_type${C2} $desktop_environment ${C1}Distro$SEP3${C2} $distro"
|
||||
if [[ $B_EXTRA_DATA == 'true' ]];then
|
||||
gcc_string=$( get_gcc_kernel_version )
|
||||
if [[ -n $gcc_string ]];then
|
||||
gcc_string=", ${C1}gcc${C2} $gcc_string"
|
||||
gcc_string=", ${C1}gcc$SEP3${C2} $gcc_string"
|
||||
fi
|
||||
fi
|
||||
# check for 64 bit first
|
||||
|
@ -7654,10 +7667,10 @@ print_system_data()
|
|||
host_name='N/A'
|
||||
fi
|
||||
fi
|
||||
host_string="${C1}Host${C2} $host_name "
|
||||
system_data=$( create_print_line "System:" "${C1}Host${C2} $host_name ${C1}Kernel${C2}" )
|
||||
host_string="${C1}Host$SEP3${C2} $host_name "
|
||||
system_data=$( create_print_line "System:" "$host_string$host_name ${C1}Kernel$SEP3${C2}" )
|
||||
fi
|
||||
host_kernel_string="$host_string${C1}Kernel${C2} $current_kernel$bits "
|
||||
host_kernel_string="$host_string${C1}Kernel$SEP3${C2} $current_kernel$bits "
|
||||
if [[ $( calculate_line_length "$host_kernel_string$de_distro_string" ) -lt $LINE_MAX ]];then
|
||||
system_data="$host_kernel_string$de_distro_string"
|
||||
system_data=$( create_print_line "System:" "$system_data" )
|
||||
|
@ -7698,23 +7711,23 @@ print_unmounted_partition_data()
|
|||
else
|
||||
full_size=${a_unmounted_data[1]}
|
||||
fi
|
||||
full_size="${C1}size:${C2} $full_size"
|
||||
full_size="${C1}size$SEP3${C2} $full_size"
|
||||
if [[ -z ${a_unmounted_data[2]} ]];then
|
||||
full_label='N/A'
|
||||
else
|
||||
full_label=${a_unmounted_data[2]}
|
||||
fi
|
||||
full_label="${C1}label:${C2} $full_label"
|
||||
full_label="${C1}label$SEP3${C2} $full_label"
|
||||
if [[ -z ${a_unmounted_data[3]} ]];then
|
||||
full_uuid='N/A'
|
||||
else
|
||||
full_uuid=${a_unmounted_data[3]}
|
||||
fi
|
||||
full_uuid="${C1}uuid:${C2} $full_uuid"
|
||||
full_uuid="${C1}uuid$SEP3${C2} $full_uuid"
|
||||
if [[ -z ${a_unmounted_data[4]} ]];then
|
||||
full_fs=''
|
||||
else
|
||||
full_fs="${C1}fs:${C2} ${a_unmounted_data[4]}"
|
||||
full_fs="${C1}fs$SEP3${C2} ${a_unmounted_data[4]}"
|
||||
fi
|
||||
full_string="$full_dev $full_size $full_label $full_uuid $full_fs"
|
||||
if [[ $i -eq 0 ]];then
|
||||
|
|
Loading…
Reference in a new issue