From 0115b374a8a6b35171d23ce424a55c18808c3b53 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Tue, 25 Mar 2014 00:01:20 +0000 Subject: [PATCH] New version. Added dynamic wrapping to -G, and also am now wrapping -C per cpu cores speeds, for systems with a lot of them, that will clean up the output. Added dynamic wrapping to --recommends and -c 94-99. These are the main things, there's a few smaller issues with -xx output on -N/-n/-i but those will noly really show with full output and it takes a while to get this stuff stable so maybe some other time, but it's ok for now. --- inxi | 270 +++++++++++++++++++++++++++++++------------------ inxi.changelog | 19 ++++ 2 files changed, 191 insertions(+), 98 deletions(-) diff --git a/inxi b/inxi index 6d0b9f7..403877e 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.8 +#### Date: 2014-03-24 #### Patch Number: 00 ######################################################################## #### SPECIAL THANKS @@ -490,6 +490,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 @@ -676,16 +678,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 +778,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' @@ -962,7 +970,6 @@ initialize_paths() # echo "PATH='$PATH'" ##/bin/sh -c 'echo "PATH in subshell=\"$PATH\""' } - # No args taken. check_recommended_apps() { @@ -1135,18 +1142,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,17 +1173,17 @@ 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 case $COLOR_SELECTION in @@ -1209,7 +1215,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 +1237,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 +1255,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 @@ -1798,7 +1803,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 @@ -1807,9 +1812,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 @@ -1833,26 +1836,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 @@ -1861,7 +1870,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 @@ -1905,34 +1914,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' ;; @@ -1965,12 +1987,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" @@ -1992,21 +2014,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." @@ -2065,7 +2086,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 } @@ -9118,7 +9139,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 @@ -9190,7 +9211,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 @@ -9239,7 +9260,7 @@ print_cpu_data() 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 line_starter='' 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. @@ -9278,7 +9299,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 @@ -9354,7 +9375,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" @@ -9371,17 +9392,26 @@ 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 + if [[ -n $cpu_multi_clock_data && \ + $( calculate_line_length "$multi_cpu_starter$cpu_multi_clock_data" ) -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="${C1}$(( i + 1 ))$SEP3${C2} ${a_cpu_working[1]%.*} MHz " + else + cpu_multi_clock_data="$cpu_multi_clock_data${C1}$(( i + 1 ))$SEP3${C2} ${a_cpu_working[1]%.*} MHz " + 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]}" @@ -9449,7 +9479,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 @@ -9507,7 +9537,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 @@ -9541,11 +9571,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 @@ -9556,7 +9584,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]}" ) @@ -9565,38 +9593,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 @@ -9616,10 +9681,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 } @@ -9690,19 +9764,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=' ' @@ -9733,7 +9807,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 @@ -10179,7 +10253,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}" ) @@ -10195,7 +10269,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 @@ -10246,7 +10320,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" @@ -10272,7 +10346,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]} ]] @@ -10307,7 +10381,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}" ) @@ -10395,7 +10469,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=' ' @@ -10551,7 +10625,7 @@ 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 @@ -10663,7 +10737,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]}%" @@ -10679,7 +10753,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" @@ -11020,9 +11094,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' @@ -11044,7 +11118,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 @@ -11318,7 +11392,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 diff --git a/inxi.changelog b/inxi.changelog index a20b5d8..a4603b1 100755 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,3 +1,22 @@ +===================================================================================== +Version: 2.1.8 +Patch Version: 00 +Script Date: 2014-03-24 +----------------------------------- +Changes: +----------------------------------- +New version. Added dynamic wrapping to -G, and also am now wrapping -C per cpu cores speeds, +for systems with a lot of them, that will clean up the output. + +Added dynamic wrapping to --recommends and -c 94-99. + +These are the main things, there's a few smaller issues with -xx output on -N/-n/-i but +those will noly really show with full output and it takes a while to get this stuff stable +so maybe some other time, but it's ok for now. + +----------------------------------- +-- Harald Hope - Mon, 24 Mar 2014 16:58:33 -0700 + ===================================================================================== Version: 2.1.7 Patch Version: 00