aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xinxi466
-rwxr-xr-xinxi.17
-rwxr-xr-xinxi.1.gzbin8153 -> 8233 bytes
-rwxr-xr-xinxi.changelog14
4 files changed, 311 insertions, 176 deletions
diff --git a/inxi b/inxi
index 00b6211..b8f5960 100755
--- a/inxi
+++ b/inxi
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
########################################################################
#### Script Name: inxi
-#### Version: 2.0.0
-#### Date: 2014-03-12
+#### Version: 2.1.0
+#### Date: 2014-03-13
#### Patch Number: 00
########################################################################
#### SPECIAL THANKS
@@ -166,6 +166,7 @@
########################################################################
#### Valuable Resources
#### CPU flags: http://unix.stackexchange.com/questions/43539/what-do-the-flags-in-proc-cpuinfo-mean
+#### Advanced Bash: http://wiki.bash-hackers.org/syntax/pe
#### gawk arrays: http://www.math.utah.edu/docs/info/gawk_12.html
#### raid mdstat: http://www-01.ibm.com/support/docview.wss?uid=isg3T1011259
#### http://www.howtoforge.com/replacing_hard_disks_in_a_raid1_array
@@ -210,6 +211,8 @@ FILTER_STRING='<filter>'
IRC_CLIENT=''
IRC_CLIENT_VERSION=''
LINE_MAX=''
+# for features like help/version will fit to terminal / console screen width
+LINE_MAX_BASIC='120'
LINE_MAX_CONSOLE='115'
LINE_MAX_IRC='105'
PS_COUNT=5
@@ -480,6 +483,19 @@ SCRIPT_DOWNLOAD_DEV='http://smxi.org/test/'
WAN_IP_URL='http://smxi.org/opt/ip.php'
KONVI_CFG="konversation/scripts/$SCRIPT_NAME.conf" # relative path to $(kde-config --path data)
+TERM_LINES=100
+TERM_COLUMNS=80
+# http://stackoverflow.com/questions/1780483/lines-and-columns-environmental-variables-lost-in-a-script
+if [[ -n $( type -p tput ) ]];then
+ TERM_LINES=$(tput lines)
+ TERM_COLUMNS=$(tput cols)
+fi
+# double check, just in case it's missing functionality or whatever
+if [[ -n ${TERM_COLUMNS##[0-9]*} ]];then
+ TERM_LINES=100
+ TERM_COLUMNS=80
+fi
+
### Script Localization
# Make sure every program speaks English.
LC_ALL="C"
@@ -1529,6 +1545,7 @@ debug_data_collector()
systemctl list-units --type=target &> $debug_data_dir/systemctl-list-units-target.txt
initctl list &> $debug_data_dir/initctl-list.txt
sensors &> $debug_data_dir/sensors.txt
+ strings --version &> $debug_data_dir/strings.txt
nvidia-smi -q &> $debug_data_dir/nvidia-smi-q.txt
nvidia-smi -q -x &> $debug_data_dir/nvidia-smi-xq.txt
@@ -1899,6 +1916,7 @@ check_recommends_items()
else
print_string="$item_string: $application"
fi
+
starter="$( sed -e :a -e 's/^.\{1,75\}$/&./;ta' <<< $print_string )"
if [[ -z $( grep '^/' <<< $application ) && -n $location ]] || [[ -d $application ]];then
if [[ -n $location ]];then
@@ -2446,182 +2464,287 @@ show_options()
partition_string='slice'
partition_string_u='Slice'
fi
- print_screen_output "$SCRIPT_NAME supports the following options. You can combine them, or list them"
- print_screen_output "one by one: Examples: $SCRIPT_NAME -v4 -c6 OR $SCRIPT_NAME -bDc 6"
+ # print_lines_basic "0" "" ""
+ # print_lines_basic "1" "" ""
+ # print_lines_basic "2" "" ""
+ # print_screen_output " "
+ print_lines_basic "0" "" "$SCRIPT_NAME supports the following options. You can combine them, or list them one by one. Examples: $SCRIPT_NAME^-v4^-c6 OR $SCRIPT_NAME^-bDc^6. If you start $SCRIPT_NAME with no arguments, it will show the short form."
print_screen_output " "
- print_screen_output "If you start $SCRIPT_NAME with no arguments, it will show the short form."
- print_screen_output "The following options if used without -F, -b, or -v will show just option line(s):"
- print_screen_output "A,C,D,G,I,M,N,P,R,S,f,i,n,o,p,l,u,r,s,t - you can use these alone or together to show"
- print_screen_output "just the line(s) you want to see."
- print_screen_output "If you use them with -v [level], -b or -F, it will show the full output for that line "
- print_screen_output "along with the output for the chosen verbosity level."
+ print_lines_basic "0" "" "The following options if used without -F, -b, or -v will show just option line(s): A, C, D, G, I, M, N, P, R, S, f, i, n, o, p, l, u, r, s, t - you can use these alone or together to show just the line(s) you want to see. If you use them with -v [level], -b or -F, it will show the full output for that line along with the output for the chosen verbosity level."
+
print_screen_output "- - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
print_screen_output "Output Control Options:"
- print_screen_output "-A Audio/sound card information."
- print_screen_output "-b Basic output, short form. Like $SCRIPT_NAME -v 2, only minus hard disk names."
- print_screen_output "-c Color schemes. Scheme number is required. Color selectors run a color selector option"
- print_screen_output " prior to $SCRIPT_NAME starting which lets you set the config file value for the selection."
- print_screen_output " Supported color schemes: 0-$color_scheme_count Example: $SCRIPT_NAME -c 11"
- print_screen_output " Color selectors for each type display (NOTE: irc and global only show safe color set):"
- print_screen_output " 94 - Console, out of X"
- print_screen_output " 95 - Terminal, running in X - like xTerm"
- print_screen_output " 96 - Gui IRC, running in X - like Xchat, Quassel, Konversation etc."
- print_screen_output " 97 - Console IRC running in X - like irssi in xTerm"
- print_screen_output " 98 - Console IRC not in X"
- print_screen_output " 99 - Global - Overrides/removes all settings. Setting specific removes global."
- print_screen_output "-C Full CPU output, including per CPU clockspeed (if available)."
- print_screen_output "-d Optical drive data. Same as -Dd. See also -x and -xx."
- print_screen_output "-D Full hard Disk info, not only model, ie: /dev/sda ST380817AS 80.0GB. See also -x and -xx."
- print_screen_output "-f All cpu flags, triggers -C. Not shown with -F to avoid spamming. ARM cpus show 'features'."
- print_screen_output "-F Full output for $SCRIPT_NAME. Includes all Upper Case line letters, plus -s and -n."
- print_screen_output " Does not show extra verbose options like -x -d -f -u -l -o -p -t -r"
- print_screen_output "-G Graphic card information (card, display server type/version, resolution, glx renderer, version)."
- print_screen_output "-i Wan IP address, and shows local interfaces (requires ifconfig network tool). Same as -Nni"
- print_screen_output " Not shown with -F for user security reasons, you shouldn't paste your local/wan IP."
- print_screen_output "-I Information: processes, uptime, memory, irc client (or shell type), $SCRIPT_NAME version."
- print_screen_output "-l ${partition_string_u} labels. Default: short ${partition_string} -P. For full -p output, use: -pl (or -plu)."
- print_screen_output "-M Machine data. Motherboard, Bios, and if present, System Builder (Like Lenovo)."
- print_screen_output " Older systems/kernels without the required /sys data can use dmidecode instead, run as root."
- print_screen_output "-n Advanced Network card information. Same as -Nn. Shows interface, speed, mac id, state, etc."
- print_screen_output "-N Network card information. With -x, shows PCI BusID, Port number."
- print_screen_output "-o Unmounted ${partition_string} information (includes UUID and LABEL if available)."
- print_screen_output " Shows file system type if you have file installed, if you are root OR if you have"
- print_screen_output " added to /etc/sudoers (sudo v. 1.7 or newer): <username> ALL = NOPASSWD: /usr/bin/file (sample)"
- print_screen_output "-p Full ${partition_string} information (-P plus all other detected ${partition_string}s)."
- print_screen_output "-P Basic ${partition_string} information (shows what -v 4 would show, but without extra data)."
- print_screen_output " Shows, if detected: / /boot /home /tmp /usr /var. Use -p to see all mounted ${partition_string}s."
- print_screen_output "-r Distro repository data. Supported repo types: APT; PACMAN; PISI; YUM; URPMQ; Ports."
- print_screen_output "-R RAID data. Shows RAID devices, states, levels, and components, and extra data with -x/-xx"
- print_screen_output " md-raid: If device is resyncing, shows resync progress line as well."
- print_screen_output "-s Sensors output (if sensors installed/configured): mobo/cpu/gpu temp; detected fan speeds."
- print_screen_output " Gpu temp only for Fglrx/Nvidia drivers. Nvidia shows screen number for > 1 screens."
- print_screen_output "-S System information: host name, kernel, desktop environment (if in X), distro"
- print_screen_output "-t Processes. Requires extra options: c (cpu) m (memory) cm (cpu+memory). If followed by numbers 1-20,"
- print_screen_output " shows that number of processes for each type (default: $PS_COUNT; if in irc, max: 5): -t cm10"
- print_screen_output " Make sure to have no space between letters and numbers (-t cm10 - right, -t cm 10 - wrong)."
- print_screen_output "-u ${partition_string_u} UUIDs. Default: short ${partition_string} -P. For full -p output, use: -pu (or -plu)."
- print_screen_output "-v Script verbosity levels. Verbosity level number is required. Should not be used with -b or -F"
- print_screen_output " Supported levels: 0-${VERBOSITY_LEVELS} Example: $SCRIPT_NAME -v 4"
- print_screen_output " 0 - Short output, same as: $SCRIPT_NAME"
- print_screen_output " 1 - Basic verbose, -S + basic CPU + -G + basic Disk + -I."
- print_screen_output " 2 - Networking card (-N), Machine (-M) data, shows basic hard disk data (names only),"
- print_screen_output " and, if present, basic raid (devices only, and if inactive, notes that). similar to: $SCRIPT_NAME -b"
- print_screen_output " 3 - Advanced CPU (-C), network (-n) data, and switches on -x advanced data option."
- print_screen_output " 4 - ${partition_string_u} size/filled data (-P) for (if present):/, /home, /var/, /boot"
- print_screen_output " Shows full disk data (-D)."
- print_screen_output " 5 - Audio card (-A); sensors (-s), ${partition_string} label (-l) and UUID (-u), short form of optical drives,"
- print_screen_output " standard raid data (-R)."
- print_screen_output " 6 - Full ${partition_string} (-p), unmounted ${partition_string} (-o), optical drive (-d), full raid; triggers -xx."
- print_screen_output " 7 - Network IP data (-i); triggers -xxx."
+ print_lines_basic "1" "-A" "Audio/sound card information."
+ print_lines_basic "1" "-b" "Basic output, short form. Like $SCRIPT_NAME^-v^2, only minus hard disk names."
+ print_lines_basic "1" "-c" "Color schemes. Scheme number is required. Color selectors run a color selector option prior to $SCRIPT_NAME starting which lets you set the config file value for the selection."
+ print_lines_basic "1" "" "Supported color schemes: 0-$color_scheme_count Example: $SCRIPT_NAME^-c^11"
+ print_lines_basic "1" "" "Color selectors for each type display (NOTE: irc and global only show safe color set):"
+# print_screen_output " Supported color schemes: 0-$color_scheme_count Example: $SCRIPT_NAME -c 11"
+# print_screen_output " Color selectors for each type display (NOTE: irc and global only show safe color set):"
+ print_lines_basic "2" "94" "Console, out of X"
+ print_lines_basic "2" "95" "Terminal, running in X - like xTerm"
+ print_lines_basic "2" "96" "Gui IRC, running in X - like Xchat, Quassel, Konversation etc."
+ print_lines_basic "2" "97" "Console IRC running in X - like irssi in xTerm"
+ print_lines_basic "2" "98" "Console IRC not in X"
+ print_lines_basic "2" "99" "Global - Overrides/removes all settings. Setting specific removes global."
+ print_lines_basic "1" "-C" "Full CPU output, including per CPU clockspeed (if available)."
+ print_lines_basic "1" "-d" "Optical drive data. Same as -Dd. See also -x and -xx."
+ print_lines_basic "1" "-D" "Full hard Disk info, not only model, ie: /dev/sda ST380817AS 80.0GB. See also -x and -xx."
+ print_lines_basic "1" "-f" "All cpu flags, triggers -C. Not shown with -F to avoid spamming. ARM cpus show 'features'."
+ print_lines_basic "1" "-F" "Full output for $SCRIPT_NAME. Includes all Upper Case line letters, plus -s and -n. Does not show extra verbose options like -x -d -f -u -l -o -p -t -r"
+ print_lines_basic "1" "-G" "Graphic card information (card, display server type/version, resolution, glx renderer, version)."
+ print_lines_basic "1" "-i" "Wan IP address, and shows local interfaces (requires ifconfig network tool). Same as -Nni. Not shown with -F for user security reasons, you shouldn't paste your local/wan IP."
+ print_lines_basic "1" "-I" "Information: processes, uptime, memory, irc client (or shell type), $SCRIPT_NAME version."
+ print_lines_basic "1" "-l" "${partition_string_u} labels. Default: short ${partition_string} -P. For full -p output, use: -pl (or -plu)."
+ print_lines_basic "1" "-M" "Machine data. Motherboard, Bios, and if present, System Builder (Like Lenovo). Older systems/kernels without the required /sys data can use dmidecode instead, run as root."
+ print_lines_basic "1" "-n" "Advanced Network card information. Same as -Nn. Shows interface, speed, mac id, state, etc."
+ print_lines_basic "1" "-N" "Network card information. With -x, shows PCI BusID, Port number."
+ print_lines_basic "1" "-o" "Unmounted ${partition_string} information (includes UUID and LABEL if available). Shows file system type if you have file installed, if you are root OR if you have added to /etc/sudoers (sudo v. 1.7 or newer): <username> ALL = NOPASSWD: /usr/bin/file (sample)"
+ print_lines_basic "1" "-p" "Full ${partition_string} information (-P plus all other detected ${partition_string}s)."
+ print_lines_basic "1" "-P" "Basic ${partition_string} information (shows what -v 4 would show, but without extra data). Shows, if detected: / /boot /home /tmp /usr /var. Use -p to see all mounted ${partition_string}s."
+ print_lines_basic "1" "-r" "Distro repository data. Supported repo types: APT; PACMAN; PISI; YUM; URPMQ; Ports."
+ print_lines_basic "1" "-R" "RAID data. Shows RAID devices, states, levels, and components, and extra data with -x/-xx. md-raid: If device is resyncing, shows resync progress line as well."
+ print_lines_basic "1" "-s" "Sensors output (if sensors installed/configured): mobo/cpu/gpu temp; detected fan speeds. Gpu temp only for Fglrx/Nvidia drivers. Nvidia shows screen number for > 1 screens."
+ print_lines_basic "1" "-S" "System information: host name, kernel, desktop environment (if in X), distro"
+ print_lines_basic "1" "-t" "Processes. Requires extra options: c (cpu) m (memory) cm (cpu+memory). If followed by numbers 1-20, shows that number of processes for each type (default:^$PS_COUNT; if in irc, max:^5): -t^cm10"
+ print_lines_basic "1" "" "Make sure to have no space between letters and numbers (-t^cm10 - right, -t^cm^10 - wrong)."
+ print_lines_basic "1" "-u" "${partition_string_u} UUIDs. Default: short ${partition_string} -P. For full -p output, use: -pu (or -plu)."
+ print_lines_basic "1" "-v" "Script verbosity levels. Verbosity level number is required. Should not be used with -b or -F"
+ print_lines_basic "1" "" "Supported levels: 0-${VERBOSITY_LEVELS} Example: $SCRIPT_NAME^-v^4"
+ print_lines_basic "2" "0" "Short output, same as: $SCRIPT_NAME"
+ print_lines_basic "2" "1" "Basic verbose, -S + basic CPU + -G + basic Disk + -I."
+ print_lines_basic "2" "2" "Networking card (-N), Machine (-M) data, shows basic hard disk data (names only), and, if present, basic raid (devices only, and if inactive, notes that). similar to: $SCRIPT_NAME^-b"
+ print_lines_basic "2" "3" "Advanced CPU (-C), network (-n) data, and switches on -x advanced data option."
+ print_lines_basic "2" "4" "${partition_string_u} size/filled data (-P) for (if present):/, /home, /var/, /boot. Shows full disk data (-D)."
+ print_lines_basic "2" "5" "Audio card (-A); sensors (-s), ${partition_string} label (-l) and UUID (-u), short form of optical drives, standard raid data (-R)."
+ print_lines_basic "2" "6" "Full ${partition_string} (-p), unmounted ${partition_string} (-o), optical drive (-d), full raid; triggers -xx."
+ print_lines_basic "2" "7" "Network IP data (-i); triggers -xxx."
+
# if distro maintainers don't want the weather feature disable it
if [[ $B_ALLOW_WEATHER == 'true' ]];then
- print_screen_output "-w Local weather data/time. To check an alternate location, see: -W <location>."
- print_screen_output " For extra weather data options see -x, -xx, and -xxx."
- print_screen_output "-W <location> - <location> supported options: postal code; city,[state/country]; latitude,longitude"
- print_screen_output " Only use if you want the weather somewhere other than the machine running $SCRIPT_NAME."
- print_screen_output " Use only ascii characters, replace spaces in city/state/country names with +: new+york,ny"
- fi
- print_screen_output "-x Adds the following extra data (only works with verbose or line output, not short form): "
- print_screen_output " -C - Bogomips on Cpu;"
- print_screen_output " -d - Extra optical drive data; adds rev version to optical drive."
- print_screen_output " -D - Hdd temp with disk data if you have hddtemp installed, if you are root OR if you have added to"
- print_screen_output " /etc/sudoers (sudo v. 1.7 or newer): <username> ALL = NOPASSWD: /usr/sbin/hddtemp (sample)"
- print_screen_output " -G - Direct rendering status for Graphics (in X)."
- print_screen_output " -G - (for single gpu, nvidia driver) screen number gpu is running on."
- print_screen_output " -i - IPv6 as well for LAN interface (IF) devices."
- print_screen_output " -I - System GCC, default. With -xx, also show other installed GCC versions."
- print_screen_output " If running in console, not in IRC client, shows shell version number,"
- print_screen_output " if detected. Init/RC Type and runlevel (if available)."
- print_screen_output " -N -A - Version/port(s)/driver version (if available) for Network/Audio;"
- print_screen_output " -N -A -G - Network, audio, graphics, shows PCI Bus ID/Usb ID number of card;"
- print_screen_output " -R - md-raid: Shows component raid id. Adds second RAID Info line: raid level; report on drives (like 5/5);"
- print_screen_output " blocks; chunk size; bitmap (if present). Resync line, shows blocks synced/total blocks."
- print_screen_output " - zfs-raid: Shows raid array full size; available size; portion allocated to RAID"
- print_screen_output " -S - Desktop toolkit if avaliable (GNOME/XFCE/KDE only); Kernel gcc version"
- print_screen_output " -t - Memory use output to cpu (-xt c), and cpu use to memory (-xt m)."
+ print_lines_basic "1" "-w" "Local weather data/time. To check an alternate location, see: -W^<location>. For extra weather data options see -x, -xx, and -xxx."
+ print_lines_basic "1" "-W <location>" "Supported options for <location>: postal code; city, state/country; latitude/longitude."
+ print_lines_basic "1" "" "Only use if you want the weather somewhere other than the machine running $SCRIPT_NAME. Use only ascii characters, replace spaces in city/state/country names with +: new+york,ny"
+ fi
+ print_lines_basic "1" "-x" "Adds the following extra data (only works with verbose or line output, not short form):"
+ print_lines_basic "2" "-C" "Bogomips on Cpu;"
+ print_lines_basic "2" "-d" "Extra optical drive data; adds rev version to optical drive."
+ print_lines_basic "2" "-D" "Hdd temp with disk data if you have hddtemp installed, if you are root OR if you have added to /etc/sudoers (sudo v. 1.7 or newer): <username> ALL = NOPASSWD: /usr/sbin/hddtemp (sample)"
+ print_lines_basic "2" "-G" "Direct rendering status for Graphics (in X)."
+ print_lines_basic "2" "-G" "(for single gpu, nvidia driver) screen number gpu is running on."
+ print_lines_basic "2" "-i" "IPv6 as well for LAN interface (IF) devices."
+ print_lines_basic "2" "-I" "System GCC, default. With -xx, also show other installed GCC versions. If running in console, not in IRC client, shows shell version number, if detected. Init/RC Type and runlevel (if available)."
+ print_lines_basic "2" "-N -A" "Version/port(s)/driver version (if available) for Network/Audio;"
+ print_lines_basic "2" "-N -A -G" "Network, audio, graphics, shows PCI Bus ID/Usb ID number of card."
+ print_lines_basic "2" "-R" "md-raid: Shows component raid id. Adds second RAID Info line: raid level; report on drives (like 5/5); blocks; chunk size; bitmap (if present). Resync line, shows blocks synced/total blocks. zfs-raid: Shows raid array full size; available size; portion allocated to RAID"
+ print_lines_basic "2" "-S" "Desktop toolkit if avaliable (GNOME/XFCE/KDE only); Kernel gcc version"
+ print_lines_basic "2" "-t" "Memory use output to cpu (-xt c), and cpu use to memory (-xt m)."
if [[ $B_ALLOW_WEATHER == 'true' ]];then
- print_screen_output " -w/-W - Wind speed and time zone (-w only)."
- fi
- print_screen_output "-xx Show extra, extra data (only works with verbose or line output, not short form): "
- print_screen_output " -A - Chip vendor:product ID for each audio device."
- print_screen_output " -D - Disk serial number."
- print_screen_output " -G - Chip vendor:product ID for each video card."
- print_screen_output " -I - Other detected installed gcc versions (if present). System default runlevel."
- print_screen_output " Adds parent program (or tty) for shell info if not in IRC (like Konsole or Gterm)."
- print_screen_output " Adds Init/RC (if found) version number."
- print_screen_output " -M - Chassis information, bios rom size (dmidecode only), if data for either is available."
- print_screen_output " -N - Chip vendor:product ID for each nic."
- print_screen_output " -R - md-raid: Superblock (if present); algorythm, U data. Adds system info line"
- print_screen_output " (kernel support,read ahead, raid events). If present, adds unused device line. "
- print_screen_output " Resync line, shows progress bar."
- print_screen_output " -S - Display manager (dm) in desktop output, if in X (like kdm, gdm3, lightdm)."
+ print_lines_basic "2" "-w -W" "Wind speed and time zone (-w only)."
+ fi
+ print_lines_basic "1" "-xx" "Show extra, extra data (only works with verbose or line output, not short form):"
+ print_lines_basic "2" "-A" "Chip vendor:product ID for each audio device."
+ print_lines_basic "2" "-D" "Disk serial number."
+ print_lines_basic "2" "-G" "Chip vendor:product ID for each video card."
+ print_lines_basic "2" "-I" "Other detected installed gcc versions (if present). System default runlevel. Adds parent program (or tty) for shell info if not in IRC (like Konsole or Gterm). Adds Init/RC (if found) version number."
+ print_lines_basic "2" "-M" "Chassis information, bios rom size (dmidecode only), if data for either is available."
+ print_lines_basic "2" "-N" "Chip vendor:product ID for each nic."
+ print_lines_basic "2" "-R" "md-raid: Superblock (if present); algorythm, U data. Adds system info line (kernel support,read ahead, raid events). If present, adds unused device line. Resync line, shows progress bar."
+ print_lines_basic "2" "-S" "Display manager (dm) in desktop output, if in X (like kdm, gdm3, lightdm)."
if [[ $B_ALLOW_WEATHER == 'true' ]];then
- print_screen_output " -w/-W - Humidity, barometric pressure."
+ print_lines_basic "2" "-w -W" "Humidity, barometric pressure."
fi
- print_screen_output " -xx -@ <11-14> - Automatically uploads debugger data tar.gz file to ftp.techpatterns.com."
- print_screen_output "-xxx Show extra, extra, extra data (only works with verbose or line output, not short form): "
- print_screen_output " -S - Panel/shell information in desktop output, if in X (like gnome-shell, cinnamon, mate-panel)."
+ print_lines_basic "2" "-@ 11-14" "Automatically uploads debugger data tar.gz file to ftp.techpatterns.com. EG: $SCRIPT_NAME^-xx@14"
+ print_lines_basic "1" "-xxx" "Show extra, extra, extra data (only works with verbose or line output, not short form):"
+ print_lines_basic "2" "-S" "Panel/shell information in desktop output, if in X (like gnome-shell, cinnamon, mate-panel)."
if [[ $B_ALLOW_WEATHER == 'true' ]];then
- print_screen_output " -w/-W - Location (uses -z/irc filter), weather observation time, wind chill, heat index,"
- print_screen_output " dew point (shows extra lines for data where relevant)."
+ 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_screen_output "-z Security filters for IP/Mac addresses, location, user home directory name. Default on for irc clients."
- print_screen_output "-Z Absolute override for output filters. Useful for debugging networking issues in irc for example."
+ 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 " "
print_screen_output "Additional Options:"
- print_screen_output "-h --help This help menu."
- print_screen_output "-H This help menu, plus developer options. Do not use dev options in normal operation!"
- print_screen_output "--recommends Checks $SCRIPT_NAME application dependencies + recommends, and directories, then shows"
- print_screen_output " what package(s) you need to install to add support for that feature."
+ print_lines_basic "4" "-h --help" "This help menu."
+ print_lines_basic "4" "-H" "This help menu, plus developer options. Do not use dev options in normal operation!"
+ print_lines_basic "4" "--recommends" "Checks $SCRIPT_NAME application dependencies + recommends, and directories, then shows what package(s) you need to install to add support for that feature. "
if [[ $B_ALLOW_UPDATE == 'true' ]];then
- print_screen_output "-U Auto-update script. Will also install/update man page. Note: if you installed as root, you"
- print_screen_output " must be root to update, otherwise user is fine. Man page installs require root user mode."
+ print_lines_basic "4" "-U" "Auto-update script. Will also install/update man page. Note: if you installed as root, you must be root to update, otherwise user is fine. Man page installs require root user mode."
fi
- print_screen_output "-V --version $SCRIPT_NAME version information. Prints information then exits."
+ print_lines_basic "4" "-V --version" "$SCRIPT_NAME version information. Prints information then exits."
print_screen_output " "
print_screen_output "Debugging Options:"
- print_screen_output "-% Overrides defective or corrupted data."
- print_screen_output "-@ Triggers debugger output. Requires debugging level 1-14 (8-10 - logging of data)."
- print_screen_output " Less than 8 just triggers $SCRIPT_NAME debugger output on screen."
- print_screen_output " 1-7 - On screen debugger output"
- print_screen_output " 8 - Basic logging"
- print_screen_output " 9 - Full file/sys info logging"
- print_screen_output " 10 - Color logging."
- print_screen_output " The following create a tar.gz file of system data, plus collecting the inxi output to file:"
- print_screen_output " To automatically upload debugger data tar.gz file to ftp.techpatterns.com: inxi -xx@ <11-14>"
- print_screen_output " For alternate ftp upload locations: Example: inxi -! ftp.yourserver.com/incoming -xx@ 14"
- print_screen_output " 11 - With data file of xiin read of /sys."
- print_screen_output " 12 - With xorg conf and log data, xrandr, xprop, xdpyinfo, glxinfo etc."
- print_screen_output " 13 - With data from dev, disks, ${partition_string}s, etc., plus xiin data file."
- print_screen_output " 14 - Everything, full data collection."
+ print_lines_basic "1" "-%" "Overrides defective or corrupted data."
+ print_lines_basic "1" "-@" "Triggers debugger output. Requires debugging level 1-14 (8-10 - logging of data). Less than 8 just triggers $SCRIPT_NAME debugger output on screen."
+ print_lines_basic "2" "1-7" "On screen debugger output"
+ print_lines_basic "2" "8" "Basic logging"
+ print_lines_basic "2" "9" "Full file/sys info logging"
+ print_lines_basic "2" "10" "Color logging."
+ print_lines_basic "1" "" "The following create a tar.gz file of system data, plus collecting the inxi output to file. To automatically upload debugger data tar.gz file to ftp.techpatterns.com: inxi^-xx@^<11-14>"
+ print_lines_basic "1" "" "For alternate ftp upload locations: Example: inxi^-!^ftp.yourserver.com/incoming^-xx@^14"
+ print_lines_basic "2" "11" "With data file of xiin read of /sys."
+ print_lines_basic "2" "12" "With xorg conf and log data, xrandr, xprop, xdpyinfo, glxinfo etc."
+ print_lines_basic "2" "13" "With data from dev, disks, ${partition_string}s, etc., plus xiin data file."
+ print_lines_basic "2" "14" "Everything, full data collection."
+ print_lines_basic "2" "" ""
print_screen_output "Advanced Options:"
- print_screen_output "-! 31 Turns off hostname in output. Useful if showing output from servers etc."
- print_screen_output "-! 32 Turns on hostname in output. Overrides global B_SHOW_HOST='false'"
+ print_lines_basic "1" "-! 31" "Turns off hostname in output. Useful if showing output from servers etc."
+ print_lines_basic "1" "-! 32" "Turns on hostname in output. Overrides global B_SHOW_HOST='false'"
if [[ $1 == 'full' ]];then
print_screen_output " "
print_screen_output "Developer and Testing Options (Advanced):"
- print_screen_output "-! 1 - Sets testing flag B_TESTING_1='true' to trigger testing condition 1."
- print_screen_output "-! 2 - Sets testing flag B_TESTING_2='true' to trigger testing condition 2."
- print_screen_output "-! 3 - Sets flags B_TESTING_1='true' and B_TESTING_2='true'."
+ print_lines_basic "1" "-! 1" "Sets testing flag B_TESTING_1='true' to trigger testing condition 1."
+ print_lines_basic "1" "-! 2" "Sets testing flag B_TESTING_2='true' to trigger testing condition 2."
+ print_lines_basic "1" "-! 3" "Sets flags B_TESTING_1='true' and B_TESTING_2='true'."
if [[ $B_ALLOW_UPDATE == 'true' ]];then
- print_screen_output "-! 10 - Triggers an update from the primary dev download server instead of svn."
- print_screen_output "-! 11 - Triggers an update from svn branch one - if present, of course."
- print_screen_output "-! 12 - Triggers an update from svn branch two - if present, of course."
- print_screen_output "-! 13 - Triggers an update from svn branch three - if present, of course."
- print_screen_output "-! 14 - Triggers an update from svn branch four - if present, of course."
- print_screen_output "-! 15 - Triggers an update from svn branch BSD - if present, of course."
- print_screen_output "-! 16 - Triggers an update from svn branch GNUBSD - if present, of course."
- print_screen_output "-! <http://......> - Triggers an update from whatever server you list."
- fi
- print_screen_output "-! <ftp.......> - Changes debugging data ftp upload location to whatever you enter here."
- print_screen_output " Only used together with -xx@ 11-14, and must be used in front of that."
- print_screen_output " Example: inxi -! ftp.yourserver.com/incoming -xx@ 14"
- print_screen_output " "
+ print_lines_basic "1" "-! 10" "Triggers an update from the primary dev download server instead of svn."
+ print_lines_basic "1" "-! 11" "Triggers an update from svn branch one - if present, of course."
+ print_lines_basic "1" "-! 12" "Triggers an update from svn branch two - if present, of course."
+ print_lines_basic "1" "-! 13" "Triggers an update from svn branch three - if present, of course."
+ print_lines_basic "1" "-! 14" "Triggers an update from svn branch four - if present, of course."
+ print_lines_basic "1" "-! 15" "Triggers an update from svn branch BSD - if present, of course."
+ print_lines_basic "1" "-! 16" "Triggers an update from svn branch GNUBSD - if present, of course."
+ print_lines_basic "1" "-! <http://......>" "Triggers an update from whatever server you list."
+ fi
+ print_lines_basic "1" "-! <ftp.......>" "Changes debugging data ftp upload location to whatever you enter here. Only used together with -xx@^11-14, and must be used in front of that. "
+ print_lines_basic "1" "" "Example: inxi^-!^ftp.yourserver.com/incoming^-xx@^14"
fi
print_screen_output " "
}
+# uses $TERM_COLUMNS global in terminal to set width using $LINE_MAX_BASIC
+# IMPORTANT: minimize use of subshells here or the output is too slow
+# args: $1 - 0 1 2 3 4 for indentation level; $2 -line starter, like -m; $3 - content of block.
+print_lines_basic()
+{
+ local line_width=$LINE_MAX_BASIC
+ local line_starter=$2
+ local print_string='' indent_inner='' indent_full='' indent_x=''
+ local indent_working='' indent_working_full=''
+ local line_starter='' line_1_starter='' line_x_starter=''
+ # note: to create a padded string below
+ local fake_string=' ' temp_count='' line_count='' spacer=''
+
+ local indent_main=6 indent_x='' b_indent_x='true'
+
+ # TERM_COLUMNS is set in top globals, using tput cols
+ if [[ $TERM_COLUMNS -lt $LINE_MAX_BASIC ]];then
+ line_width=$TERM_COLUMNS
+ fi
+
+ case $1 in
+ # for no options, start at left edge
+ 0) indent_full=0
+ line_1_starter=''
+ line_x_starter=''
+ b_indent_x='false'
+ ;;
+ 1) indent_full=$indent_main
+ # temp_count=$( wc -c <<< $2 )
+ temp_count=${#2}
+ if [[ $temp_count -lt $indent_full ]];then
+ indent_working=$indent_full
+ else
+ indent_working=$temp_count #$(( $temp_count + 1 ))
+ fi
+ line_1_starter="$( sed -e :a -e "s/^.\{1,$indent_working\}$/& /;ta" <<< $2 )"
+ ;;
+ # first left pad 2 and 3, then right pad them
+ 2) indent_full=$(( $indent_main + 6 ))
+ indent_inner=3
+ temp_count=${#2}
+ if [[ $temp_count -le $indent_inner ]];then
+ indent_working=$indent_inner
+ #indent_working_full=$indent_full
+ else
+ indent_working=$(( $temp_count + 1 ))
+ #indent_working_full=$(( $indent_full - $indent_inner - 1 ))
+ fi
+ line_1_starter="$( sed -e :a -e "s/^.\{1,$indent_working\}$/& /;ta" <<< $2 )"
+ line_1_starter="$( sed -e :a -e "s/^.\{1,$indent_full\}$/ &/;ta" <<< "$line_1_starter" )"
+ ;;
+ 3) indent_full=$(( $indent_main + 8 ))
+ indent_inner=3
+ temp_count=${#2}
+ if [[ $temp_count -le $indent_inner ]];then
+ indent_working=$indent_inner
+ else
+ indent_working=$(( $temp_count + 1 ))
+ fi
+ line_1_starter="$( sed -e :a -e "s/^.\{1,$indent_working\}$/& /;ta" <<< $2 )"
+ line_1_starter="$( sed -e :a -e "s/^.\{1,$indent_full\}$/ &/;ta" <<< "$line_1_starter" )"
+ ;;
+ # for long options
+ 4) indent_full=$(( $indent_main + 8 ))
+ temp_count=${#2}
+ if [[ $temp_count -lt $indent_full ]];then
+ indent_working=$indent_full
+ else
+ indent_working=$temp_count #$(( $temp_count + 1 ))
+ fi
+ line_1_starter="$( sed -e :a -e "s/^.\{1,$indent_working\}$/& /;ta" <<< $2 )"
+ ;;
+ esac
+
+ if [[ $b_indent_x == 'true' ]];then
+ indent_x=$(( $indent_full + 1 ))
+ line_x_starter="$(printf "%${indent_x}s" '')"
+ fi
+
+ line_count=$(( $line_width - $indent_full ))
+
+ # bash loop is so slow, only run this if required
+ # temp_count=$( wc -c <<< $3 )
+ temp_count=${#3}
+ # line_count=1000
+ if [[ $temp_count -gt $line_count ]];then
+ for word in $3
+ do
+ temp_string="$print_string$spacer$word"
+ spacer=' '
+ # note: wc -c here will return +1 actual string length
+ #temp_count=$( wc -c <<< $temp_string )
+ temp_count=${#temp_string}
+ if [[ $temp_count -lt $line_count ]];then
+ print_string=$temp_string # lose any white space start/end
+ # echo -n $(( $line_width - $indent_full ))
+ else
+ if [[ -n $line_1_starter ]];then
+ line_starter="$line_1_starter"
+ line_1_starter=''
+ else
+ line_starter="$line_x_starter"
+ fi
+ # clean up forced connections, ie, stuff we don't want wrapping
+ print_string=${print_string//\^/ }
+ print_screen_output "$line_starter$print_string"
+ print_string="$word$spacer" # needed to handle second word on new line
+ temp_string=''
+ spacer=''
+ fi
+ done
+ else
+ # echo no loop
+ print_string=$3
+ fi
+ # print anything left over
+ if [[ -n $print_string ]];then
+ if [[ -n $line_1_starter ]];then
+ line_starter="$line_1_starter"
+ line_1_starter=''
+ else
+ line_starter="$line_x_starter"
+ fi
+ print_string=${print_string//\^/ }
+ print_screen_output "$line_starter$print_string"
+ fi
+}
+# print_lines_basic '1' '-m' 'let us teest this string and lots more and stuff and more stuff and x is wy and z is x and fred is dead and gus is alive an yes we have to go now'
+# print_lines_basic '2' '7' 'and its substring this string and lots more and stuff and more stuff and x is wy and z is x and fred is dead and gus is alive an yes we have to go now'
+# print_lines_basic '2' '12' 'and its sss substring'
+# print_lines_basic '3' '12' 'and its sss substring this string and lots more and stuff and more stuff and x is wy and z is x and fred is dead and gus is alive an yes we have to go now'
+# exit
+
## print out version information for -V/--version
print_version_info()
{
@@ -2644,24 +2767,20 @@ print_version_info()
print_screen_output "$SCRIPT_NAME $SCRIPT_VERSION_NUMBER-$SCRIPT_PATCH_NUMBER ($last_modified)"
if [[ $B_RUNNING_IN_SHELL == 'true' ]];then
- print_screen_output " "
print_screen_output "Program Location: $script_path"
if [[ -n $script_symbolic_start ]];then
print_screen_output "Started via symbolic link: $script_symbolic_start"
fi
- print_screen_output "Website: http://inxi.goooglecode.com - IRC: irc.oftc.net channel: #smxi"
- print_screen_output "Forums: http://techpatterns.com/forums/forum-33.html"
+ print_lines_basic "0" "" "Website:^http://inxi.goooglecode.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 " "
- print_screen_output "$SCRIPT_NAME - the universal, portable, system information tool for console and irc."
- print_screen_output "This program is a fork of Infobash 3.02:"
- print_screen_output "Copyright (C) 2005-2007 Michiel de Boer a.k.a. locsmif"
- print_screen_output "Subsequent changes and modifications (after Infobash 3.02):"
- print_screen_output "Copyright (C) 2008-$year_modified Scott Rogers, Harald Hope, aka trash80 & h2"
+ print_lines_basic "0" "" "$SCRIPT_NAME - the universal, portable, system information tool for console and irc."
print_screen_output " "
- print_screen_output "This program is free software; you can redistribute it and/or modify"
- print_screen_output "it under the terms of the GNU General Public License as published by"
- print_screen_output "the Free Software Foundation; either version 3 of the License, or"
- print_screen_output "(at your option) any later version. (http://www.gnu.org/licenses/gpl.html)"
+ print_lines_basic "0" "" "This program started life as a fork of Infobash 3.02: Copyright (C) 2005-2007 Michiel de Boer a.k.a. locsmif."
+ print_lines_basic "0" "" "Subsequent changes and modifications (after Infobash 3.02): Copyright (C) 2008-$year_modified Scott Rogers, Harald Hope, aka trash80 & h2"
+ print_screen_output " "
+ print_lines_basic "0" "" "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. (http://www.gnu.org/licenses/gpl.html)"
fi
}
@@ -5435,7 +5554,6 @@ get_init_data()
else
ls_run=$(ls /run)
# note: upstart-file-bridge.pid upstart-socket-bridge.pid upstart-udev-bridge.pid
- # /sbin/init --version == init (upstart 1.12.1)
if [[ -n $( /sbin/init --version 2>/dev/null | grep 'upstart' ) ]];then
init_type='Upstart'
# /sbin/init --version == init (upstart 1.12.1)
@@ -5446,7 +5564,7 @@ get_init_data()
init_version=$( get_de_app_version 'epoch' '^Epoch' '4' )
# missing data:
# http://smarden.org/runit/sv.8.html
- elif [[ -e /etc/runit || -n $( type -p sv ) ]];then
+ elif [[ -e /sbin/runit-init || -e /etc/runit || -n $( type -p sv ) ]];then
init_type='runit' # lower case
# no data on version yet
elif [[ -f /etc/inittab ]];then
@@ -5457,6 +5575,9 @@ get_init_data()
if [[ -n $strings_init_version ]];then
init_version=$( gawk '{print $2}' <<< "$strings_init_version" )
fi
+ # freebsd at least
+ elif [[ -f /etc/ttys ]];then
+ init_type='init (bsd)'
fi
if [[ -n $( grep 'openrc' <<< "$ls_run" ) ]];then
@@ -8611,7 +8732,8 @@ calculate_line_length()
local string="$1"
# ansi:  irc: \x0312
string=$( sed -e "s/\x1b\[[0-9]\{1,2\}\(;[0-9]\{1,2\}\)\{0,2\}m//g" -e "s/\\\x0[0-9]\{1,3\}//g" <<< $string )
- count=$( wc -c <<< $string )
+ # count=$( wc -c <<< $string )
+ count=${#string}
echo $count
}
@@ -9168,7 +9290,7 @@ print_cpu_flags_full()
eval $LOGFS
# note: sort only sorts lines, not words in a string, so convert to lines
local cpu_flags_full="$( echo $1 | tr " " "\n" | sort )"
- local a_cpu_flags='' line_starter=''
+ local a_cpu_flags='' line_starter='' temp_count=''
local i=0 counter=0 max_length=85 max_length_minus=15 flag='' flag_data=''
local line_length_max='' flag_feature='Flags'
@@ -9186,8 +9308,9 @@ print_cpu_flags_full()
else
line_length_max=$max_length
fi
-
- if [[ $( wc -c <<< ${a_cpu_flags[$counter]} ) -gt $line_length_max ]];then
+ # temp_count=$( wc -c <<< ${a_cpu_flags[$counter]} )
+ temp_count=${#a_cpu_flags[$counter]}
+ if [[ $temp_count -gt $line_length_max ]];then
(( counter++ ))
fi
done
@@ -9595,9 +9718,6 @@ print_info_data()
fi
runlvl_default=${A_INIT_DATA[5]}
- if [[ -z $runlvl_default ]];then
- runlvl_default='N/A'
- fi
fi
# currently only using openrc here, otherwise show nothing
rc_type=${A_INIT_DATA[2]}
diff --git a/inxi.1 b/inxi.1
index 699ec90..b205e92 100755
--- a/inxi.1
+++ b/inxi.1
@@ -1,4 +1,4 @@
-.TH INXI 1 "2014\-03\-12" inxi "inxi manual"
+.TH INXI 1 "2014\-03\-13" inxi "inxi manual"
.SH NAME
inxi \- Command line system information script for console and IRC
@@ -110,13 +110,14 @@ Show Graphic card information. Card(s), Display Server (vendor and version numbe
may be added once enough data has been collected.
.TP
.B \-h
-This help menu.
+The help menu. Features dynamic sizing to fit into terminal window. Set script global \fBLINE_MAX_BASIC\fR
+if you want a different default value.
.TP
.B \-\-help
Same as \fB\-h\fR
.TP
.B \-H
-This help menu, plus developer options. Do not use dev options in normal
+The help menu, plus developer options. Do not use dev options in normal
operation!
.TP
.B \-i
diff --git a/inxi.1.gz b/inxi.1.gz
index 3f29b34..5ee015c 100755
--- a/inxi.1.gz
+++ b/inxi.1.gz
Binary files differ
diff --git a/inxi.changelog b/inxi.changelog
index 20bd6e3..bc40cdb 100755
--- a/inxi.changelog
+++ b/inxi.changelog
@@ -1,4 +1,18 @@
=====================================================================================
+Version: 2.1.0
+Patch Version: 00
+Script Date: 2014-03-13
+-----------------------------------
+Changes:
+-----------------------------------
+New version, new man page. Finally, after all these years, dynamically resized to terminal
+window column width help/version outputs. There is a significant slowdown to achieve this,
+but I've optimized it as much as I could so it should be acceptable for most users now.
+
+-----------------------------------
+-- Harald Hope - Thu, 13 Mar 2014 19:26:32 -0700
+
+=====================================================================================
Version: 2.0.0
Patch Version: 00
Script Date: 2014-03-12