summaryrefslogtreecommitdiffstats
path: root/inxi
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2014-04-05 16:43:59 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2014-04-05 16:43:59 -0400
commit5c16a288fa85499c3ba92465388462919a7a76e2 (patch)
treeff1b381fea1cefb99bf23f4999baf02979f72142 /inxi
parentfe8ed1091f620062af5c9804b0cd51b691e3e1e0 (diff)
downloadinxi-5c16a288fa85499c3ba92465388462919a7a76e2.tar.bz2
inxi-5c16a288fa85499c3ba92465388462919a7a76e2.tar.xz
inxi-5c16a288fa85499c3ba92465388462919a7a76e2.tar.zst
Imported Upstream version 2.1.18upstream/2.1.18
Diffstat (limited to 'inxi')
-rwxr-xr-xinxi209
1 files changed, 117 insertions, 92 deletions
diff --git a/inxi b/inxi
index 77e9f0a..5d4377c 100755
--- a/inxi
+++ b/inxi
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
########################################################################
#### Script Name: inxi
-#### Version: 2.1.16
-#### Date: 2014-04-02
+#### Version: 2.1.18
+#### Date: 2014-04-04
#### Patch Number: 00
########################################################################
#### SPECIAL THANKS
@@ -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
@@ -908,6 +871,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 +1347,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 +1646,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 +1783,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 +2175,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 +2407,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 +2668,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 " "
@@ -9789,7 +9813,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 +9861,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 +9872,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" )
@@ -10772,25 +10792,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 +10833,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-$((counter+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' ]] && \
@@ -10978,9 +10997,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 +11132,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 +11591,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 +11610,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