From 8556735504f4cdb34b020e6b4edbafc63024adde Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Wed, 9 Apr 2014 06:41:02 +0000 Subject: [PATCH] branch one test --- inxi | 304 ++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 184 insertions(+), 120 deletions(-) diff --git a/inxi b/inxi index 8140b17..e746660 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/usr/bin/env bash ######################################################################## #### Script Name: inxi -#### Version: 2.1.15 -#### Date: 2014-04-02 +#### Version: 2.1.20 +#### Date: 2014-04-08 #### Patch Number: 01-b1 ######################################################################## #### SPECIAL THANKS @@ -630,7 +630,7 @@ main() { eval $LOGFS - local color_scheme='' + local color_scheme='' kde_config_app='' # this will be used by all functions following local Ps_aux_Data="$( ps aux )" @@ -646,48 +646,11 @@ main() if [[ -s $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf ]];then source $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf fi - ## sometimes tput will trigger an error (mageia) if irc client - if [[ $B_IRC == 'false' ]];then - if type -p tput &>/dev/null;then - TERM_COLUMNS=$(tput cols) - TERM_LINES=$(tput lines) - fi - # double check, just in case it's missing functionality or whatever - if [[ -n ${TERM_COLUMNS##[0-9]*} ]];then - TERM_COLUMNS=80 - TERM_LINES=100 - fi - fi - # Convert to new variable names if set in config files, legacy test - if [[ -n $LINE_MAX_CONSOLE ]];then - COLS_MAX_CONSOLE=$LINE_MAX_CONSOLE - fi - if [[ -n $LINE_MAX_IRC ]];then - COLS_MAX_IRC=$LINE_MAX_IRC - fi - # this lets you set different widths for in or out of display server -# if [[ $B_RUNNING_IN_DISPLAY == 'false' && -n $COLS_MAX_NO_DISPLAY ]];then -# COLS_MAX_CONSOLE=$COLS_MAX_NO_DISPLAY -# fi - # TERM_COLUMNS is set in top globals, using tput cols - # echo tc: $TERM_COLUMNS cmc: $COLS_MAX_CONSOLE - if [[ $TERM_COLUMNS -lt $COLS_MAX_CONSOLE ]];then - COLS_MAX_CONSOLE=$TERM_COLUMNS - fi - # adjust, some terminals will wrap if output cols == term cols - COLS_MAX_CONSOLE=$(( $COLS_MAX_CONSOLE - 2 )) - # echo cmc: $COLS_MAX_CONSOLE - # comes after source for user set stuff - if [[ $B_IRC == 'false' ]];then - COLS_MAX=$COLS_MAX_CONSOLE - else - 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 + set_display_width 'live' # can be reset with -y + + # echo SCHEME $SCHEME + # echo B_IRC $B_IRC + # echo sep3: $SEP3 # Check for dependencies BEFORE running ANYTHING else except above functions # Not all distro's have these depends installed by default. Don't want to run # this if the user is requesting to see this information in the first place @@ -722,18 +685,28 @@ main() DCTARGET="$2" ##dbus testing shift 2 fi - + # always have the current stable kde version tested first, + # then use fallbacks and future proofing + if type -p kde4-config &>/dev/null;then + kde_config_app='kde4-config' + elif type -p kde5-config &>/dev/null;then + kde_config_app='kde5-config' + elif type -p kde-config &>/dev/null;then + kde_config_app='kde-config' + fi # The section below is on request of Argonel from the Konversation developer team: # it sources config files like $HOME/.kde/share/apps/konversation/scripts/inxi.conf - IFS=":" - for kde_config in $( kde-config --path data ) - do - if [[ -r $kde_config$KONVI_CFG ]];then - source "$kde_config$KONVI_CFG" - break - fi - done - IFS="$ORIGINAL_IFS" + if [[ -n $kde_config_app ]];then + IFS=":" + for kde_config in $( $kde_config_app --path data ) + do + if [[ -r $kde_config$KONVI_CFG ]];then + source "$kde_config$KONVI_CFG" + break + fi + done + IFS="$ORIGINAL_IFS" + fi fi ## leave this for debugging dcop stuff if we get that working @@ -908,6 +881,56 @@ initialize_data() eval $LOGFE } +# args: $1 - default OR override default cols max integer count +set_display_width() +{ + local cols_max_override=$1 + + if [[ $cols_max_override == 'live' ]];then + ## sometimes tput will trigger an error (mageia) if irc client + if [[ $B_IRC == 'false' ]];then + if type -p tput &>/dev/null;then + TERM_COLUMNS=$(tput cols) + TERM_LINES=$(tput lines) + fi + # double check, just in case it's missing functionality or whatever + if [[ -z $TERM_COLUMNS || -n ${TERM_COLUMNS//[0-9]/} ]];then + TERM_COLUMNS=80 + TERM_LINES=100 + fi + fi + # Convert to new variable names if set in config files, legacy test + if [[ -n $LINE_MAX_CONSOLE ]];then + COLS_MAX_CONSOLE=$LINE_MAX_CONSOLE + fi + if [[ -n $LINE_MAX_IRC ]];then + COLS_MAX_IRC=$LINE_MAX_IRC + fi + # this lets you set different widths for in or out of display server + # if [[ $B_RUNNING_IN_DISPLAY == 'false' && -n $COLS_MAX_NO_DISPLAY ]];then + # COLS_MAX_CONSOLE=$COLS_MAX_NO_DISPLAY + # fi + # TERM_COLUMNS is set in top globals, using tput cols + # echo tc: $TERM_COLUMNS cmc: $COLS_MAX_CONSOLE + if [[ $TERM_COLUMNS -lt $COLS_MAX_CONSOLE ]];then + COLS_MAX_CONSOLE=$TERM_COLUMNS + fi + # adjust, some terminals will wrap if output cols == term cols + COLS_MAX_CONSOLE=$(( $COLS_MAX_CONSOLE - 2 )) + # echo cmc: $COLS_MAX_CONSOLE + # comes after source for user set stuff + if [[ $B_IRC == 'false' ]];then + COLS_MAX=$COLS_MAX_CONSOLE + else + COLS_MAX=$COLS_MAX_IRC + fi + else + COLS_MAX=$cols_max_override + fi + COLS_INNER=$(( $COLS_MAX - $INDENT - 1 )) + # echo cm: $COLS_MAX ci: $COLS_INNER +} + # arg: $1 - version number: main/patch/date parse_version_data() { @@ -1334,6 +1357,9 @@ error_handler() 20) error_message="The option you selected has been deprecated. $2\nSee the -h (help) menu for currently supported options." ;; + 21) + error_message="Width option requires an integer value of 80 or more.\nYou entered: $2" + ;; *) error_message="error unknown: $@" set -- 99 ;; @@ -1630,6 +1656,7 @@ debug_data_collector() cat /proc/net/arp &> $debug_data_dir/proc-net-arp.txt # bsd data cat /var/run/dmesg.boot &> $debug_data_dir/bsd-var-run-dmesg.boot.txt + echo $COLS_INNER &> $debug_data_dir/cols-inner.txt check_recommends_user_output &> $debug_data_dir/check-recommends-user-output.txt # first download and verify xiin @@ -1766,7 +1793,7 @@ debug_data_collector() echo 'Creating inxi output file now. This can take a few seconds...' echo "Starting $SCRIPT_NAME from: $start_directory" cd $start_directory - $SCRIPT_PATH/$SCRIPT_NAME -FRploudxxx -c 0 -@ 8 > $SCRIPT_DATA_DIR/$debug_data_dir/inxi-FRploudxxx.txt + $SCRIPT_PATH/$SCRIPT_NAME -FRfrploudxxx -c 0 -@ 8 -y 120 > $SCRIPT_DATA_DIR/$debug_data_dir/inxi-FRfrploudxxxy120.txt cp $LOG_FILE $SCRIPT_DATA_DIR/$debug_data_dir if [[ -f $SCRIPT_DATA_DIR/$debug_data_dir.tar.gz ]];then echo "Found and removing previous tar.gz data file: $debug_data_dir.tar.gz" @@ -2158,7 +2185,7 @@ get_parameters() # no need to run through these if there are no args # reserved for future use: -g for extra Graphics; -m for extra Machine; -d for extra Disk elif [[ -n $1 ]];then - while getopts Abc:CdDfFGhHiIlMnNopPrRsSt:uUv:V${weather_flag}xzZ%@:!: opt + while getopts Abc:CdDfFGhHiIlMnNopPrRsSt:uUv:V${weather_flag}xy:zZ%@:!: opt do case $opt in A) B_SHOW_AUDIO='true' @@ -2390,6 +2417,12 @@ get_parameters() B_EXTRA_DATA='true' fi ;; + y) if [[ -z ${OPTARG//[0-9]/} && $OPTARG -ge 80 ]];then + set_display_width "$OPTARG" + else + error_handler 21 "$OPTARG" + fi + ;; z) B_OUTPUT_FILTER='true' ;; Z) B_OVERRIDE_FILTER='true' @@ -2645,6 +2678,7 @@ show_options() if [[ $B_ALLOW_WEATHER == 'true' ]];then print_lines_basic "2" "-w -W" "Location (uses -z/irc filter), weather observation time, wind chill, heat index, dew point (shows extra lines for data where relevant)." fi + print_lines_basic "1" "-y" "Required extra option: integer, 80 or greater. Set the output line width max. Overrides IRC/Terminal settings or actual widths. If used with -h, put -y option first. Example:^inxi^-y^130" print_lines_basic "1" "-z" "Security filters for IP/Mac addresses, location, user home directory name. Default on for irc clients." print_lines_basic "1" "-Z" "Absolute override for output filters. Useful for debugging networking issues in irc for example." print_screen_output " " @@ -2844,7 +2878,7 @@ print_version_info() if [[ -n $script_symbolic_start ]];then print_screen_output "Started via symbolic link: $script_symbolic_start" fi - print_lines_basic "0" "" "Website:^http://inxi.goooglecode.com" + print_lines_basic "0" "" "Website:^http://inxi.googlecode.com" print_lines_basic "0" "" "IRC:^irc.oftc.net channel:^#smxi" print_lines_basic "0" "" "Forums:^http://techpatterns.com/forums/forum-33.html" print_screen_output " " @@ -3649,6 +3683,8 @@ get_cpu_data() nr = 0 count = 0 bArm = "false" + # ARM cpus are erratic in /proc/cpuinfo this hack can sometimes resolve it. Linux only. + sysSpeed="'$(get_cpu_speed_hack)'" } # TAKE STRONGER NOTE: \t+ does NOT always work, MUST be [ \t]+ # TAKE NOTE: \t+ will work for $FILE_CPUINFO, but SOME ARBITRARY FILE used for TESTING might contain SPACES! @@ -3726,7 +3762,12 @@ get_cpu_data() # note: assuming bogomips for arm at 1 x clock # http://en.wikipedia.org/wiki/BogoMips ARM could change so watch this # maybe add: && bArm == "true" but I think most of the bogomips roughly equal cpu speed if not amd/intel - if ( cpu[i, "bogomips"] != "" && cpu[i, "speed"] == "" ) { + # 2014-04-08: trying to use sysSpeed hack first, that is more accurate anyway. + if ( ( cpu[i, "speed"] == "" && sysSpeed != "" ) || \ + ( cpu[i, "speed"] == "" && cpu[i, "bogomips"] != "" && cpu[i, "bogomips"] < 50 ) ) { + cpu[i, "speed"] = sysSpeed + } + else if ( cpu[i, "bogomips"] != "" && cpu[i, "speed"] == "" ) { cpu[i, "speed"] = cpu[i, "bogomips"] } print cpu[i, "model"] "," cpu[i, "speed"] "," cpu[i, "cache"] "," cpu[i, "flags"] "," cpu[i, "bogomips"] "," cpu[nr, "vendor"] "," bArm @@ -3746,8 +3787,9 @@ get_cpu_data() printf("%s %s\n", max, "Mhz") } } - } - ' $FILE_CPUINFO ) ) + } + ' $FILE_CPUINFO ) ) + IFS="$ORIGINAL_IFS" log_function_data 'cat' "$FILE_CPUINFO" elif [[ -n $BSD_TYPE ]];then @@ -3760,6 +3802,17 @@ get_cpu_data() eval $LOGFE # echo getMainCpu: ${[@]} } +# this triggers in one and only one case, ARM cpus that have fake bogomips data +get_cpu_speed_hack() +{ + local speed=$( cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 2>/dev/null ) + + if [[ -n $speed ]];then + speed=${speed%[0-9][0-9][0-9]} # trim off last 3 digits + fi + echo $speed +} + get_cpu_data_bsd() { @@ -4869,6 +4922,7 @@ get_gcc_system_version() log_function_data "A_GCC_VERSIONS: $a_temp" eval $LOGFE } + get_gpu_temp_data() { local gpu_temp='' gpu_fan='' screens='' screen_nu='' gpu_temp_looper='' @@ -8915,7 +8969,8 @@ calculate_line_length() { local string=$1 # ansi:  irc: \x0312 - string=$( sed -e 's/'$ESC'\[[0-9]\{1,2\}\(;[0-9]\{1,2\}\)\{0,2\}m//g' -e 's/\\\x0[0-9]\{1,3\}//g' <<< $string ) + # note: using special trick for bsd sed, tr - NOTE irc sed must use " double quote + string=$( sed -e 's/'$ESC'\[[0-9]\{1,2\}\(;[0-9]\{1,2\}\)\{0,2\}m//g' -e "s/\\\x0[0-9]\{1,3\}//g" <<< $string ) count=${#string} echo $count } @@ -9138,6 +9193,10 @@ print_short_data() local cpu_model="${a_cpu_working[0]}" ## assemble data for output local cpu_clock="${a_cpu_working[1]}" # old CPU3 + # echo $cpu_clock + # if [[ -z ${a_cpu_working[1]} || ${a_cpu_working[1]} < 50 ]];then + # a_cpu_working[1]=$(get_cpu_speed_hack) + # fi # this gets that weird min/max final array item, which almost never contains any data of use local min_max_clock_nu=$(( ${#A_CPU_DATA[@]} - 1 )) local min_max_clock=${A_CPU_DATA[$min_max_clock_nu]/.* Mhz/ Mhz} @@ -9343,7 +9402,7 @@ 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='' working_cpu='' + local cpu_2_data='' working_cpu='' temp1='' local line_starter="CPU:" multi_cpu_starter="${C1}Clock Speeds$SEP3${C2} " ##print_screen_output "A_CPU_DATA[0]=\"${A_CPU_DATA[0]}\"" @@ -9368,9 +9427,7 @@ print_cpu_data() cpu_model="${a_cpu_working[0]}" ## assemble data for output cpu_clock="${a_cpu_working[1]}" - cpu_vendor=${a_cpu_working[5]} - # set A_CPU_CORE_DATA get_cpu_core_count cpu_physical_count=${A_CPU_CORE_DATA[0]} @@ -9393,7 +9450,10 @@ print_cpu_data() # ARM may use the faked 1 cpucorecount to make this work # echo $cpu_core_count $cpu_physical_count if [[ -n ${a_cpu_working[4]} ]];then - bmip_data=$( calculate_multicore_data "${a_cpu_working[4]}" "$(( $cpu_core_count * $cpu_physical_count ))" ) + # new arm shows bad bogomip value, so don't use it + if [[ ${a_cpu_working[4]} > 50 ]];then + bmip_data=$( calculate_multicore_data "${a_cpu_working[4]}" "$(( $cpu_core_count * $cpu_physical_count ))" ) + fi bmip_data=${bmip_data%.*} fi # else @@ -9426,7 +9486,6 @@ print_cpu_data() if [[ ${a_cpu_working[6]} == 'true' ]];then flag_feature='features' fi - cpu_flags="${C1}$flag_feature$SEP3${C2} $cpu_flags " fi fi @@ -9442,7 +9501,15 @@ print_cpu_data() if [[ ${#A_CPU_DATA[@]} -gt 2 && $B_SHOW_CPU == 'true' ]];then cpu_clock_speed='' # null < verbosity level 5 else - cpu_data="$cpu_data ${C1}clocked at${C2} ${a_cpu_working[1]%.*} MHz" + if [[ -z ${a_cpu_working[1]} ]];then + if [[ -z ${cpu_data/*ARM*/} ]];then + temp1=' (ARM)' + fi + a_cpu_working[1]="N/A$temp1" + else + a_cpu_working[1]="${a_cpu_working[1]%.*} MHz" + fi + cpu_clock_speed="${C1}clocked at${C2} ${a_cpu_working[1]}" fi cpu_2_data="$cpu_2_data$cpu_clock_speed" else @@ -9734,7 +9801,6 @@ print_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" ) @@ -9789,7 +9855,7 @@ print_hard_disk_data() eval $LOGFS local hdd_data='' hdd_data_2='' a_hdd_working='' hdd_temp_data='' hdd_string='' local hdd_serial='' - local dev_data='' size_data='' hdd_model='' usb_data='' hdd_name='' divisor=5 + local dev_data='' size_data='' hdd_model='' usb_data='' hdd_name='' local Line_Starter='Drives:' # inherited by print_optical_drives # load A_HDD_DATA get_hdd_data_basic @@ -9837,11 +9903,8 @@ print_hard_disk_data() hdd_serial='N/A' fi hdd_serial=" ${C1}serial$SEP3${C2} $hdd_serial" - divisor=1 # print every line - else - divisor=2 # for modulus line print out, either 2 items for full, or default for short fi - dev_data="${C1}id$SEP3${C2} /dev/${a_hdd_working[0]} " + dev_data="${C1}ID-$((i+1))$SEP3${C2} /dev/${a_hdd_working[0]} " fi if [[ -n ${a_hdd_working[2]} ]];then hdd_name_temp=${a_hdd_working[2]} @@ -9851,9 +9914,8 @@ print_hard_disk_data() # echo "loop: $i" 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))$SEP3${C2} $hdd_string " - part_1_data="$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. + part_1_data="$hdd_model$hdd_string " + if [[ $i -eq 0 ]];then if [[ $( calculate_line_length "$row_starter$part_1_data" ) -gt $COLS_INNER ]];then hdd_data=$( create_print_line "$Line_Starter" "$row_starter" ) @@ -10744,7 +10806,7 @@ print_partition_data() { eval $LOGFS local a_partition_working='' partition_used='' partition_data='' - local counter=0 i=0 a_partition_data='' line_starter='' line_max=$(( $COLS_INNER - 25 )) + local counter=0 i=0 part_id=0 a_partition_data='' line_starter='' local partitionIdClean='' part_dev='' full_dev='' part_label='' full_label='' local part_uuid='' full_uuid='' dev_remote='' full_fs='' local b_non_dev='false' holder='' @@ -10772,25 +10834,24 @@ print_partition_data() full_fs='N/A' # reset partition fs type fi full_fs="${C1}fs$SEP3${C2} $full_fs " - - if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]];then - if [[ -n ${a_partition_working[6]} ]];then - if [[ -z $( grep -E '(^//|:/|non-dev)' <<< ${a_partition_working[6]} ) ]];then - part_dev="/dev/${a_partition_working[6]}" - dev_remote='dev' - elif [[ -n $( grep '^non-dev' <<< ${a_partition_working[6]} ) ]];then - holder=$( sed 's/non-dev-//' <<< ${a_partition_working[6]} ) - part_dev="$holder" - dev_remote='raid' - else - part_dev="${a_partition_working[6]}" - dev_remote='remote' - fi - else + if [[ -n ${a_partition_working[6]} ]];then + if [[ -z $( grep -E '(^//|:/|non-dev)' <<< ${a_partition_working[6]} ) ]];then + part_dev="/dev/${a_partition_working[6]}" dev_remote='dev' - part_dev='N/A' + elif [[ -n $( grep '^non-dev' <<< ${a_partition_working[6]} ) ]];then + holder=$( sed 's/non-dev-//' <<< ${a_partition_working[6]} ) + part_dev="$holder" + dev_remote='raid' + else + part_dev="${a_partition_working[6]}" + dev_remote='remote' fi - full_dev="${C1}$dev_remote$SEP3${C2} $part_dev " + else + dev_remote='dev' + part_dev='N/A' + fi + full_dev="${C1}$dev_remote$SEP3${C2} $part_dev " + if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]];then if [[ $B_SHOW_LABELS == 'true' && $dev_remote != 'remote' ]];then if [[ -n ${a_partition_working[7]} ]];then part_label="${a_partition_working[7]}" @@ -10814,7 +10875,7 @@ print_partition_data() else partitionIdClean=${a_partition_working[0]} fi - id_size_fs="${C1}ID$SEP3${C2} $partitionIdClean ${C1}size$SEP3${C2} ${a_partition_working[1]} $partition_used$full_fs$full_dev" + id_size_fs="${C1}ID-$((part_id+1))$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' ]] && \ @@ -10832,10 +10893,7 @@ print_partition_data() 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 + ((part_id++)) fi done # print out all lines, line starter on first line @@ -10978,9 +11036,9 @@ print_raid_data() 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.' - report_size='full size' - blocks_avail='available size' - chunk_raid_usage='raid allocated' + report_size='size' + blocks_avail='available' + chunk_raid_usage='allocated' else 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" @@ -11113,14 +11171,12 @@ print_raid_data() component_separator=' ' fi done - if [[ $failed != '' ]];then failed=" ${C1}FAILED$SEP3${C2}$failed${C2}" fi if [[ $spare != '' ]];then spare=" ${C1}spare$SEP3${C2}$spare${C2}" fi - if [[ -n $device_components || -n $spare || -n $failed ]];then if [[ $B_EXTRA_DATA != 'true' && -z $BSD_TYPE ]];then if [[ $device_report != 'N/A' && -n $device_components ]];then @@ -11574,15 +11630,17 @@ print_unmounted_partition_data() local a_unmounted_data='' line_starter='' unmounted_data='' full_fs='' local full_dev='' full_size='' full_label='' full_uuid='' full_string='' local bsd_unsupported='This feature is not yet supported for BSD systems.' + local line_starter='Unmounted:' part_2_data='' if [[ -z ${A_PARTITION_DATA} ]];then get_partition_data fi get_unmounted_partition_data - if [[ ${#A_UNMOUNTED_PARTITION_DATA[@]} -ge 1 ]];then for (( i=0; i < ${#A_UNMOUNTED_PARTITION_DATA[@]}; i++ )) do + full_string='' + part_2_data='' IFS="," a_unmounted_data=(${A_UNMOUNTED_PARTITION_DATA[i]}) IFS="$ORIGINAL_IFS" @@ -11591,45 +11649,51 @@ print_unmounted_partition_data() else full_dev="/dev/${a_unmounted_data[0]}" fi - full_dev="${C1}ID$SEP3${C2} $full_dev" + full_dev="${C1}ID-$((i+1))$SEP3${C2} $full_dev " if [[ -z ${a_unmounted_data[1]} ]];then full_size='N/A' else full_size=${a_unmounted_data[1]} fi - full_size="${C1}size$SEP3${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$SEP3${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$SEP3${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$SEP3${C2} ${a_unmounted_data[4]}" - fi - full_string="$full_dev $full_size $full_label $full_uuid $full_fs" - if [[ $i -eq 0 ]];then - line_starter='Unmounted:' - else - line_starter=' ' + full_fs="${C1}fs$SEP3${C2} ${a_unmounted_data[4]} " fi # temporary message to indicate not yet supported if [[ $BSD_TYPE == 'bsd' ]];then full_string=$bsd_unsupported + else + full_string="$full_dev$full_size" + part_2_data="$full_fs$full_label$full_uuid" + fi + if [[ $( calculate_line_length "$full_string$part_2_data" ) -gt $COLS_INNER ]];then + unmounted_data=$( create_print_line "$line_starter" "$full_string${CN}" ) + print_screen_output "$unmounted_data" + line_starter=' ' + unmounted_data=$( create_print_line "$line_starter" "$part_2_data${CN}" ) + print_screen_output "$unmounted_data" + else + unmounted_data=$( create_print_line "$line_starter" "$full_string$part_2_data${CN}" ) + print_screen_output "$unmounted_data" + line_starter=' ' fi - unmounted_data=$( create_print_line "$line_starter" "$full_string${CN}" ) - print_screen_output "$unmounted_data" done else - unmounted_data=$( create_print_line "Unmounted:" "No unmounted partitions detected${CN}" ) + unmounted_data=$( create_print_line "$line_starter" "No unmounted partitions detected${CN}" ) print_screen_output "$unmounted_data" fi