From 20be4e31ac2b317af85be4e5022f3931b229ad6e Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Thu, 27 Mar 2014 17:48:32 -0400 Subject: Imported Upstream version 2.1.11 --- inxi | 494 +++++++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 306 insertions(+), 188 deletions(-) (limited to 'inxi') diff --git a/inxi b/inxi index 625bfde..bacbf65 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/usr/bin/env bash ######################################################################## #### Script Name: inxi -#### Version: 2.1.7 -#### Date: 2014-03-18 +#### Version: 2.1.11 +#### Date: 2014-03-26 #### Patch Number: 00 ######################################################################## #### SPECIAL THANKS @@ -108,6 +108,7 @@ #### * Note: [[ -n $something ]] - double brackets does not require quotes for variables: ie, "$something". #### * Always use quotes, double or single, for all string values. #### * All new code/methods must be in a function. + #### * For all boolean tests, use 'true' / 'false'. #### !! Do NOT use 0 or 1 unless it's a function return. #### * Avoid complicated tests in the if condition itself. @@ -490,6 +491,8 @@ SEP2=' ' SEP3_IRC='' SEP3_CONSOLE=':' SEP3='' # do not set, will be set dynamically +LINE1='---------------------------------------------------------------------------' +LINE2='- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -' # Default indentation level. NOTE: actual indent is 1 greater to allow for spacing INDENT=10 @@ -605,7 +608,7 @@ DISTROS_OS_RELEASE_GOOD="arch-release SuSE-release" ## OUTPUT FILTERS/SEARCH ## # Note that \ bans only words, not parts of strings; in \ you can't use punctuation characters like . or , # we're saving about 10+% of the total script exec time by hand building the ban lists here, using hard quotes. -BAN_LIST_NORMAL='chipset|components|computing|computer|corporation|communications|electronics|electrical|electric|gmbh|group|industrial|international|revision|semiconductor|software|technologies|technology|ltd\.|\|inc\.|\|intl\.|co\.|\|corp\.|\|\(tm\)|\(r\)|®|\(rev ..\)' +BAN_LIST_NORMAL='chipset|components|computing|computer|corporation|communications|electronics|electrical|electric|gmbh|group|incorporation|industrial|international|nee|revision|semiconductor|software|technologies|technology|ltd\.|\|inc\.|\|intl\.|co\.|\|corp\.|\|\(tm\)|\(r\)|®|\(rev ..\)' BAN_LIST_CPU='@|cpu deca|dual core|dual-core|tri core|tri-core|quad core|quad-core|ennea|genuine|hepta|hexa|multi|octa|penta|processor|single|triple|[0-9\.]+ *[MmGg][Hh][Zz]' SENSORS_GPU_SEARCH='intel|radeon|nouveau' @@ -676,16 +679,12 @@ main() # comes after source for user set stuff if [[ $B_IRC == 'false' ]];then COLS_MAX=$COLS_MAX_CONSOLE - SEP3=$SEP3_CONSOLE else - # too hard to read if no colors, so force that for users on irc - if [[ $SCHEME == 0 ]];then - SEP3=$SEP3_CONSOLE - else - SEP3=$SEP3_IRC - fi COLS_MAX=$COLS_MAX_IRC fi +# echo SCHEME $SCHEME +# echo B_IRC $B_IRC +# echo sep3: $SEP3 COLS_INNER=$(( $COLS_MAX - $INDENT - 1 )) # echo cm: $COLS_MAX ci: $COLS_INNER # Check for dependencies BEFORE running ANYTHING else except above functions @@ -780,6 +779,16 @@ main() set_color_scheme $color_scheme fi fi + if [[ $B_IRC == 'false' ]];then + SEP3=$SEP3_CONSOLE + else + # too hard to read if no colors, so force that for users on irc + if [[ $SCHEME == 0 ]];then + SEP3=$SEP3_CONSOLE + else + SEP3=$SEP3_IRC + fi + fi # all the pre-start stuff is in place now B_SCRIPT_UP='true' @@ -788,10 +797,6 @@ main() # then create the output print_it_out - ## last steps - if [[ $B_IRC == 'false' && $SCHEME -gt 0 ]];then - echo -n "" - fi eval $LOGFE # weechat's executor plugin forced me to do this, and rightfully so, because else the exit code # from the last command is taken.. @@ -810,12 +815,12 @@ main() initialize_data() { eval $LOGFS - BSD_VERSION=$( uname -s 2>/dev/null | tr '[A-Z]' '[a-z]' ) - + BSD_VERSION=$( uname -s 2>/dev/null ) + BSD_VERSION=${BSD_VERSION,,} # note: archbsd says they are a freebsd distro, so assuming it's the same as freebsd - if [[ -n $( grep 'bsd' <<< "$BSD_VERSION" ) ]];then + if [[ -z ${BSD_VERSION/*bsd*/} ]];then # GNU/kfreebsd will by definition have GNU tools like sed/grep - if [[ -n $( grep 'kfreebsd' <<< "$BSD_VERSION" ) ]];then + if [[ -z ${BSD_VERSION/*kfreebsd*/} ]];then BSD_TYPE='debian-bsd' # debian gnu bsd else BSD_TYPE='bsd' # all other bsds @@ -962,7 +967,6 @@ initialize_paths() # echo "PATH='$PATH'" ##/bin/sh -c 'echo "PATH in subshell=\"$PATH\""' } - # No args taken. check_recommended_apps() { @@ -1098,6 +1102,11 @@ set_color_scheme() C2="${!a_output_colors[1]}" CN="${!a_output_colors[2]}" # ((COLOR_SCHEME++)) ## note: why is this? ## + # handle some explicit colors that are used for no color 0 + if [[ $SCHEME -eq 0 ]];then + NORMAL='' + RED='' + fi eval $LOGFE } @@ -1135,18 +1144,17 @@ select_default_color_scheme() fi # first make output neutral so it's just plain default for console client set_color_scheme "0" + # print_lines_basic "0" "" "" if [[ $B_IRC == 'false' ]];then - print_screen_output "Welcome to $SCRIPT_NAME! Please select the default $COLOR_SELECTION color scheme." + print_lines_basic "0" "" "Welcome to $SCRIPT_NAME! Please select the default $COLOR_SELECTION color scheme." # print_screen_output "You will see this message only one time per user account, unless you set preferences in: /etc/$SCRIPT_NAME.conf" print_screen_output " " fi - print_screen_output "Because there is no way to know your $COLOR_SELECTION foreground/background colors, you can" - print_screen_output "set your color preferences from color scheme option list below. 0 is no colors, 1 neutral." - print_screen_output "After these, there are 3 sets: 1-dark or light backgrounds; 2-light backgrounds; 3-dark backgrounds." + print_lines_basic "0" "" "Because there is no way to know your $COLOR_SELECTION foreground/background colors, you can set your color preferences from color scheme option list below. 0 is no colors, 1 neutral. After these, there are 3 sets: 1-dark or light backgrounds; 2-light backgrounds; 3-dark backgrounds." if [[ $B_IRC == 'false' ]];then - print_screen_output "Please note that this will set the $COLOR_SELECTION preferences only for user: $(whoami)" + print_lines_basic "0" "" "Please note that this will set the $COLOR_SELECTION preferences only for user: $(whoami)" fi - print_screen_output "------------------------------------------------------------------------------" + print_screen_output "$LINE1" for (( i=0; i < ${#A_COLOR_SCHEMES[@]}; i++ )) do if [[ $i -gt 9 ]];then @@ -1167,19 +1175,19 @@ select_default_color_scheme() if [[ $B_IRC == 'false' ]];then echo -n "" + print_screen_output "$irc_clear $i)${spacer}Remove all color settings. Restore $SCRIPT_NAME default." print_screen_output "$irc_clear $(($i+1)))${spacer}Continue, no changes or config file setting." print_screen_output "$irc_clear $(($i+2)))${spacer}Exit, use another terminal, or set manually." - print_screen_output "------------------------------------------------------------------------------" - print_screen_output "Simply type the number for the color scheme that looks best to your eyes for your $COLOR_SELECTION settings" - print_screen_output "and hit ENTER. NOTE: You can bring this option list up by starting $SCRIPT_NAME with option: -c plus one of these numbers:" - print_screen_output "94 (console, no X - $console); 95 (terminal, X - $virt_term); 96 (irc, gui, X - $irc_gui);" - print_screen_output "97 (irc, X, in terminal - $irc_x_term); 98 (irc, no X - $irc_console); 99 (global - $global)" + print_screen_output "$LINE1" + print_lines_basic "0" "" "Simply type the number for the color scheme that looks best to your eyes for your $COLOR_SELECTION settings and hit ENTER. NOTE: You can bring this option list up by starting $SCRIPT_NAME with option: -c plus one of these numbers:" + print_lines_basic "0" "" "94^(console,^no X^-^$console); 95^(terminal,^X^-^$virt_term); 96^(irc,^gui,^X^-^$irc_gui); 97^(irc,^X,^in^terminal^-^$irc_x_term); 98^(irc,^no^X^-^$irc_console); 99^(global^-^$global)" + print_lines_basic "0" "" "" print_screen_output "Your selection(s) will be stored here: $config_file" - print_screen_output "Global overrides all individual color schemes. Individual schemes remove the global setting." - print_screen_output "------------------------------------------------------------------------------" + print_lines_basic "0" "" "Global overrides all individual color schemes. Individual schemes remove the global setting." + print_screen_output "$LINE1" read user_selection - if [[ -n $( grep -Es '^([0-9]+)$' <<< "$user_selection" ) && $user_selection -lt $i ]];then + if [[ "$user_selection" =~ ^([0-9]+)$ && $user_selection -lt $i ]];then case $COLOR_SELECTION in irc) config_variable='IRC_COLOR_SCHEME' @@ -1209,7 +1217,7 @@ select_default_color_scheme() touch $config_file fi if [[ -z $( grep -s "$config_variable=" $config_file ) ]];then - print_screen_output "Creating and updating config file for $COLOR_SELECTION color scheme now..." + print_lines_basic "0" "" "Creating and updating config file for $COLOR_SELECTION color scheme now..." echo "$config_variable=$user_selection" >> $config_file else print_screen_output "Updating config file for $COLOR_SELECTION color scheme now..." @@ -1231,7 +1239,7 @@ select_default_color_scheme() -e '/IRC_COLOR_SCHEME=/d' -e '/IRC_CONS_COLOR_SCHEME=/d' -e '/IRC_X_TERM_COLOR_SCHEME=/d' $config_file set_color_scheme $DEFAULT_COLOR_SCHEME elif [[ $user_selection == $(( $i+1 )) ]];then - print_screen_output "Ok, continuing $SCRIPT_NAME unchanged. You can set the colors anytime by starting with: -c 95 to 99" + print_lines_basic "0" "" "Ok, continuing $SCRIPT_NAME unchanged. You can set the colors anytime by starting with: -c 95 to 99" if [[ -n $CONSOLE_COLOR_SCHEME && -z $DISPLAY ]];then set_color_scheme $CONSOLE_COLOR_SCHEME elif [[ -n $VIRT_TERM_COLOR_SCHEME ]];then @@ -1249,9 +1257,8 @@ select_default_color_scheme() select_default_color_scheme fi else - print_screen_output "------------------------------------------------------------------------------" - print_screen_output "After finding the scheme number you like, simply run this again in a terminal to set the configuration" - print_screen_output "data file for your irc client. You can set color schemes for the following: start inxi with -c plus:" + print_screen_output "$LINE1" + print_lines_basic "0" "" "After finding the scheme number you like, simply run this again in a terminal to set the configuration data file for your irc client. You can set color schemes for the following: start inxi with -c plus:" print_screen_output "94 (console, no X - $console); 95 (terminal, X - $virt_term); 96 (irc, gui, X - $irc_gui);" print_screen_output "97 (irc, X, in terminal - $irc_x_term); 98 (irc, no X - $irc_console); 99 (global - $global)" exit 0 @@ -1579,8 +1586,13 @@ debug_data_collector() lscpu &> $debug_data_dir/lscpu.txt lspci &> $debug_data_dir/lspci.txt + lspci -k &> $debug_data_dir/lspci-k.txt + lspci -knn &> $debug_data_dir/lspci-knn.txt lspci -n &> $debug_data_dir/lspci-n.txt lspci -nn &> $debug_data_dir/lspci-nn.txt + lspci -mm &> $debug_data_dir/lspci-mm.txt + lspci -mmnn &> $debug_data_dir/lspci-mmnn.txt + lspci -mmnnv &> $debug_data_dir/lspci-mmnnv.txt lspci -v &> $debug_data_dir/lspci-v.txt lsusb &> $debug_data_dir/lsusb.txt ps aux &> $debug_data_dir/ps-aux.txt @@ -1670,12 +1682,12 @@ debug_data_collector() if [[ -e $FILE_XORG_LOG ]];then cat $FILE_XORG_LOG &> $debug_data_dir/xorg-log-file.txt else - touch $debug_data_dir/no-xorg-log-file + touch $debug_data_dir/xorg-log-file-absent fi if [[ -e /etc/X11/xorg.conf ]];then cat /etc/X11/xorg.conf &> $debug_data_dir/xorg-conf.txt else - touch $debug_data_dir/no-xorg-conf-file + touch $debug_data_dir/xorg-conf-file-absent fi if [[ -n $( ls /etc/X11/xorg.conf.d/ 2>/dev/null ) ]];then ls /etc/X11/xorg.conf.d &> $debug_data_dir/ls-etc-x11-xorg-conf-d.txt @@ -1685,7 +1697,7 @@ debug_data_collector() cat /etc/X11/xorg.conf.d/$xorg_file &> $debug_data_dir/xorg-conf-d-$xorg_file.txt done else - touch $debug_data_dir/no-xorg-conf-d-files + touch $debug_data_dir/xorg-conf-d-files-absent fi echo 'Collecting X, xprop, glxinfo, xrandr, xdpyinfo data...' xprop -root &> $debug_data_dir/xprop_root.txt @@ -1793,7 +1805,7 @@ debug_data_collector() check_recommends_user_output() { - local Line='-----------------------------------------------------------------------------------------' + local Line=$LINE1 local gawk_version='N/A' sed_version='N/A' sudo_version='N/A' python_version='N/A' if [[ $B_IRC == 'true' ]];then @@ -1802,9 +1814,7 @@ check_recommends_user_output() fi initialize_paths - - echo "$SCRIPT_NAME will now begin checking for the programs it needs to operate. First a check of" - echo "the main languages and tools $SCRIPT_NAME uses. Python is only for debugging data collection." + print_lines_basic "0" "" "$SCRIPT_NAME will now begin checking for the programs it needs to operate. First a check of the main languages and tools $SCRIPT_NAME uses. Python is only for debugging data collection." echo $Line echo "Bash version: $( bash --version 2>&1 | awk 'BEGIN {IGNORECASE=1} /^GNU bash/ {print $4}' )" if type -p gawk &>/dev/null;then @@ -1828,26 +1838,32 @@ check_recommends_user_output() echo "Sudo version: $sudo_version" echo "Python version: $python_version" echo $Line + echo "Test One: Required System Directories." - echo "If one of these system directories is missing, $SCRIPT_NAME cannot operate:" + print_lines_basic "0" "" "If one of these system directories is missing, $SCRIPT_NAME cannot operate:" echo check_recommends_items 'required-dirs' + echo "Test Two: Required Core Applications." - echo "If one of these applications is missing, $SCRIPT_NAME cannot operate:" + print_lines_basic "0" "" "If one of these applications is missing, $SCRIPT_NAME cannot operate:" echo check_recommends_items 'required-apps' - echo 'Test Three: Script Recommends for Graphics Features. If you do not use X these do not matter.' - echo "If one of these applications is missing, $SCRIPT_NAME will have incomplete output:" + + print_lines_basic "0" "" "Test Three: Script Recommends for Graphics Features." + print_lines_basic "0" "" "NOTE: If you do not use X these do not matter (like a headless server). Otherwise, if one of these applications is missing, $SCRIPT_NAME will have incomplete output:" echo check_recommends_items 'recommended-x-apps' + echo 'Test Four: Script Recommends for Remaining Features.' - echo "If one of these applications is missing, $SCRIPT_NAME will have incomplete output:" + print_lines_basic "0" "" "If one of these applications is missing, $SCRIPT_NAME will have incomplete output:" echo check_recommends_items 'recommended-apps' + echo 'Test Five: System Directories for Various Information.' - echo "If one of these directories is missing, $SCRIPT_NAME will have incomplete output:" + print_lines_basic "0" "" "If one of these directories is missing, $SCRIPT_NAME will have incomplete output:" echo check_recommends_items 'system-dirs' + echo 'All tests completed.' } # args: $1 - check item @@ -1856,7 +1872,7 @@ check_recommends_items() local item='' item_list='' item_string='' missing_items='' missing_string='' local package='' application='' feature='' type='' starter='' finisher='' local package_deb='' package_pacman='' package_rpm='' - local print_string='' separator='' + local print_string='' separator='' width=56 local required_dirs='/proc /sys' # package-owner: 1 - debian/ubuntu; 2 - arch; 3 - yum/rpm # pardus: pisi sf -q /usr/bin/package @@ -1900,34 +1916,47 @@ check_recommends_items() /var/run/dmesg.boot:-C,-f_(BSD_only) ' + if [[ -n $COLS_INNER ]];then + if [[ $COLS_INNER -ge 90 ]];then + width=${#LINE1} # match width of $LINE1 + elif [[ $COLS_INNER -ge 78 ]];then + width=$(( $COLS_INNER - 11 )) + fi + fi + case $1 in required-dirs) item_list=$required_dirs item_string='Required file system' + item_string='' missing_string='system directories' type='directories' ;; required-apps) item_list=$required_apps item_string='Required application' + item_string='' missing_string='applications, and their corresponding packages,' type='applications' ;; recommended-x-apps) item_list=$x_recommends item_string='Recommended X application' + item_string='' missing_string='applications, and their corresponding packages,' type='applications' ;; recommended-apps) item_list=$recommended_apps item_string='Recommended application' + item_string='' missing_string='applications, and their corresponding packages,' type='applications' ;; system-dirs) item_list=$recommended_dirs item_string='System directory' + item_string='' missing_string='system directories' type='directories' ;; @@ -1960,12 +1989,12 @@ check_recommends_items() fi fi if [[ -n $feature ]];then - print_string="$item_string: $application (info: $( sed 's/_/ /g' <<< $feature ))" + print_string="$item_string$application (info: $( sed 's/_/ /g' <<< $feature ))" else - print_string="$item_string: $application" + print_string="$item_string$application" fi - starter="$( sed -e :a -e 's/^.\{1,75\}$/&./;ta' <<< $print_string )" + starter="$( sed -e :a -e 's/^.\{1,'$width'\}$/&./;ta' <<< $print_string )" if [[ -z $( grep '^/' <<< $application ) && -n $location ]] || [[ -d $application ]];then if [[ -n $location ]];then finisher=" $location" @@ -1987,21 +2016,20 @@ check_recommends_items() do application=$( cut -d ':' -f 1 <<< $item ) if [[ $type == 'applications' ]];then - # echo '--------------------------------------------------------' echo package=$( cut -d ':' -f 2 <<< $item ) package_deb=$( cut -d '~' -f 1 <<< $package ) package_pacman=$( cut -d '~' -f 2 <<< $package ) package_rpm=$( cut -d '~' -f 3 <<< $package ) echo "Application: $application" - echo "To add to your system, install the proper distribution package for your system:" - echo "Debian/Ubuntu: $package_deb :: Arch Linux: $package_pacman :: Redhat/Fedora/Suse: $package_rpm" + print_lines_basic "0" "" "To add to your system, install the proper distribution package for your system:" + print_lines_basic "0" "" "Debian/Ubuntu:^$package_deb^:: Arch Linux:^$package_pacman^:: Redhat/Fedora/Suse:^$package_rpm" else echo "Directory: $application" fi done if [[ $item_string == 'System directory' ]];then - echo "These directories are created by the kernel, so don't worry if they are not present." + print_lines_basic "0" "" "These directories are created by the kernel, so don't worry if they are not present." fi else echo "All the $( cut -d ' ' -f 1 <<< $item_string | sed -e 's/Re/re/' -e 's/Sy/sy/' ) $type are present." @@ -2060,7 +2088,7 @@ print_screen_output() create_print_line() { eval $LOGFS - local line=$2 + local line=${2% } #trim off trailing space if present, note: ${CN} may hide the actual trailing end space printf "${C1}%-${INDENT}s${C2} %s" "$1" "$line" eval $LOGFE } @@ -2134,7 +2162,7 @@ get_parameters() B_SHOW_NETWORK='true' B_SHOW_SYSTEM='true' ;; - c) if [[ -n $( grep -E '^[0-9][0-9]?$' <<< $OPTARG ) ]];then + c) if [[ $OPTARG =~ ^[0-9][0-9]?$ ]];then case $OPTARG in 99) B_RUN_COLOR_SELECTOR='true' @@ -2255,7 +2283,7 @@ get_parameters() S) B_SHOW_SYSTEM='true' use_short='false' ;; - t) if [[ -n $( grep -E '^(c|m|cm|mc)([1-9]|1[0-9]|20)?$' <<< $OPTARG ) ]];then + t) if [[ $OPTARG =~ ^(c|m|cm|mc)([1-9]|1[0-9]|20)?$ ]];then use_short='false' if [[ -n $( grep -E '[0-9]+' <<< $OPTARG ) ]];then PS_COUNT=$( sed 's/[^0-9]//g' <<< $OPTARG ) @@ -2274,7 +2302,7 @@ get_parameters() B_SHOW_PARTITIONS='true' use_short='false' ;; - v) if [[ -n $( grep -E "^[0-9][0-9]?$" <<< $OPTARG ) && $OPTARG -le $VERBOSITY_LEVELS ]];then + v) if [[ $OPTARG =~ ^[0-9][0-9]?$ && $OPTARG -le $VERBOSITY_LEVELS ]];then if [[ $OPTARG -ge 1 ]];then use_short='false' B_SHOW_BASIC_CPU='true' @@ -3108,18 +3136,16 @@ get_irc_client_version() ;; esac ;; - supybot|limnoria) - # ff=$(nano --version);ff=( $ff );time for ((i=0;i<1000;i++)); do ff=${ff[3]};done;echo $ff - # time for ((i=0;i<1000;i++)); do ff=$(nano --version| gawk 'NR == 1 {print $4}' );done;echo $ff - # ff=$(nano --version);time for ((i=0;i<1000;i++)); do ff=$(gawk 'NR == 1 {print $4}' <<< $ff );done;echo $ff - IRC_CLIENT_VERSION=" $( $Irc_Client_Path --version | gawk 'NR == 1 { - print $2 - }' )" - if [[ -n $IRC_CLIENT_VERSION ]] && \ - [[ -n $( grep 'limnoria' <<< $IRC_CLIENT_VERSION ) || $App_Working_Name == 'limnoria' ]];then - IRC_CLIENT="Limnoria" - else - IRC_CLIENT="Supybot" + gribble|limnoria|supybot) + IRC_CLIENT_VERSION=" $( get_program_version 'supybot' '^Supybot' '2' )" + if [[ -n $IRC_CLIENT_VERSION ]];then + if [[ -n ${IRC_CLIENT_VERSION/*gribble*/} || $App_Working_Name == 'gribble' ]];then + IRC_CLIENT="Gribble" + elif [[ -n ${IRC_CLIENT_VERSION/*limnoria*/} || $App_Working_Name == 'limnoria' ]];then + IRC_CLIENT="Limnoria" + else + IRC_CLIENT="Supybot" + fi fi ;; weechat|weechat-curses) @@ -3167,11 +3193,11 @@ get_irc_client_version() esac done B_CONSOLE_IRC='true' - set_perl_python_konvi "$App_Working_Name" + set_perl_python_client_data "$App_Working_Name" ;; python*) # B_CONSOLE_IRC='true' # are there even any python type console irc clients? check. - set_perl_python_konvi "$App_Working_Name" + set_perl_python_client_data "$App_Working_Name" ;; # then unset, set unknown data *) @@ -3185,23 +3211,46 @@ get_irc_client_version() } # args: $1 - App_Working_Name -set_perl_python_konvi() +set_perl_python_client_data() { if [[ -z $IRC_CLIENT_VERSION ]];then + local version='' # this is a hack to try to show konversation if inxi is running but started via /cmd - if [[ -n $( grep -i 'konversation' <<< "$Ps_aux_Data" ) && $B_RUNNING_IN_DISPLAY == 'true' ]];then + # OR via script shortcuts, both cases in fact now + if [[ $B_RUNNING_IN_DISPLAY == 'true' && -z ${Ps_aux_Data/*konversation*/} ]];then IRC_CLIENT='Konversation' - IRC_CLIENT_VERSION=" $( konversation --version 2>/dev/null | gawk '/^Konversation/ {print $2}' )" + version=$( get_program_version 'konversation' '^konversation' '2' ) B_CONSOLE_IRC='false' + ## NOTE: supybot only appears in ps aux using 'SHELL' command; the 'CALL' command + ## gives the user system irc priority, and you don't see supybot listed, so use SHELL + elif [[ $B_RUNNING_IN_DISPLAY == 'false' && -z ${Ps_aux_Data/*supybot*/} ]];then + version=$( get_program_version 'supybot' '^Supybot' '2' ) + if [[ -n $version ]];then + IRC_CLIENT_VERSION=" $version" + if [[ -z ${version/*gribble*/} ]];then + IRC_CLIENT='Gribble' + elif [[ -z ${version/*limnoria*/} ]];then + IRC_CLIENT='Limnoria' + else + IRC_CLIENT='Supybot' + fi + else + IRC_CLIENT='Supybot' + # currently all use the same actual app name, this will probably change. + fi + B_CONSOLE_IRC='true' else IRC_CLIENT="Unknown $1 client" fi + if [[ -n $version ]];then + IRC_CLIENT_VERSION=" $version" + fi fi } ## try to infer the use of Konversation >= 1.2, which shows $PPID improperly ## no known method of finding Kovni >= 1.2 as parent process, so we look to see if it is running, -## and all other irc clients are not running. +## and all other irc clients are not running. As of 2014-03-25 this isn't used in my cases is_this_qt4_konvi() { local konvi_qt4_client='' konvi_dbus_exist='' konvi_pid='' konvi_home_dir='' @@ -3670,6 +3719,7 @@ get_cpu_data() } print cpu[i, "model"] "," cpu[i, "speed"] "," cpu[i, "cache"] "," cpu[i, "flags"] "," cpu[i, "bogomips"] "," cpu[nr, "vendor"] "," bArm } + # this is / was used in inxi short output only, but when it is N/A, need to use the previous array # value, from above, the actual speed that is, for short output, key 0. if (!min) { @@ -3985,7 +4035,7 @@ get_desktop_environment() elif [[ $KDE_FULL_SESSION == 'true' ]]; then version_data=$( kded --version 2>/dev/null ) version=$( grep -si '^KDE:' <<< "$version_data" | gawk '{print $2}' ) - # version=$( get_de_app_version 'kded' '^KDE:' '2' ) + # version=$( get_program_version 'kded' '^KDE:' '2' ) if [[ -z $version ]];then version='3.5' fi @@ -3997,7 +4047,7 @@ get_desktop_environment() fi desktop_environment="KDE" elif [[ $XDG_CURRENT_DESKTOP == 'Unity' ]];then - version=$( get_de_app_version 'unity' '^unity' '2' ) + version=$( get_program_version 'unity' '^unity' '2' ) # not certain cinn will always have version, so keep output right if not if [[ -n $version ]];then version="$version " @@ -4020,7 +4070,7 @@ get_desktop_environment() # eventually this needs to be better organized so all the xprop tests are in the same # section, but this is good enough for now. if [[ -n $xprop_root && -n $( grep -is '^_MUFFIN' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'cinnamon' '^cinnamon' '2' ) + version=$( get_program_version 'cinnamon' '^cinnamon' '2' ) # not certain cinn will always have version, so keep output right if not if [[ -n $version ]];then version="$version " @@ -4033,7 +4083,7 @@ get_desktop_environment() fi desktop_environment="Cinnamon" elif [[ -n $xprop_root && -n $( grep -is '^_MARCO' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'mate-about' '^MATE[[:space:]]DESKTOP' 'NF' ) + version=$( get_program_version 'mate-about' '^MATE[[:space:]]DESKTOP' 'NF' ) # not certain cinn/mate will always have version, so keep output right if not if [[ -n $version ]];then version="$version " @@ -4049,9 +4099,9 @@ get_desktop_environment() # https://bugzilla.gnome.org/show_bug.cgi?id=542880 elif [[ -n $GNOME_DESKTOP_SESSION_ID ]]; then if type -p gnome-shell &>/dev/null;then - version=$( get_de_app_version 'gnome-shell' 'gnome' '3' ) + version=$( get_program_version 'gnome-shell' 'gnome' '3' ) elif type -p gnome-about &>/dev/null;then - version=$( get_de_app_version 'gnome-about' 'gnome' '3' ) + version=$( get_program_version 'gnome-about' 'gnome' '3' ) fi if [[ $B_EXTRA_DATA == 'true' ]];then toolkit=$( get_de_gtk_data ) @@ -4068,16 +4118,16 @@ get_desktop_environment() # String: "This is xfdesktop version 4.2.12" # alternate: xfce4-about --version > xfce4-about 4.10.0 (Xfce 4.10) if [[ -n $( grep -Eis '\"xfce4\"' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'xfdesktop' 'xfdesktop[[:space:]]version' '5' ) + version=$( get_program_version 'xfdesktop' 'xfdesktop[[:space:]]version' '5' ) # arch linux reports null, so use alternate if null if [[ -z $version ]];then - version=$( get_de_app_version 'xfce4-panel' '^xfce4-panel' '2' ) + version=$( get_program_version 'xfce4-panel' '^xfce4-panel' '2' ) if [[ -z $version ]];then version='4' fi fi if [[ $B_EXTRA_DATA == 'true' ]];then - toolkit=$( get_de_app_version 'xfdesktop' 'Built[[:space:]]with[[:space:]]GTK' '4' ) + toolkit=$( get_program_version 'xfdesktop' 'Built[[:space:]]with[[:space:]]GTK' '4' ) if [[ -n $toolkit ]];then version="$version (Gtk $toolkit)" fi @@ -4085,16 +4135,16 @@ get_desktop_environment() desktop_environment="Xfce" # when 5 is released, the string may need updating elif [[ -n $( grep -is '\"xfce5\"' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'xfdesktop' 'xfdesktop[[:space:]]version' '5' ) + version=$( get_program_version 'xfdesktop' 'xfdesktop[[:space:]]version' '5' ) # arch linux reports null, so use alternate if null if [[ -z $version ]];then - version=$( get_de_app_version 'xfce5-panel' '^xfce5-panel' '2' ) + version=$( get_program_version 'xfce5-panel' '^xfce5-panel' '2' ) if [[ -z $version ]];then version='5' fi fi if [[ $B_EXTRA_DATA == 'true' ]];then - toolkit=$( get_de_app_version 'xfdesktop' 'Built[[:space:]]with[[:space:]]GTK' '4' ) + toolkit=$( get_program_version 'xfdesktop' 'Built[[:space:]]with[[:space:]]GTK' '4' ) if [[ -n $toolkit ]];then version="$version (Gtk $toolkit)" fi @@ -4102,14 +4152,14 @@ get_desktop_environment() desktop_environment="Xfce" elif [[ -n $( grep -is 'BLACKBOX_PID' <<< "$xprop_root" ) ]];then if [[ -n $( grep -is 'fluxbox' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'fluxbox' '^fluxbox' '2' ) + version=$( get_program_version 'fluxbox' '^fluxbox' '2' ) desktop_environment='Fluxbox' else desktop_environment='Blackbox' fi elif [[ -n $( grep -is 'OPENBOX_PID' <<< "$xprop_root" ) ]];then # note: openbox-lxde --version may be present, but returns openbox data - version=$( get_de_app_version 'openbox' '^openbox' '2' ) + version=$( get_program_version 'openbox' '^openbox' '2' ) if [[ $XDG_CURRENT_DESKTOP == 'LXDE' || \ -n $( grep -is 'lxde' <<< "$Ps_aux_Data" ) ]];then if [[ -n $version ]];then @@ -4125,7 +4175,7 @@ get_desktop_environment() desktop_environment='Openbox' fi elif [[ -n $( grep -is 'ICEWM' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'icewm' '^icewm' '2' ) + version=$( get_program_version 'icewm' '^icewm' '2' ) desktop_environment='IceWM' elif [[ -n $( grep -is 'ENLIGHTENMENT' <<< "$xprop_root" ) ]];then # no -v or --version but version is in xprop -root @@ -4133,10 +4183,10 @@ get_desktop_environment() version=$( grep -is 'ENLIGHTENMENT_VERSION' <<< "$xprop_root" | cut -d '"' -f 2 | gawk '{print $2}' ) desktop_environment='Enlightenment' elif [[ -n $( grep -is '^I3_' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'i3' '^i3' '3' ) + version=$( get_program_version 'i3' '^i3' '3' ) desktop_environment='i3' elif [[ -n $( grep -is 'WINDOWMAKER' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'wmaker' '^Window[[:space:]]*Maker' 'NF' ) + version=$( get_program_version 'wmaker' '^Window[[:space:]]*Maker' 'NF' ) if [[ -n $version ]];then version="$version " fi @@ -4144,14 +4194,14 @@ get_desktop_environment() elif [[ -n $( grep -is '^_WM2' <<< "$xprop_root" ) ]];then # note; there isn't actually a wm2 version available but error handling should cover it and return null # maybe one day they will add it? - version=$( get_de_app_version 'wm2' '^wm2' 'NF' ) + version=$( get_program_version 'wm2' '^wm2' 'NF' ) # not certain will always have version, so keep output right if not if [[ -n $version ]];then version="$version " fi desktop_environment="WM2" elif [[ -n $( grep -is 'herbstluftwm' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'herbstluftwm' '^herbstluftwm' 'NF' ) + version=$( get_program_version 'herbstluftwm' '^herbstluftwm' 'NF' ) if [[ -n $version ]];then version="$version " fi @@ -4162,37 +4212,37 @@ get_desktop_environment() # note that gawk is going to exit after first occurance of search string, so no need for extra if [[ -z $desktop_environment ]];then if [[ -n $( grep -is 'fvwm-crystal' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'fvwm' '^fvwm' '2' ) + version=$( get_program_version 'fvwm' '^fvwm' '2' ) desktop_environment='FVWM-Crystal' elif [[ -n $( grep -is 'fvwm' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'fvwm' '^fvwm' '2' ) + version=$( get_program_version 'fvwm' '^fvwm' '2' ) desktop_environment='FVWM' elif [[ -n $( grep -is 'pekwm' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'pekwm' '^pekwm' '3' ) + version=$( get_program_version 'pekwm' '^pekwm' '3' ) desktop_environment='pekwm' elif [[ -n $( grep -is 'awesome' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'awesome' '^awesome' '2' ) + version=$( get_program_version 'awesome' '^awesome' '2' ) desktop_environment='Awesome' elif [[ -n $( grep -is 'scrotwm' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'scrotwm' '^welcome.*scrotwm' '4' ) + version=$( get_program_version 'scrotwm' '^welcome.*scrotwm' '4' ) desktop_environment='Scrotwm' # no --version for this one elif [[ -n $( grep -is 'spectrwm' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'spectrwm' '^spectrwm.*welcome.*spectrwm' '5' ) + version=$( get_program_version 'spectrwm' '^spectrwm.*welcome.*spectrwm' '5' ) desktop_environment='Spectrwm' # no --version for this one elif [[ -n $( grep -Eis '([[:space:]]|/)twm' <<< "$Ps_aux_Data" ) ]];then desktop_environment='Twm' # no --version for this one elif [[ -n $( grep -Eis '([[:space:]]|/)dwm' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'dwm' '^dwm' '1' ) + version=$( get_program_version 'dwm' '^dwm' '1' ) desktop_environment='dwm' elif [[ -n $( grep -is 'wmii2' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'wmii2' '^wmii2' '1' ) + version=$( get_program_version 'wmii2' '^wmii2' '1' ) desktop_environment='wmii2' # note: in debian at least, wmii is actuall wmii3 elif [[ -n $( grep -is 'wmii' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'wmii' '^wmii' '1' ) + version=$( get_program_version 'wmii' '^wmii' '1' ) desktop_environment='wmii' elif [[ -n $( grep -Eis '([[:space:]]|/)jwm' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'jwm' '^jwm' '2' ) + version=$( get_program_version 'jwm' '^jwm' '2' ) desktop_environment='JWM' fi fi @@ -4207,7 +4257,7 @@ get_desktop_environment() # note: gawk doesn't support white spaces in search string, gave errors, so use [[:space:]] instead # args: $1 - desktop/app command for --version; $2 - search string; $3 - gawk print number -get_de_app_version() +get_program_version() { local version_data='' version='' get_version='--version' @@ -5496,14 +5546,14 @@ get_hard_drive_data_advanced() # this is handles the new /sys data types first if [[ -e /sys/block/${a_temp_working[0]}/device/model ]];then temp_name="$( remove_erroneous_chars /sys/block/${a_temp_working[0]}/device/model )" - temp_name=$( tr ' ' '_' <<< $temp_name | cut -d '-' -f 1 ) + temp_name=$( cut -d '-' -f 1 <<< ${temp_name// /_} ) elif [[ ${#a_temp_scsi[@]} -gt 0 ]];then for (( j=0; j < ${#a_temp_scsi[@]}; j++ )) do ## ok, ok, it's incomprehensible, search /dev/disk/by-id for a line that contains the # discovered disk name AND ends with the correct identifier, sdx # get rid of whitespace for some drive names and ids, and extra data after - in name - temp_name=$( tr ' ' '_' <<< ${a_temp_scsi[$j]} | cut -d '-' -f 1 ) + temp_name=$( cut -d '-' -f 1 <<< ${a_temp_scsi[$j]// /_} ) sd_ls_by_id=$( grep -Em1 ".*$temp_name.*${a_temp_working[0]}$" <<< "$ls_disk_by_id" ) if [[ -n $sd_ls_by_id ]];then @@ -5615,11 +5665,11 @@ get_init_data() if [[ -e /proc/1/comm && -n $( grep -s 'systemd' /proc/1/comm ) ]];then init_type='systemd' if type -p systemd &>/dev/null;then - init_version=$( get_de_app_version 'systemd' '^systemd' '2' ) + init_version=$( get_program_version 'systemd' '^systemd' '2' ) fi if [[ -z $init_version ]];then if type -p systemctl &>/dev/null;then - init_version=$( get_de_app_version 'systemctl' '^systemd' '2' ) + init_version=$( get_program_version 'systemctl' '^systemd' '2' ) fi fi else @@ -5628,11 +5678,11 @@ get_init_data() if [[ -n $( /sbin/init --version 2>/dev/null | grep 'upstart' ) ]];then init_type='Upstart' # /sbin/init --version == init (upstart 1.12.1) - init_version=$( get_de_app_version 'init' 'upstart' '3' ) + init_version=$( get_program_version 'init' 'upstart' '3' ) elif type -p epoch &>/dev/null;then init_type='Epoch' # epoch version == Epoch Init System 1.0.1 "Sage" - init_version=$( get_de_app_version 'epoch' '^Epoch' '4' ) + init_version=$( get_program_version 'epoch' '^Epoch' '4' ) # missing data: # http://smarden.org/runit/sv.8.html elif [[ -e /sbin/runit-init || -e /etc/runit || -n $( type -p sv ) ]];then @@ -5655,10 +5705,10 @@ get_init_data() rc_type='OpenRC' # /sbin/openrc --version == openrc (OpenRC) 0.13 if type -p openrc &>/dev/null;then - rc_version=$( get_de_app_version 'openrc' '^openrc' '3' ) + rc_version=$( get_program_version 'openrc' '^openrc' '3' ) # /sbin/rc --version == rc (OpenRC) 0.11.8 (Gentoo Linux) elif type -p rc &>/dev/null;then - rc_version=$( get_de_app_version 'rc' '^rc' '3' ) + rc_version=$( get_program_version 'rc' '^rc' '3' ) fi ## assume sysvrc, but this data is too buggy and weird and inconsistent to have meaning # leaving this off for now @@ -8298,24 +8348,24 @@ get_shell_data() if [[ $B_EXTRA_DATA == 'true' && -n $shell_type ]];then case $shell_type in bash) - shell_version=$( get_de_app_version "$shell_type" "^GNU[[:space:]]bash,[[:space:]]version" "4" | \ + shell_version=$( get_program_version "$shell_type" "^GNU[[:space:]]bash,[[:space:]]version" "4" | \ sed $SED_RX 's/(\(.*|-release|-version)//' ) ;; # csh/dash use dpkg package version data, debian/buntu only csh) - shell_version=$( get_de_app_version "$shell_type" "^tcsh" "2" ) + shell_version=$( get_program_version "$shell_type" "^tcsh" "2" ) ;; dash) - shell_version=$( get_de_app_version "$shell_type" "$shell_type" "3" ) + shell_version=$( get_program_version "$shell_type" "$shell_type" "3" ) ;; ksh) - shell_version=$( get_de_app_version "$shell_type" "version" "5" ) + shell_version=$( get_program_version "$shell_type" "version" "5" ) ;; tcsh) - shell_version=$( get_de_app_version "$shell_type" "^tcsh" "2" ) + shell_version=$( get_program_version "$shell_type" "^tcsh" "2" ) ;; zsh) - shell_version=$( get_de_app_version "$shell_type" "^zsh" "2" ) + shell_version=$( get_program_version "$shell_type" "^zsh" "2" ) ;; esac fi @@ -8979,6 +9029,11 @@ print_it_out() print_info_data fi fi + ## last steps, clear any lingering colors + if [[ $B_IRC == 'false' && $SCHEME -gt 0 ]];then + echo -n "" + fi + eval $LOGFE } @@ -9113,7 +9168,7 @@ print_audio_data() else alsa_version='N/A' fi - alsa_data="${C1}Sound:${C2} $alsa ${C1}v:$SEP3${C2} $alsa_version" + alsa_data="${C1}Sound$SEP3${C2} $alsa ${C1}v$SEP3${C2} $alsa_version" IFS="$ORIGINAL_IFS" fi # note, error handling is done in the get function, so this will never be null, but @@ -9185,7 +9240,7 @@ print_audio_data() fi fi if [[ -n ${a_audio_working[0]} ]];then - card_string="${C1}Card$card_id:${C2} ${a_audio_working[0]} " + card_string="${C1}Card$card_id$EP3${C2} ${a_audio_working[0]} " audio_data="$audio_driver$port_data$pci_bus_id$chip_id" fi # only print alsa on last line if short enough, otherwise print on its own line @@ -9233,8 +9288,8 @@ print_cpu_data() local a_cpu_working='' cpu_model='' cpu_clock='' cpu_null_error='' local cpc_plural='' cpu_count_print='' model_plural='' cpu_data_string='' local cpu_physical_count='' cpu_core_count='' cpu_core_alpha='' cpu_type='' - local cpu_2_data='' - local line_starter="CPU$cpc_plural:" + local cpu_2_data='' working_cpu='' + local line_starter="CPU$SEP3" multi_cpu_starter="${C1}Clock Speeds$SEP3${C2} " ##print_screen_output "A_CPU_DATA[0]=\"${A_CPU_DATA[0]}\"" # Array A_CPU_DATA always has one extra element: max clockfreq found. @@ -9273,7 +9328,7 @@ print_cpu_data() cpu_count_print="$cpu_physical_count " model_plural='s' fi - + line_starter="CPU$cpc_plural$SEP3" cpu_data_string="$cpu_count_print$cpu_core_alpha core" cpu_data="${C1}$cpu_data_string${C2} ${a_cpu_working[0]}$model_plural ($cpu_type)" if [[ $B_SHOW_CPU == 'true' ]];then @@ -9349,7 +9404,7 @@ print_cpu_data() # echo :${cpu_2_data}: if [[ -n $cpu_2_data && $( calculate_line_length "$cpu_data $cpu_2_data" ) -gt $COLS_INNER ]];then cpu_data=$( create_print_line "$line_starter" "$cpu_data${CN}" ) - line_starter='' + line_starter=' ' print_screen_output "$cpu_data" cpu_data=$( create_print_line " " "$cpu_2_data${CN}" ) print_screen_output "$cpu_data" @@ -9366,17 +9421,28 @@ 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" # 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 # break #fi + # echo $(calculate_line_length "$multi_cpu_starter$SEP3 $cpu_multi_clock_data" ) + working_cpu="${C1}$(( i + 1 ))$SEP3${C2} ${a_cpu_working[1]%.*} MHz " + if [[ -n $cpu_multi_clock_data && \ + $( calculate_line_length "$multi_cpu_starter$cpu_multi_clock_data$working_cpu" ) -gt $COLS_INNER ]];then + cpu_multi_clock_data=$( create_print_line " " "$multi_cpu_starter$cpu_multi_clock_data" ) + print_screen_output "$cpu_multi_clock_data" + multi_cpu_starter='' + cpu_multi_clock_data="$working_cpu" + else + cpu_multi_clock_data="$cpu_multi_clock_data$working_cpu" + fi done - if [[ -n $cpu_multi_clock_data ]];then - cpu_multi_clock_data=$( create_print_line " " "${C1}Clock Speeds:${C2}$cpu_multi_clock_data${CN}" ) - print_screen_output "$cpu_multi_clock_data" - fi + fi + # print the last line if it exists after loop + if [[ -n $cpu_multi_clock_data ]];then + cpu_multi_clock_data=$( create_print_line " " "$multi_cpu_starter$cpu_multi_clock_data" ) + print_screen_output "$cpu_multi_clock_data" fi if [[ $B_CPU_FLAGS_FULL == 'true' ]];then print_cpu_flags_full "${a_cpu_working[3]}" "${a_cpu_working[6]}" @@ -9444,7 +9510,7 @@ print_graphics_data() local spacer='' driver='' driver_string='' driver_plural='' direct_render_string='' local separator_loaded='' separator_unloaded='' separator_failed='' local loaded='' unloaded='' failed='' display_server_string='' - local line_starter='Graphics:' + local line_starter='Graphics:' part_1_data='' part_2_data='' local screen_resolution="$( get_graphics_res_data )" # set A_DISPLAY_SERVER_DATA @@ -9502,7 +9568,7 @@ print_graphics_data() driver="$driver (unloaded: $unloaded)" fi if [[ -n $failed ]];then - driver="$driver ${RED}FAILED:${C2} $failed" + driver="$driver ${RED}FAILED$SEP3${C2} $failed" fi # sometimes for some reason there is no driver found but the array is started if [[ -z $driver ]];then @@ -9536,11 +9602,9 @@ print_graphics_data() fi if [[ -n $root_x_string ]];then - root_x_string="${C1}Advanced Data:${C2} N/A $root_x_string" + root_x_string="${C1}Advanced Data$SEP3${C2} N/A $root_x_string" fi - - display_full_string="$display_server_string$driver_string${C1}$res_tty$SEP3${C2} $screen_resolution $root_x_string" - + if [[ ${#A_GRAPHICS_CARD_DATA[@]} -gt 0 ]];then for (( i=0; i < ${#A_GRAPHICS_CARD_DATA[@]}; i++ )) do @@ -9551,7 +9615,7 @@ print_graphics_data() card_data=${a_graphics_working[0]} if [[ $B_EXTRA_DATA == 'true' ]];then if [[ -n ${a_graphics_working[1]} ]];then - card_bus_id=" ${C1}bus-ID$SEP3${C2} ${a_graphics_working[1]}" + card_bus_id="${a_graphics_working[1]}" if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then if [[ $BSD_TYPE != 'bsd' ]];then chip_id=$( get_lspci_chip_id "${a_graphics_working[1]}" ) @@ -9560,38 +9624,75 @@ print_graphics_data() fi fi else - card_bus_id=" ${C1}bus-ID$SEP3${C2} N/A" + card_bus_id='N/A' fi fi + if [[ -n $card_bus_id ]];then + card_bus_id="${C1}bus-ID$SEP3${C2} $card_bus_id " + fi if [[ -n $chip_id ]];then - chip_id=" ${C1}chip-ID$SEP3${C2} $chip_id" + chip_id="${C1}chip-ID$SEP3${C2} $chip_id" fi if [[ ${#A_GRAPHICS_CARD_DATA[@]} -gt 1 ]];then card_id="-$(($i+1))" fi - graphics_data="${C1}Card$card_id$SEP3${C2} $card_data$card_bus_id$chip_id " + + part_1_data="${C1}Card$card_id$SEP3${C2} $card_data " + part_2_data="$card_bus_id$chip_id" + if [[ ${#A_GRAPHICS_CARD_DATA[@]} -gt 1 ]];then - graphics_data=$( create_print_line "$line_starter" "$graphics_data${CN}" ) - print_screen_output "$graphics_data" + if [[ $( calculate_line_length "$part_1_data$part_2_data" ) -gt $COLS_INNER ]];then + graphics_data=$( create_print_line "$line_starter" "$part_1_data" ) + print_screen_output "$graphics_data" + part_1_data='' + line_starter=' ' + fi + if [[ -n $( grep -vE '^[[:space:]]*$' <<< $part_1_data$part_2_data ) ]];then + graphics_data=$( create_print_line "$line_starter" "$part_1_data$part_2_data" ) + print_screen_output "$graphics_data" + fi + part_1_data='' + part_2_data='' line_starter=' ' graphics_data='' fi done # handle cases where card detection fails, like in PS3, where lspci gives no output, or headless boxes.. else - graphics_data="${C1}Card:${C2} Failed to Detect Video Card! " + part_1_data="${C1}Card$SEP3${C2} Failed to Detect Video Card! " fi - if [[ -n $graphics_data && $( calculate_line_length "$graphics_data$display_full_string" ) -lt $COLS_INNER ]];then - graphics_data=$( create_print_line "$line_starter" "$graphics_data$display_full_string${CN}" ) - else - if [[ -n $graphics_data ]];then - graphics_data=$( create_print_line "$line_starter" "$graphics_data${CN}" ) + # Print cards if not dual card system + if [[ -n $part_1_data$part_2_data ]];then + if [[ $( calculate_line_length "$part_1_data$part_2_data" ) -gt $COLS_INNER ]];then + graphics_data=$( create_print_line "$line_starter" "$part_1_data" ) print_screen_output "$graphics_data" + part_1_data='' line_starter=' ' fi - graphics_data=$( create_print_line "$line_starter" "$display_full_string${CN}" ) + if [[ -n $( grep -vE '^[[:space:]]*$' <<< $part_1_data$part_2_data ) ]];then + graphics_data=$( create_print_line "$line_starter" "$part_1_data$part_2_data" ) + print_screen_output "$graphics_data" + fi + fi + line_starter=' ' + graphics_data='' + + part_1_data="$display_server_string$driver_string" + part_2_data="${C1}$res_tty$SEP3${C2} $screen_resolution $root_x_string" + + if [[ -n $( grep -vE '^[[:space:]]*$' <<< $part_1_data$part_2_data ) && \ + $( calculate_line_length "$part_1_data $part_2_data" ) -gt $COLS_INNER ]];then + graphics_data=$( create_print_line "$line_starter" "$part_1_data" ) + print_screen_output "$graphics_data" + line_starter=' ' + part_1_data='' + graphics_data=$part_2_data + fi + if [[ -n $( grep -vE '^[[:space:]]*$' <<< $part_1_data$part_2_data ) ]];then + graphics_data=$( create_print_line "$line_starter" "$part_1_data$part_2_data" ) + print_screen_output "$graphics_data" + line_starter=' ' fi - print_screen_output "$graphics_data" # if [[ -z $glx_renderer || -z $glx_version ]];then # b_is_mesa='true' # fi @@ -9611,10 +9712,19 @@ print_graphics_data() if [[ $B_HANDLE_CORRUPT_DATA == 'true' || $B_EXTRA_DATA == 'true' ]];then direct_render_string=" ${C1}Direct Rendering$SEP3${C2} $glx_direct_render" fi - graphics_data="${C1}GLX Renderer$SEP3${C2} $glx_renderer ${C1}GLX Version$SEP3${C2} $glx_version$direct_render_string" - graphics_data=$( create_print_line " " "$graphics_data${CN}" ) - - print_screen_output "$graphics_data" + part_1_data="${C1}GLX Renderer$SEP3${C2} $glx_renderer " + part_2_data="${C1}GLX Version$SEP3${C2} $glx_version$direct_render_string" + # echo $line_starter + if [[ $( calculate_line_length "$part_1_data$part_2_data" ) -gt $COLS_INNER ]];then + graphics_data=$( create_print_line "$line_starter" "$part_1_data" ) + print_screen_output "$graphics_data" + part_1_data='' + line_starter=' ' + fi + if [[ -n $part_1_data$part_2_data ]];then + graphics_data=$( create_print_line "$line_starter" "$part_1_data$part_2_data" ) + print_screen_output "$graphics_data" + fi fi eval $LOGFE } @@ -9685,19 +9795,19 @@ print_hard_disk_data() fi hdd_name="${C1}model$SEP3${C2} $hdd_name_temp" hdd_string="$usb_data$dev_data$hdd_name$size_data$hdd_serial$hdd_temp_data" - hdd_model="$hdd_model${C1}$(($i+1)):${C2} $hdd_string " + hdd_model="$hdd_model${C1}$(($i+1))$SEP3${C2} $hdd_string " # printing line one, then new lines according to $divisor setting, and after, if leftovers, print that line. case $i in 0) if [[ $divisor -eq 1 ]];then - hdd_data=$( create_print_line "$Line_Starter" "${C1}HDD Total Size:${C2} $hdd_capacity ($hdd_used)" ) + hdd_data=$( create_print_line "$Line_Starter" "${C1}HDD Total Size$SEP3${C2} $hdd_capacity ($hdd_used)" ) print_screen_output "$hdd_data" Line_Starter=' ' hdd_data=$( create_print_line "$Line_Starter" "$hdd_model" ) print_screen_output "$hdd_data" hdd_model='' else - hdd_data=$( create_print_line "$Line_Starter" "${C1}HDD Total Size:${C2} $hdd_capacity ($hdd_used) $hdd_model" ) + hdd_data=$( create_print_line "$Line_Starter" "${C1}HDD Total Size$SEP3${C2} $hdd_capacity ($hdd_used) $hdd_model" ) print_screen_output "$hdd_data" hdd_model='' Line_Starter=' ' @@ -9728,7 +9838,7 @@ print_hard_disk_data() fi else # temporary message to indicate not yet supported - hdd_data="${C1}HDD Total Size:${C2} $hdd_capacity ($hdd_used)" + hdd_data="${C1}HDD Total Size$SEP3${C2} $hdd_capacity ($hdd_used)" if [[ $BSD_TYPE == 'bsd' ]];then hdd_data=$bsd_unsupported fi @@ -10174,7 +10284,7 @@ print_networking_data() chip_id=" ${C1}chip-ID$SEP3${C2} $chip_id" fi 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$chip_id" if [[ $( calculate_line_length "$card_string$card_data" ) -gt $COLS_INNER ]];then network_data=$( create_print_line "$line_starter" "$card_string${CN}" ) @@ -10190,7 +10300,7 @@ print_networking_data() fi done else - network_data="${C1}Card:${C2} Failed to Detect Network Card! " + network_data="${C1}Card$SEP3${C2} Failed to Detect Network Card! " network_data=$( create_print_line "$line_starter" "$network_data${CN}" ) print_screen_output "$network_data" fi @@ -10241,7 +10351,7 @@ print_network_advanced_data() mac_id=${a_network_working[9]} fi fi - 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="${C1}IF$SEP3${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${CN}" ) print_screen_output "$network_data" @@ -10267,7 +10377,7 @@ print_networking_ip_data() ip=$FILTER_STRING fi fi - wan_ip_data="${C1}WAN IP:${C2} $ip " + wan_ip_data="${C1}WAN IP$SEP3${C2} $ip " # then create the list of local interface/ip i=0 ## loop starts with 1 by auto-increment so it only shows cards > 1 while [[ -n ${A_INTERFACES_DATA[i]} ]] @@ -10302,7 +10412,7 @@ print_networking_ip_data() 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${CN}" ) @@ -10390,7 +10500,7 @@ print_optical_drive_data() fi drive_string="$drive_id ${C1}model$SEP3${C2} $vendor$rev ${C1}dev-links$SEP3${C2} $drive_links" fi - drive_data="${C1}Optical${counter}:${C2} $drive_string" + drive_data="${C1}Optical${counter}$SEP3${C2} $drive_string" drive_data=$( create_print_line "$Line_Starter" "$drive_data${CN}" ) print_screen_output "$drive_data" Line_Starter=' ' @@ -10478,7 +10588,7 @@ print_partition_data() local a_partition_working='' partition_used='' partition_data='' local counter=0 i=0 a_partition_data='' line_starter='' line_max=$(( $COLS_INNER - 25 )) local partitionIdClean='' part_dev='' full_dev='' part_label='' full_label='' - local part_uuid='' full_uuid='' dev_remote='' full_fs='' line_max_label_uuid=$COLS_INNER + local part_uuid='' full_uuid='' dev_remote='' full_fs='' local b_non_dev='false' holder='' # set A_PARTITION_DATA @@ -10546,20 +10656,28 @@ print_partition_data() else partitionIdClean=${a_partition_working[0]} fi - id_size_fs="${C1}ID:${C2} $partitionIdClean ${C1}size$SEP3${C2} ${a_partition_working[1]} $partition_used$full_fs$full_dev" + id_size_fs="${C1}ID$SEP3${C2} $partitionIdClean ${C1}size$SEP3${C2} ${a_partition_working[1]} $partition_used$full_fs$full_dev" label_uuid="$full_label$full_uuid" # label/uuid always print one per line, so only wrap if it's very long - if [[ $B_SHOW_UUIDS == 'true' && $B_SHOW_LABELS == 'true' && $( calculate_line_length "$id_size_fs$label_uuid" ) -gt $line_max_label_uuid ]];then + if [[ $B_SHOW_UUIDS == 'true' || $B_SHOW_LABELS == 'true' ]] && \ + [[ $( calculate_line_length "${a_partition_data[$counter]}$id_size_fs$label_uuid" ) -gt $COLS_INNER ]];then a_partition_data[$counter]="$id_size_fs" ((counter++)) a_partition_data[$counter]="$label_uuid" else - a_partition_data[$counter]="${a_partition_data[$counter]}$id_size_fs$label_uuid" - fi - # because these lines can vary widely, using dynamic length handling here - if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]] || [[ $( calculate_line_length "${a_partition_data[$counter]}" ) -gt $line_max ]];then - ((counter++)) + if [[ $( calculate_line_length "${a_partition_data[$counter]}$id_size_fs$label_uuid" ) -gt $COLS_INNER ]];then + a_partition_data[$counter]="${a_partition_data[$counter]}" + ((counter++)) + a_partition_data[$counter]="$id_size_fs$label_uuid" + else + a_partition_data[$counter]="${a_partition_data[$counter]}$id_size_fs$label_uuid" + fi fi + ((counter++)) +# # because these lines can vary widely, using dynamic length handling here +# if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]] || [[ $( calculate_line_length "${a_partition_data[$counter]}" ) -gt $line_max ]];then +# ((counter++)) +# fi fi done # print out all lines, line starter on first line @@ -10658,7 +10776,7 @@ print_ps_item() app_name="$app_name ${C1}(started by$SEP3${C2} ${a_ps_data[2]}${C1})${C2}" fi app_pid=" ${C1}pid$SEP3${C2} ${a_ps_data[6]}" - # ${C1}user:${C2} ${a_ps_data[8]} + # ${C1}user$SEP3${C2} ${a_ps_data[8]} case $1 in cpu) app_cpu=" ${C1}cpu$SEP3${C2} ${a_ps_data[4]}%" @@ -10674,7 +10792,7 @@ print_ps_item() ;; esac (( line_counter++ )) - count_nu="${C1}$line_counter:${C2}" + count_nu="${C1}$line_counter$SEP3${C2}" full_line="$count_nu$app_cpu$app_mem$app_name$app_pid$extra_data" ps_data=$( create_print_line " " "$full_line${CN}" ) print_screen_output "$ps_data" @@ -10698,14 +10816,14 @@ print_raid_data() local empty_raid_data='' report_size='report' blocks_avail='blocks' chunk_raid_usage='chunk size' if [[ -n $BSD_TYPE ]];then - no_raid_detected='No zfs software RAID detected - other types not yet supported.' - empty_raid_data='No zfs RAID data available - other types not yet supported.' + no_raid_detected='No zfs software RAID detected-other types not yet supported.' + empty_raid_data='No zfs RAID data available-other types not yet supported.' report_size='full size' blocks_avail='available size' chunk_raid_usage='raid allocated' else - no_raid_detected="No RAID data available - $FILE_MDSTAT is missing - is md_mod kernel module loaded?" - empty_raid_data="No RAID devices detected - $FILE_MDSTAT and md_mod kernel raid module present" + no_raid_detected="No RAID data: $FILE_MDSTAT missing-is md_mod kernel module loaded?" + empty_raid_data="No RAID devices: $FILE_MDSTAT, md_mod kernel module present" fi if [[ $BSD_TYPE == 'bsd' ]];then @@ -11015,9 +11133,9 @@ print_repo_data() # check file name, if different, update the holder for print out if [[ $file_name != $file_name_holder ]];then if [[ $repo_type == 'pisi repo' || $repo_type == 'urpmq repo' ]];then - repo_full="${C1}$repo_type:${C2} $file_name" + repo_full="${C1}$repo_type$SEP3${C2} $file_name" else - repo_full="${C1}Active $repo_type in file:${C2} $file_name" + repo_full="${C1}Active $repo_type in file$SEP3${C2} $file_name" fi file_name_holder=$file_name b_print_next_line='true' @@ -11039,7 +11157,7 @@ print_repo_data() fi done <<< "$REPO_DATA" else - repo_full=$( create_print_line "Repos:" "${C1}Error:${C2} $SCRIPT_NAME does not support this feature for your distro yet." ) + repo_full=$( create_print_line "Repos:" "${C1}Error$SEP3${C2} $SCRIPT_NAME does not support this feature for your distro yet." ) print_screen_output "$repo_full" fi eval $LOGFE @@ -11313,7 +11431,7 @@ print_unmounted_partition_data() else full_dev="/dev/${a_unmounted_data[0]}" fi - full_dev="${C1}ID:${C2} $full_dev" + full_dev="${C1}ID$SEP3${C2} $full_dev" if [[ -z ${a_unmounted_data[1]} ]];then full_size='N/A' else -- cgit v1.2.3