diff --git a/inxi b/inxi index 60557a9..504b526 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 0.2.5 +#### version: 0.2.6 #### Date: October 30 2008 ######################################################################## #### inxi is a fork of infobash, the original bash sys info script by locsmif @@ -39,7 +39,7 @@ #### VARIABLES ######################################################################## -## Variable initializations: null values +### Variable initializations: null values COLOR_SCHEME_SET='' COLOR_SCHEME='' CPU_MODEL='' @@ -48,39 +48,53 @@ CPU_FLAGS='' IRC_CLIENT='' IRC_CLIENT_VERSION='' -## primary data array holders +### primary data array holders A_CPU_DATA='' A_GFX_CARD_DATA='' A_GLX_DATA='' A_NETWORK_DATA='' A_X_DATA='' -## Boolean true/false globals -B_RUNNING_IN_SHELL='false' # Running in a shell? Defaults to false, and is determined later. -B_SHOW_HOST='true' # Set this to 'false' to avoid printing the hostname +### Boolean true/false globals +# Running in a shell? Defaults to false, and is determined later. +B_RUNNING_IN_SHELL='false' +# Set this to 'false' to avoid printing the hostname +B_SHOW_HOST='true' B_X_RUNNING='false' -# Variable initializations: constants -ALLUP=0 # inxi hasn't been 'booted' yet. -CRAP=0 # New parameter -DBI=0 # Debug Buffer Index, index into a debug buffer storing debug messages until inxi is 'all up' +### Variable initializations: constants +# inxi hasn't been 'booted' yet. +ALLUP=0 +# New parameter +CRAP=0 +# Debug Buffer Index, index into a debug buffer storing debug messages until inxi is 'all up' +DBI=0 DCOPOBJ="default" -DEBUG=0 # Set levels from 1-10 -DEBUG_FLOOD=0 # Debug flood override: toggle on to allow long debug output -DEFAULT_SCHEME=2 # Defaults to 2, make this 1 for normal, 0 for no colorcodes at all. Set to any other valid scheme you like. Same as runtime parameter. -FLAG=0 # A throw-away 'flag' variable intended to be used throughout inxi - -INDENT=10 # Default indentation level -KONVI=0 # default to false, no konversation found, 1 is /cmd inxi start, 2 is native konvi script mode +DEBUG=0 # Set debug levels from 1-10 +# Debug flood override: toggle on to allow long debug output +DEBUG_FLOOD=0 +# Defaults to 2, make this 1 for normal, 0 for no colorcodes at all. Set to any other valid scheme you like. +# Same as runtime parameter. +DEFAULT_SCHEME=2 +# A throw-away 'flag' variable intended to be used throughout inxi +FLAG=0 +# Default indentation level +INDENT=10 +# default to false, no konversation found, 1 is /cmd inxi start, 2 is native konvi script mode +KONVI=0 LSPCI=$( lspci -v | awk '{ gsub(/\(prog-if[^)]*\)/,""); print }' ) # NO_CPU_COUNT=0 # Wether or not the string "dual" or similar is found in cpuinfo output. If so, avoid dups. -PARAMETER_LIMIT=30 # This is a variable that controls how many parameters inxi will parse in a /proc//cmdline file before stopping. +# This is a variable that controls how many parameters inxi will parse in a /proc//cmdline file before stopping. +PARAMETER_LIMIT=30 SCHEME=0 # set default scheme -SHOW_IRC=2 # SHOW_IRC=1 to avoid showing the irc client version number, or SHOW_IRC=0 to disable client information completely. -VERBOSITY_LEVEL=0 # Verbosity level defaults to 0, this can also be set with -v, -v2, -v3, etc as a parameter. -VERBOSITY_LEVELS=4 # Supported number of verbosity levels +# SHOW_IRC=1 to avoid showing the irc client version number, or SHOW_IRC=0 to disable client information completely. +SHOW_IRC=2 +# Verbosity level defaults to 0, this can also be set with -v, -v2, -v3, etc as a parameter. +VERBOSITY_LEVEL=0 +# Supported number of verbosity levels +VERBOSITY_LEVELS=4 -# Reroute all error messages to the bitbucket (if not debugging) +### Reroute all error messages to the bitbucket (if not debugging) if [ "$DEBUG" -eq 0 ] then exec 2>/dev/null @@ -91,23 +105,27 @@ fi # type constructs. Stuff like [rev a1] is now seen as a glob expansion pattern, and fails, and # therefore results in nothing. Tricky as fuck. shopt -u nullglob -OIFS="$IFS" # Backup the current Internal Field Seperator -FL1='-' # These two determine separators in single line output, to force irc clients not to break off sections +# Backup the current Internal Field Seperator +OIFS="$IFS" +# These two determine separators in single line output, to force irc clients not to break off sections +FL1='-' FL2='' -## Script names/paths +### Script names/paths SCRIPT_NAME="inxi" SCRIPT_PATH=$( dirname $0 ) SCRIPT_VERSION_NUMBER=$( grep -im 1 'version:' $SCRIPT_PATH/$SCRIPT_NAME | awk '{print $3}' ) SCRIPT_DATE=$( grep -im 1 'date:' $SCRIPT_PATH/$SCRIPT_NAME | awk '{print $3 " " $4 ", " $5}' ) KONVI_CFG="konversation/scripts/$SCRIPT_NAME.conf" # relative path to $(kde-config --path data) -## Script Localization -LC_ALL="C" # Make sure every program speaks English. +### Script Localization +# Make sure every program speaks English. +LC_ALL="C" export LC_ALL -## Output Colors -unset EMPTY # A more elegant way to have a scheme that doesn't print color codes (neither ANSI nor mIRC) at all. See below. +### Output Colors +# A more elegant way to have a scheme that doesn't print color codes (neither ANSI nor mIRC) at all. See below. +unset EMPTY # DGREY BLACK RED DRED GREEN DGREEN YELLOW DYELLOW ANSI_COLORS="       " IRC_COLORS=" \x0314 \x0301 \x0304 \x0305 \x0309 \x0303 \x0308 \x0307" @@ -119,7 +137,7 @@ A_COLORS_AVAILABLE=( DGREY BLACK RED DRED GREEN DGREEN YELLOW DYELLOW BLUE DBLUE # See above for notes on EMPTY A_COLOR_SCHEMES=( EMPTY,EMPTY,EMPTY NORMAL,NORMAL,NORMAL BLUE,NORMAL,NORMAL GREEN,YELLOW,NORMAL DYELLOW,NORMAL,NORMAL CYAN,BLUE,NORMAL RED,NORMAL,NORMAL GREEN,NORMAL,NORMAL YELLOW,NORMAL,NORMAL GREEN,DGREEN,NORMAL BLUE,RED,NORMAL BLUE,NORMAL,RED YELLOW,WHITE,GREEN BLUE,NORMAL,GREEN DCYAN,NORMAL,DMAGENTA ) -## Distro Data +### Distro Data # In cases of derived distros where the version file of the base distro can also be found under /etc, # the derived distro's version file should go first. (Such as with Sabayon / Gentoo) DISTROS_DERIVED="antiX kanotix-version knoppix-version redhat-release sabayon-release sidux-version turbolinux-release zenwalk-version" @@ -127,7 +145,7 @@ DISTROS_PRIMARY="gentoo-release mandrake-release redhat-release slackware-versio # debian_version excluded from DISTROS_PRIMARY so Debian can fall through to /etc/issue detection. Same goes for Ubuntu. DISTROS_BLIST="debian_version ubuntu_version" -## Bans Data +### Bans Data # Precede a banword with $'\2' to prevent it from being subject to automated escaping by the make_bans routine # $'\1' gets weird results : # user@host $ ARR=($'\x01'"one two" three four); echo ${ARR[0]} | hd -v @@ -135,7 +153,7 @@ DISTROS_BLIST="debian_version ubuntu_version" A_NORMAL_BANS=( corporation communications gmbh technologies technology group $'\2'"\" ltd. $'\2'"\" inc. $'\2'\ co. "(tm)" "(r)" $'\2'"\(rev ..\)" ) A_CPU_BANS=( core cpu deca dual ennea genuine hepta hexa multi octa penta processor quad single triple $'\2'"[0-9.]+ *[MmGg][Hh][Zz]" ) -## Source global config overrides +### Source global config overrides if [ -s /etc/$SCRIPT_NAME.conf ];then source /etc/$SCRIPT_NAME.conf fi @@ -162,6 +180,7 @@ error_handler() { local error_message='' + # assemble the error message case $1 in 2) error_message="$SCRIPT_NAME: large flood danger, debug buffer full!" @@ -189,6 +208,7 @@ error_handler() set -- 99 ;; esac + # then print it and exit print_screen_output "$error_message" exit $1 }