mirror of
https://github.com/smxi/inxi.git
synced 2025-01-18 16:37:49 +00:00
corrected the cpu input, accidentally added bugfix to wrong line.
This commit is contained in:
parent
2d5a134f65
commit
9557fb98a7
717
inxi
717
inxi
|
@ -1,31 +1,26 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 1.0.17
|
||||
#### Date: 16 June 2009
|
||||
########################################################################
|
||||
###################################################################################
|
||||
SCRIPT_NAME="inxi"
|
||||
SCRIPT_VERSION_NUMBER="1.0.18"
|
||||
#### Date: 7 July 2009
|
||||
###################################################################################
|
||||
#### SPECIAL THANKS
|
||||
########################################################################
|
||||
#### Special thanks to all those in #lsc and #smxi for their tireless
|
||||
#### dedication helping test inxi modules.
|
||||
########################################################################
|
||||
###################################################################################
|
||||
####
|
||||
#### http://code.google.com/p/inxi/wiki/SpecialThanks
|
||||
####
|
||||
###################################################################################
|
||||
#### ABOUT INXI
|
||||
########################################################################
|
||||
#### inxi is a fork of infobash 3.02, the original bash sys info script by locsmif
|
||||
#### As time permits functionality improvements and recoding will occur.
|
||||
###################################################################################
|
||||
####
|
||||
#### inxi, the universal, portable, system info script for irc.
|
||||
#### Tested with Irssi, Xchat, Konversation, BitchX, KSirc, ircII,
|
||||
#### Gaim/Pidgin, Weechat, KVIrc and Kopete.
|
||||
#### Original infobash author and copyright holder:
|
||||
#### Copyright (C) 2005-2007 Michiel de Boer a.k.a. locsmif
|
||||
#### inxi version: Copyright (C) 2008-9 Scott Rogers & Harald Hope
|
||||
#### Further fixes (listed as known): Horst Tritremmel <hjt at sidux.com>
|
||||
#### Steven Barrett (aka: damentz) - usb audio patch; swap percent used patch
|
||||
####
|
||||
#### Current script home page: http://techpatterns.com/forums/about1131.html
|
||||
#### 'About' wiki : http://code.google.com/p/inxi/wiki/About
|
||||
#### Current script home page: http://www.inxi.org
|
||||
#### Script svn: http://code.google.com/p/inxi
|
||||
####
|
||||
###################################################################################
|
||||
#### LICENSE
|
||||
###################################################################################
|
||||
####
|
||||
#### 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
|
||||
|
@ -41,91 +36,32 @@
|
|||
####
|
||||
#### If you don't understand what Free Software is, please read (or reread)
|
||||
#### this page: http://www.gnu.org/philosophy/free-sw.html
|
||||
########################################################################
|
||||
####
|
||||
###################################################################################
|
||||
#### DEPENDENCIES
|
||||
#### bash >=3.0(bash), df;readlink;stty;tr;uname;wc(coreutils),
|
||||
#### gawk(gawk), grep(grep), hostname(hostname), lspci(pciutils),
|
||||
#### ps;uptime(procps), glxinfo;xdpyinfo;xrandr(xbase-clients)
|
||||
#### Also the proc filesystem should be present and mounted
|
||||
###################################################################################
|
||||
####
|
||||
#### Apparently unpatched bash 3.0 has arrays broken; bug reports:
|
||||
#### http://ftp.gnu.org/gnu/bash/bash-3.0-patches/bash30-008
|
||||
#### http://lists.gnu.org/archive/html/bug-bash/2004-08/msg00144.html
|
||||
#### http://code.google.com/p/inxi/wiki/Dependencies
|
||||
####
|
||||
#### Arrays work in bash 2.05b, but "egrep -m" does not
|
||||
####
|
||||
#### RECOMMENDS (Needed to run certain features)
|
||||
#### For local interfaces/IP test: ifconfig (in net-tools for Debian systems)
|
||||
#### runlevel(sysvinit): to view current runlevel while not in X window system
|
||||
#### Bash 3.1 for proper array use
|
||||
########################################################################
|
||||
###################################################################################
|
||||
#### CONVENTIONS:
|
||||
#### Indentation: TABS
|
||||
#### Do not use `....` (back quotes), those are totally non-reabable, use $(....).
|
||||
#### Do not use one liner flow controls.
|
||||
#### The ONLY time you should use ';' (semi-colon) is in this single case: if [[ condition ]];then.
|
||||
#### Never use compound 'if': ie, if [[ condition ]] && statement.
|
||||
#### Note: [[ -n $something ]] - double brackets does not require quotes for variables: ie, "$something".
|
||||
#### Always use quotes, double or single, for all string values.
|
||||
###################################################################################
|
||||
####
|
||||
#### All new code/methods must be in a function.
|
||||
#### For all boolean tests, use 'true' / 'false'.
|
||||
#### !! Do NOT use 0 or 1 unless it's a function return.
|
||||
#### Avoid complicated tests in the if condition itself.
|
||||
#### To 'return' a value in a function, use 'echo <var>'.
|
||||
####
|
||||
#### For gawk: use always if ( num_of_cores > 1 ) { hanging { starter for all blocks
|
||||
#### This lets us use one method for all gawk structures, including BEGIN/END, if, for, etc
|
||||
####
|
||||
#### VARIABLE/FUNCTION NAMING:
|
||||
#### All functions should follow standard naming--verb adjective noun.
|
||||
#### ie, get_cpu_data
|
||||
#### All variables MUST be initialized / declared explicitly.
|
||||
#### All variables should clearly explain what they are, except counters like i, j.
|
||||
#### Each word of variable must be separated by '_' (underscore) (camel form).
|
||||
#### Global variables are 'UPPER CASE', at top of script.
|
||||
#### ie, SOME_VARIABLE=''
|
||||
#### Local variables are 'lower case' and declared at the top of the function.
|
||||
#### ie, some_variable=''
|
||||
#### Locals that will be inherited by child functions have first char capitalized (so you know they are inherited).
|
||||
#### ie, Some_Variable
|
||||
####
|
||||
#### Booleans should start with b_ (local) or B_ (global) and state clearly what is being tested.
|
||||
#### Arrays should start with a_ (local) or A_ (global).
|
||||
####
|
||||
#### SPECIAL NOTES:
|
||||
#### The color variable ${C2} must always be followed by a space unless you know what
|
||||
#### character is going to be next for certain. Otherwise irc color codes can be accidentally
|
||||
#### activated or altered.
|
||||
####
|
||||
#### For native script konversation support (check distro for correct konvi scripts path):
|
||||
#### ln -s <path to inxi> /usr/share/apps/konversation/scripts/inxi
|
||||
#### DCOP doesn't like \n, so avoid using it for most output unless required, as in error messages.
|
||||
####
|
||||
#### As with all 'rules' there are acceptions, these are noted where used.
|
||||
#### http://code.google.com/p/inxi/wiki/inxi_Programming_Conventions
|
||||
####
|
||||
###################################################################################
|
||||
#### KDE Konversation information. Moving from dcop(qt3/KDE3) to dbus(qt4/KDE4)
|
||||
###################################################################################
|
||||
#### dcop and dbus -- these talk back to Konversation from this script
|
||||
####
|
||||
#### http://code.google.com/p/inxi/wiki/dbusNdcop
|
||||
####
|
||||
#### Scripting info -- http://konversation.berlios.de/docs/scripting.html
|
||||
#### -- http://www.kde.org.uk/apps/konversation/
|
||||
####
|
||||
#### dbus info -- http://dbus.freedesktop.org/doc/dbus-tutorial.html
|
||||
#### view dbus info -- https://fedorahosted.org/d-feet/
|
||||
#### -- or run qdbus
|
||||
#### Konvi dbus/usage-- qdbus org.kde.konversation /irc say <server> <target-channel> <output>
|
||||
####
|
||||
#### Python usage -- http://wiki.python.org/moin/DbusExamples (just in case)
|
||||
####
|
||||
#### Because webpages come and go, the above information needs to be moved to inxi's wiki
|
||||
####
|
||||
########################################################################
|
||||
###################################################################################
|
||||
#### Valuable Resources
|
||||
#### gawk arrays: http://www.math.utah.edu/docs/info/gawk_12.html
|
||||
########################################################################
|
||||
#### http://code.google.com/p/inxi/wiki/Special_Notes
|
||||
####
|
||||
###################################################################################
|
||||
#### TESTING FLAGS
|
||||
###################################################################################
|
||||
#### inxi supports advanced testing triggers to do various things, using -! <arg>
|
||||
#### -! 1 - triggers default B_TESTING_1='true' to trigger some test or other
|
||||
#### -! 2 - triggers default B_TESTING_2='true' to trigger some test or other
|
||||
|
@ -140,36 +76,141 @@
|
|||
#### -@ 8 - Basic data logging of generated data / array values
|
||||
#### -@ 9 - Full logging of all data used, including cat of files and system data
|
||||
#### -@ 10 - Basic data logging plus color code logging
|
||||
########################################################################
|
||||
####
|
||||
###################################################################################
|
||||
#### NOTES: for comments/information not appropriate elsewhere in script
|
||||
###################################################################################
|
||||
####
|
||||
#### hwinfo could be used, if it's available in all systems, or most,
|
||||
#### to get a lot more data and verbosity levels going.
|
||||
####
|
||||
##### Distros with known problems
|
||||
#### DSL (Bash 2.05b: grep -m doesn't work; arrays won't work) --> unusable output
|
||||
#### Puppy Linux 4.1.2 (Bash 3.0: arrays won't work) --> works partially
|
||||
####
|
||||
###################################################################################
|
||||
##
|
||||
# Clear nullglob, because it creates unpredictable situations with
|
||||
# IFS=$'\n' ARR=($VAR) IFS="$ORIGINAL_IFS"type constructs.
|
||||
# Stuff like [rev a1] is now seen as a glob expansion pattern, and fails,
|
||||
# and therefore results in nothing.
|
||||
shopt -u nullglob
|
||||
##
|
||||
###################################################################################
|
||||
#### VARIABLES
|
||||
########################################################################
|
||||
###################################################################################
|
||||
## Constants
|
||||
############### These have potential to be put into an rc file (ie ~/.inxirc)
|
||||
# Array-Constants
|
||||
A_DEPENDS="df free gawk grep hostname lspci ps readlink tr uname uptime wc"
|
||||
A_X_APPS="xrandr xdpyinfo glxinfo" # xorg-utils (arch) || x11-utils (debian)
|
||||
A_EXTRA_PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
|
||||
# Extra path variable to make execute failures less likely, merged below
|
||||
|
||||
## NOTE: we can use hwinfo if it's available in all systems, or most, to get
|
||||
## a lot more data and verbosity levels going
|
||||
### Output Colors Constants
|
||||
# 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="[1;30m [0;30m [1;31m [0;31m [1;32m [0;32m [1;33m [0;33m"
|
||||
IRC_COLORS=" \x0314 \x0301 \x0304 \x0305 \x0309 \x0303 \x0308 \x0307"
|
||||
# BLUE DBLUE MAGENTA DMAGENTA CYAN DCYAN WHITE GREY NORMAL
|
||||
ANSI_COLORS="$ANSI_COLORS [1;34m [0;34m [1;35m [0;35m [1;36m [0;36m [1;37m [0;37m [0;37m"
|
||||
IRC_COLORS=" $IRC_COLORS \x0312 \x0302 \x0313 \x0306 \x0311 \x0310 \x0300 \x0315 \x03"
|
||||
#
|
||||
#ANSI_COLORS=($ANSI_COLORS); IRC_COLORS=($IRC_COLORS)
|
||||
A_COLORS_AVAILABLE=( DGREY BLACK RED DRED GREEN DGREEN YELLOW DYELLOW BLUE DBLUE MAGENTA DMAGENTA CYAN DCYAN WHITE GREY NORMAL )
|
||||
# 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 )
|
||||
|
||||
### Variable initializations: null values
|
||||
CMDL_MAX=''
|
||||
COLOR_SCHEME=''
|
||||
COLOR_SCHEME_SET=''
|
||||
IRC_CLIENT=''
|
||||
IRC_CLIENT_VERSION=''
|
||||
# Directory-Constants
|
||||
DIR_CPUINFO='/proc/cpuinfo'
|
||||
DIR_MEMINFO='/proc/meminfo'
|
||||
DIR_ASOUND_DEVICE='/proc/asound/cards'
|
||||
DIR_ASOUND_VERSION='/proc/asound/version'
|
||||
DIR_LSB_RELEASE='/etc/lsb-release'
|
||||
DIR_SCSI='/proc/scsi/scsi'
|
||||
DIR_MODULES='/proc/modules' #
|
||||
DIR_MOUNTS='/proc/mounts'
|
||||
DIR_PARTITIONS='/proc/partitions' #
|
||||
DIR_IFCONFIG='/sbin/ifconfig'
|
||||
|
||||
### primary data array holders ## usage: 'A_<var>'
|
||||
A_AUDIO_DATA=''
|
||||
A_CMDL=''
|
||||
A_CPU_CORE_DATA=''
|
||||
A_CPU_DATA=''
|
||||
A_CPU_TYPE_PCNT_CCNT=''
|
||||
A_DEBUG_BUFFER=''
|
||||
A_GFX_CARD_DATA=''
|
||||
A_GLX_DATA=''
|
||||
A_HDD_DATA=''
|
||||
A_INTERFACES_DATA=''
|
||||
A_NETWORK_DATA=''
|
||||
A_PARTITION_DATA=''
|
||||
A_X_DATA=''
|
||||
# Script names/paths - must be non root writable
|
||||
# Various-Constants
|
||||
SCRIPT_DATA_DIR="$HOME/.inxi"
|
||||
LOG_FILE="$SCRIPT_DATA_DIR/inxi.log"
|
||||
LOG_FILE_1="$SCRIPT_DATA_DIR/inxi.1.log"
|
||||
LOG_FILE_2="$SCRIPT_DATA_DIR/inxi.2.log"
|
||||
SCRIPT_NAME="inxi"
|
||||
SCRIPT_DOWNLOAD='http://inxi.googlecode.com/svn/trunk/'
|
||||
SCRIPT_DOWNLOAD_BRANCH_1='http://inxi.googlecode.com/svn/branches/one/'
|
||||
SCRIPT_DOWNLOAD_BRANCH_2='http://inxi.googlecode.com/svn/branches/two/'
|
||||
SCRIPT_DOWNLOAD_BRANCH_3='http://inxi.googlecode.com/svn/branches/three/'
|
||||
SCRIPT_DOWNLOAD_BRANCH_4='http://inxi.googlecode.com/svn/branches/four/'
|
||||
SCRIPT_DOWNLOAD_DEV='http://smxi.org/test/'
|
||||
KONVI_CFG="konversation/scripts/$SCRIPT_NAME.conf" # relative path to $(kde-config --path data)
|
||||
|
||||
### Boolean true/false globals ## usage: 'B_<var>'
|
||||
### Script Localization Constant
|
||||
# Make sure every program speaks English.
|
||||
LC_ALL="C"
|
||||
export LC_ALL
|
||||
|
||||
# logging eval variables, start and end function: Insert to LOGFS LOGFE when debug level >= 8
|
||||
LOGFS_STRING='log_function_data fs $FUNCNAME "$( echo $@ )"'
|
||||
LOGFE_STRING='log_function_data fe $FUNCNAME'
|
||||
|
||||
### 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-version kanotix-version knoppix-version mandrake-release pardus-release sabayon-release sidux-version turbolinux-release zenwalk-version )
|
||||
# debian_version excluded from DISTROS_PRIMARY so Debian can fall through to /etc/issue detection. Same goes for Ubuntu.
|
||||
DISTROS_EXCLUDE_LIST=( debian_version ubuntu_version )
|
||||
DISTROS_PRIMARY=( gentoo-release redhat-release slackware-version SuSE-release )
|
||||
DISTROS_LSB_GOOD=( mandrake-release mandriva-release mandrakelinux-release )
|
||||
|
||||
### Bans Data
|
||||
# Precede a banword with $'\2' to prevent it from being subject to automated escaping by the make_ban_lists routine
|
||||
# $'\1' gets weird results :
|
||||
# $'\2' is octal ascii for 'start of text', $'\1' is start of heading.
|
||||
# http://www.asciitable.com/
|
||||
# user@host $ ARR=($'\x01'"one two" three four); echo ${ARR[0]} | hd -v
|
||||
# 00000000 01 01 6f 6e 65 20 74 77 6f 0a |..one two.|
|
||||
A_NORMAL_BANS=( corporation communications gmbh technologies technology group $'\2'"\<ltd\>" ltd. $'\2'"\<inc\>" inc. $'\2'\<co\> co. "(tm)" "(r)" "®" $'\2'"\(rev ..\)" )
|
||||
A_CPU_BANS=( @ cpu deca 'dual core' dual-core 'tri core' tri-core 'quad core' quad-core ennea genuine hepta hexa multi octa penta 'processor' processor single triple $'\2'"[0-9.]+ *[MmGg][Hh][Zz]" )
|
||||
|
||||
### Variable initializations: constants
|
||||
DCOPOBJ="default"
|
||||
DEBUG=0 # Set debug levels from 1-10 (8-10 trigger logging levels)
|
||||
# Debug Buffer Index, index into a debug buffer storing debug messages until inxi is 'all up'
|
||||
DEBUG_BUFFER_INDEX=0
|
||||
## note: the debugger rerouting to /dev/null has been moved to the end of the get_parameters function
|
||||
## so -@[number] debug levels can be set if there is a failure, otherwise you can't even see the errors
|
||||
|
||||
# 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
|
||||
# Default indentation level
|
||||
INDENT=10
|
||||
|
||||
# default to false, no konversation found, 1 is native konvi (qt3/KDE3) script mode, 2 is /cmd inxi start,
|
||||
## 3 is Konversation > 1.2 (qt4/KDE4)
|
||||
KONVI=0
|
||||
# NO_CPU_COUNT=0 # Wether or not the string "dual" or similar is found in cpuinfo output. If so, avoid dups.
|
||||
# This is a variable that controls how many parameters inxi will parse in a /proc/<pid>/cmdline file before stopping.
|
||||
PARAMETER_LIMIT=30
|
||||
SCHEME=0 # set default scheme
|
||||
# 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 -v0, -v2, -v3, etc as a parameter.
|
||||
VERBOSITY_LEVEL=0
|
||||
# Supported number of verbosity levels, including 0
|
||||
VERBOSITY_LEVELS=5
|
||||
|
||||
## info on bash built in: $IFS - http://tldp.org/LDP/abs/html/internalvariables.html
|
||||
# Backup the current Internal Field Separator
|
||||
ORIGINAL_IFS="$IFS"
|
||||
|
||||
######################################################################################
|
||||
### Preset Booleans || true/false globals ## usage: 'B_<var>'
|
||||
# flag to allow distro maintainers to turn off update features. If false, turns off
|
||||
# -U and -! testing/advanced update options, as well as removing the -U help menu item
|
||||
B_ALLOW_UPDATE='true'
|
||||
|
@ -232,232 +273,124 @@ B_MODULES_DIR='false' #
|
|||
B_MOUNTS_DIR='false'
|
||||
B_PARTITIONS_DIR='false' #
|
||||
|
||||
### Directory's used when present
|
||||
DIR_CPUINFO='/proc/cpuinfo'
|
||||
DIR_MEMINFO='/proc/meminfo'
|
||||
DIR_ASOUND_DEVICE='/proc/asound/cards'
|
||||
DIR_ASOUND_VERSION='/proc/asound/version'
|
||||
DIR_LSB_RELEASE='/etc/lsb-release'
|
||||
DIR_SCSI='/proc/scsi/scsi'
|
||||
DIR_MODULES='/proc/modules' #
|
||||
DIR_MOUNTS='/proc/mounts'
|
||||
DIR_PARTITIONS='/proc/partitions' #
|
||||
DIR_IFCONFIG='/sbin/ifconfig'
|
||||
#######################################################################################
|
||||
# List Regular Variables
|
||||
########################
|
||||
### Variable initializations: null values
|
||||
CMDL_MAX=''
|
||||
COLOR_SCHEME=''
|
||||
COLOR_SCHEME_SET=''
|
||||
IRC_CLIENT=''
|
||||
IRC_CLIENT_VERSION=''
|
||||
SCRIPT_PATH="" #filled-in in Main
|
||||
|
||||
### Variable initializations: constants
|
||||
DCOPOBJ="default"
|
||||
DEBUG=0 # Set debug levels from 1-10 (8-10 trigger logging levels)
|
||||
# Debug Buffer Index, index into a debug buffer storing debug messages until inxi is 'all up'
|
||||
DEBUG_BUFFER_INDEX=0
|
||||
## note: the debugger rerouting to /dev/null has been moved to the end of the get_parameters function
|
||||
## so -@[number] debug levels can be set if there is a failure, otherwise you can't even see the errors
|
||||
### primary data array holders ## usage: 'A_<var>'
|
||||
A_AUDIO_DATA=''
|
||||
A_CMDL=''
|
||||
A_CPU_CORE_DATA=''
|
||||
A_CPU_DATA=''
|
||||
A_CPU_TYPE_PCNT_CCNT=''
|
||||
A_DEBUG_BUFFER=''
|
||||
A_GFX_CARD_DATA=''
|
||||
A_GLX_DATA=''
|
||||
A_HDD_DATA=''
|
||||
A_INTERFACES_DATA=''
|
||||
A_NETWORK_DATA=''
|
||||
A_PARTITION_DATA=''
|
||||
A_X_DATA=''
|
||||
|
||||
# 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=0
|
||||
# Default indentation level
|
||||
INDENT=10
|
||||
# These two determine separators in single line output, to force irc clients not to break off sections
|
||||
SEP1='-'
|
||||
SEP2='~'
|
||||
|
||||
## Actual color variables
|
||||
C1=''
|
||||
C2=''
|
||||
CN=''
|
||||
|
||||
# after processing, the ban arrays will be put into these:
|
||||
BAN_LIST_NORMAL=''
|
||||
BAN_LIST_CPU=''
|
||||
|
||||
# logging eval variables, start and end function: Insert to LOGFS LOGFE when debug level >= 8
|
||||
LOGFS_STRING='log_function_data fs $FUNCNAME "$( echo $@ )"'
|
||||
LOGFE_STRING='log_function_data fe $FUNCNAME'
|
||||
LOGFS=''
|
||||
LOGFE=''
|
||||
# uncomment for debugging from script start
|
||||
# LOGFS=$LOGFS_STRING
|
||||
# LOGFE=$LOGFE_STRING
|
||||
|
||||
# default to false, no konversation found, 1 is native konvi (qt3/KDE3) script mode, 2 is /cmd inxi start,
|
||||
## 3 is Konversation > 1.2 (qt4/KDE4)
|
||||
KONVI=0
|
||||
# NO_CPU_COUNT=0 # Wether or not the string "dual" or similar is found in cpuinfo output. If so, avoid dups.
|
||||
# This is a variable that controls how many parameters inxi will parse in a /proc/<pid>/cmdline file before stopping.
|
||||
PARAMETER_LIMIT=30
|
||||
SCHEME=0 # set default scheme
|
||||
# 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 -v0, -v2, -v3, etc as a parameter.
|
||||
VERBOSITY_LEVEL=0
|
||||
# Supported number of verbosity levels, including 0
|
||||
VERBOSITY_LEVELS=5
|
||||
|
||||
# Clear nullglob, because it creates unpredictable situations with IFS=$'\n' ARR=($VAR) IFS="$ORIGINAL_IFS"
|
||||
# type constructs. Stuff like [rev a1] is now seen as a glob expansion pattern, and fails, and
|
||||
# therefore results in nothing.
|
||||
shopt -u nullglob
|
||||
## info on bash built in: $IFS - http://tldp.org/LDP/abs/html/internalvariables.html
|
||||
# Backup the current Internal Field Separator
|
||||
ORIGINAL_IFS="$IFS"
|
||||
|
||||
# These two determine separators in single line output, to force irc clients not to break off sections
|
||||
SEP1='-'
|
||||
SEP2='~'
|
||||
|
||||
### Script names/paths - must be non root writable
|
||||
SCRIPT_DATA_DIR="$HOME/.inxi"
|
||||
LOG_FILE="$SCRIPT_DATA_DIR/inxi.log"
|
||||
LOG_FILE_1="$SCRIPT_DATA_DIR/inxi.1.log"
|
||||
LOG_FILE_2="$SCRIPT_DATA_DIR/inxi.2.log"
|
||||
SCRIPT_NAME="inxi"
|
||||
SCRIPT_PATH="" #filled-in in Main
|
||||
SCRIPT_VERSION_NUMBER="" #filled-in in Main
|
||||
SCRIPT_DOWNLOAD='http://inxi.googlecode.com/svn/trunk/'
|
||||
SCRIPT_DOWNLOAD_BRANCH_1='http://inxi.googlecode.com/svn/branches/one/'
|
||||
SCRIPT_DOWNLOAD_BRANCH_2='http://inxi.googlecode.com/svn/branches/two/'
|
||||
SCRIPT_DOWNLOAD_BRANCH_3='http://inxi.googlecode.com/svn/branches/three/'
|
||||
SCRIPT_DOWNLOAD_BRANCH_4='http://inxi.googlecode.com/svn/branches/four/'
|
||||
SCRIPT_DOWNLOAD_DEV='http://smxi.org/test/'
|
||||
KONVI_CFG="konversation/scripts/$SCRIPT_NAME.conf" # relative path to $(kde-config --path data)
|
||||
|
||||
### Script Localization
|
||||
# Make sure every program speaks English.
|
||||
LC_ALL="C"
|
||||
export LC_ALL
|
||||
|
||||
### 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="[1;30m [0;30m [1;31m [0;31m [1;32m [0;32m [1;33m [0;33m"
|
||||
IRC_COLORS=" \x0314 \x0301 \x0304 \x0305 \x0309 \x0303 \x0308 \x0307"
|
||||
# BLUE DBLUE MAGENTA DMAGENTA CYAN DCYAN WHITE GREY NORMAL
|
||||
ANSI_COLORS="$ANSI_COLORS [1;34m [0;34m [1;35m [0;35m [1;36m [0;36m [1;37m [0;37m [0;37m"
|
||||
IRC_COLORS=" $IRC_COLORS \x0312 \x0302 \x0313 \x0306 \x0311 \x0310 \x0300 \x0315 \x03"
|
||||
|
||||
#ANSI_COLORS=($ANSI_COLORS); IRC_COLORS=($IRC_COLORS)
|
||||
A_COLORS_AVAILABLE=( DGREY BLACK RED DRED GREEN DGREEN YELLOW DYELLOW BLUE DBLUE MAGENTA DMAGENTA CYAN DCYAN WHITE GREY NORMAL )
|
||||
# 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 )
|
||||
## Actual color variables
|
||||
C1=''
|
||||
C2=''
|
||||
CN=''
|
||||
|
||||
### 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-version kanotix-version knoppix-version mandrake-release pardus-release sabayon-release sidux-version turbolinux-release zenwalk-version"
|
||||
# debian_version excluded from DISTROS_PRIMARY so Debian can fall through to /etc/issue detection. Same goes for Ubuntu.
|
||||
DISTROS_EXCLUDE_LIST="debian_version ubuntu_version"
|
||||
DISTROS_PRIMARY="gentoo-release redhat-release slackware-version SuSE-release"
|
||||
DISTROS_LSB_GOOD="mandrake-release mandriva-release mandrakelinux-release"
|
||||
## Distros with known problems
|
||||
# DSL (Bash 2.05b: grep -m doesn't work; arrays won't work) --> unusable output
|
||||
# Puppy Linux 4.1.2 (Bash 3.0: arrays won't work) --> works partially
|
||||
|
||||
### Bans Data
|
||||
# Precede a banword with $'\2' to prevent it from being subject to automated escaping by the make_ban_lists routine
|
||||
# $'\1' gets weird results :
|
||||
# user@host $ ARR=($'\x01'"one two" three four); echo ${ARR[0]} | hd -v
|
||||
# 00000000 01 01 6f 6e 65 20 74 77 6f 0a |..one two.|
|
||||
A_NORMAL_BANS=( corporation communications gmbh technologies technology group $'\2'"\<ltd\>" ltd. $'\2'"\<inc\>" inc. $'\2'\<co\> co. "(tm)" "(r)" "®" $'\2'"\(rev ..\)" )
|
||||
A_CPU_BANS=( @ cpu deca 'dual core' dual-core 'tri core' tri-core 'quad core' quad-core ennea genuine hepta hexa multi octa penta 'processor' processor single triple $'\2'"[0-9.]+ *[MmGg][Hh][Zz]" )
|
||||
# after processing, the ban arrays will be put into these:
|
||||
BAN_LIST_NORMAL=''
|
||||
BAN_LIST_CPU=''
|
||||
|
||||
########################################################################
|
||||
# WARNING: In the main part below (search for 'KONVI')
|
||||
# there's a check for Konversation-specific config files.
|
||||
# Any one of these can override the above if inxi is run
|
||||
# from Konversation!
|
||||
|
||||
########################################################################
|
||||
#### MAIN: Where it all begins
|
||||
########################################################################
|
||||
main()
|
||||
{
|
||||
eval $LOGFS
|
||||
|
||||
# This function just initializes variables
|
||||
initialize_script_data
|
||||
|
||||
# Check for dependencies BEFORE running ANYTHING else except above functions
|
||||
# Not all distro's have these depends installed by default
|
||||
check_script_depends
|
||||
## only functions called here, no logic should be in Main
|
||||
|
||||
## first init function must be set first for colors etc. Remember, no debugger
|
||||
## stuff works on this function unless you set the debugging flag manually.
|
||||
## Debugging flag -@ [number] will not work until get_parameters runs.
|
||||
|
||||
## Init variables
|
||||
##
|
||||
initialize_script_data
|
||||
create_inxi_path
|
||||
|
||||
## Check for dependencies BEFORE running ANYTHING else except above functions
|
||||
## Not all distro's have these depends installed by default
|
||||
##
|
||||
check_script_depends "$A_DEPENDS" 'depends'
|
||||
check_script_depends "$A_X_APPS" 'x_apps'
|
||||
check_script_suggested_apps
|
||||
|
||||
# first init function must be set first for colors etc. Remember, no debugger
|
||||
# stuff works on this function unless you set the debugging flag manually.
|
||||
# Debugging flag -@ [number] will not work until get_parameters runs.
|
||||
## Only continue if depends ok
|
||||
##
|
||||
func_set_self_data
|
||||
|
||||
### Only continue if depends ok
|
||||
SCRIPT_PATH=$( dirname $0 )
|
||||
SCRIPT_VERSION_NUMBER=$( grep -im 1 'version:' $SCRIPT_PATH/$SCRIPT_NAME | gawk '{print $3}' )
|
||||
|
||||
### Source global config overrides
|
||||
if [[ -s /etc/$SCRIPT_NAME.conf ]];then
|
||||
source /etc/$SCRIPT_NAME.conf
|
||||
fi
|
||||
# Source user config overrides, ~/.inxi/inxi.conf
|
||||
if [[ -s $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf ]];then
|
||||
source $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf
|
||||
fi
|
||||
## Source global config overrides
|
||||
## && Source user config overrides, ~/.inxi/inxi.conf
|
||||
##
|
||||
func_source_global_conf_overrides
|
||||
|
||||
## this needs to run before the KONVI stuff is set below
|
||||
## Konversation 1.2 apparently does not like the $PPID test in get_start_client
|
||||
## So far there is no known way to detect if qt4_konvi is the parent process
|
||||
## this method will infer qt4_konvi as parent
|
||||
|
||||
##
|
||||
get_start_client
|
||||
|
||||
# note: this only works if it's run from inside konversation as a script builtin or something
|
||||
# only do this if inxi has been started as a konversation script, otherwise bypass this
|
||||
# KONVI=3 ## for testing puroses
|
||||
## NOTE: this only works if it's run from inside konversation as a script builtin or something.
|
||||
## Only do this if inxi has been started as a konversation script, otherwise bypass this.
|
||||
##
|
||||
if [[ $KONVI -eq 1 || $KONVI -eq 3 ]];then
|
||||
|
||||
if [[ $KONVI -eq 1 ]]; then ## dcop Konversation (ie 1.x < 1.2(qt3))
|
||||
DCPORT="$1"
|
||||
DCSERVER="$2"
|
||||
DCTARGET="$3"
|
||||
shift 3
|
||||
elif [[ $KONVI -eq 3 ]]; then ## dbus Konversation (> 1.2 (qt4))
|
||||
DCSERVER="$1" ##dbus testing
|
||||
DCTARGET="$2" ##dbus testing
|
||||
shift 2
|
||||
fi
|
||||
func_set_konvi_level
|
||||
|
||||
# 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"
|
||||
fi
|
||||
|
||||
## leave this for debugging dcop stuff if we get that working
|
||||
# print_screen_output "DCPORT: $DCPORT"
|
||||
# print_screen_output "DCSERVER: $DCSERVER"
|
||||
# print_screen_output "DCTARGET: $DCTARGET"
|
||||
|
||||
# "$@" passes every parameter separately quoted, "$*" passes all parameters as one quoted parameter.
|
||||
# must be here to allow debugger and other flags to be set.
|
||||
## "$@" passes every parameter separately quoted, "$*" passes all parameters as one quoted parameter.
|
||||
## must be here to allow debugger and other flags to be set.
|
||||
##
|
||||
get_parameters "$@"
|
||||
|
||||
# If no colorscheme was set in the parameter handling routine, then set the default scheme
|
||||
if [[ $COLOR_SCHEME_SET != 'true' ]];then
|
||||
set_color_scheme "$DEFAULT_SCHEME"
|
||||
fi
|
||||
## If no colorscheme was set in the parameter handling routine, then set the default scheme
|
||||
##
|
||||
func_set_color_data
|
||||
|
||||
# all the pre-start stuff is in place now
|
||||
B_SCRIPT_UP='true'
|
||||
script_debugger "Debugger: $SCRIPT_NAME is up and running..."
|
||||
## all the pre-start stuff is in place now
|
||||
##
|
||||
func_script_ready
|
||||
|
||||
# then create the output
|
||||
## then create the output
|
||||
##
|
||||
print_it_out
|
||||
|
||||
## last steps
|
||||
if [[ $B_RUNNING_IN_SHELL == 'true' && $SCHEME -gt 0 ]];then
|
||||
echo -n "[0m"
|
||||
fi
|
||||
##
|
||||
func_finalize_main
|
||||
|
||||
eval $LOGFE
|
||||
# weechat's executor plugin forced me to do this, and rightfully so, because else the exit code
|
||||
# from the last command is taken..
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
@ -465,22 +398,42 @@ main()
|
|||
#### basic tests: set script data, booleans, PATH
|
||||
#### -------------------------------------------------------------------
|
||||
|
||||
# Set PATH data so we can access all programs as user. Set BAN lists.
|
||||
# initialize some boleans, these directories are used throughout the script
|
||||
# some apps are used for extended functions any directory used, should be
|
||||
# checked here first.
|
||||
# No args taken.
|
||||
initialize_script_data()
|
||||
func_set_self_data()
|
||||
{
|
||||
SCRIPT_PATH=$( dirname $0 )
|
||||
# SCRIPT_VERSION_NUMBER=$( grep -im 1 'version:' $SCRIPT_PATH/$SCRIPT_NAME | gawk '{print $3}' ) # why are we using the script to go find itself and read the script?
|
||||
}
|
||||
|
||||
func_set_color_data()
|
||||
{
|
||||
if [[ $COLOR_SCHEME_SET != 'true' ]];then
|
||||
set_color_scheme "$DEFAULT_SCHEME"
|
||||
fi
|
||||
}
|
||||
|
||||
func_script_ready()
|
||||
{
|
||||
B_SCRIPT_UP='true'
|
||||
script_debugger "Debugger: $SCRIPT_NAME is up and running..."
|
||||
|
||||
}
|
||||
|
||||
func_finalize_main()
|
||||
{
|
||||
if [[ $B_RUNNING_IN_SHELL == 'true' && $SCHEME -gt 0 ]];then
|
||||
echo -n "[0m"
|
||||
fi
|
||||
}
|
||||
|
||||
create_inxi_path()
|
||||
{
|
||||
eval $LOGFS
|
||||
local path='' sys_path='' added_path='' b_path_found=''
|
||||
# Extra path variable to make execute failures less likely, merged below
|
||||
local extra_paths="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
|
||||
|
||||
# Fallback paths put into $extra_paths; This might, among others, help on gentoo.
|
||||
# Now, create a difference of $PATH and $extra_paths and add that to $PATH:
|
||||
|
||||
# Fallback paths put into $A_EXTRA_PATH; This might, among others, help on gentoo.
|
||||
# Now, create a difference of $PATH and $A_EXTRA_PATH and add that to $PATH:
|
||||
IFS=":"
|
||||
for path in $extra_paths
|
||||
for path in $A_EXTRA_PATH
|
||||
do
|
||||
b_path_found='false'
|
||||
for sys_path in $PATH
|
||||
|
@ -496,11 +449,21 @@ initialize_script_data()
|
|||
|
||||
IFS="$ORIGINAL_IFS"
|
||||
PATH="${PATH}${added_path}"
|
||||
##echo "PATH='$PATH'"
|
||||
##/bin/sh -c 'echo "PATH in subshell=\"$PATH\""'
|
||||
eval $LOGFE
|
||||
}
|
||||
|
||||
# Set PATH data so we can access all programs as user. Set BAN lists.
|
||||
# initialize some boleans, these directories are used throughout the script
|
||||
# some apps are used for extended functions; any directory used, should be
|
||||
# checked here first.
|
||||
# No args taken.
|
||||
initialize_script_data()
|
||||
{
|
||||
eval $LOGFS
|
||||
|
||||
# Do this after sourcing of config overrides so user can customize banwords
|
||||
BAN_LIST_NORMAL=$( make_ban_lists "${A_NORMAL_BANS[@]}" ) # Contrary to my previous belief, "${ARR[@]}" passes a quoted list, not one string
|
||||
BAN_LIST_NORMAL=$( make_ban_lists "${A_NORMAL_BANS[@]}" )
|
||||
# "${ARR[@]}" passes a quoted list, not one string
|
||||
BAN_LIST_CPU=$( make_ban_lists "${A_CPU_BANS[@]}" )
|
||||
##echo "BAN_LIST_NORMAL='$BAN_LIST_NORMAL'"
|
||||
|
||||
|
@ -567,6 +530,7 @@ initialize_script_data()
|
|||
eval $LOGFE
|
||||
}
|
||||
|
||||
## Check bash array ability
|
||||
# No args taken.
|
||||
check_script_suggested_apps()
|
||||
{
|
||||
|
@ -588,36 +552,31 @@ check_script_suggested_apps()
|
|||
}
|
||||
|
||||
# Determine if any of the absolutely necessary tools are absent
|
||||
# No args taken.
|
||||
# takes an array of depends ($1) and error type ($2).
|
||||
check_script_depends()
|
||||
{yeah
|
||||
{
|
||||
eval $LOGFS
|
||||
local app_name='' app_data=''
|
||||
# bc removed from deps for now
|
||||
local depends="df free gawk grep hostname lspci ps readlink tr uname uptime wc"
|
||||
local x_apps="xrandr xdpyinfo glxinfo"
|
||||
local depends=$1
|
||||
local error_type=$2
|
||||
|
||||
if [[ $B_X_RUNNING == 'true' ]];then
|
||||
for app_name in $x_apps
|
||||
for app_name in $depends
|
||||
do
|
||||
app_data=$( type -p $app_name )
|
||||
if [[ -z $app_data ]];then
|
||||
script_debugger "Resuming in non X mode: $app_name not found in path"
|
||||
B_X_RUNNING='false'
|
||||
break
|
||||
if [[ $error_type == 'depends' ]]; then
|
||||
script_debugger "Resuming in non X mode: $app_name not found in path"
|
||||
B_X_RUNNING='false'
|
||||
break
|
||||
elif [[ $error_type == 'x_apps' ]]; then
|
||||
error_handler 5 "$app_name"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
app_name=''
|
||||
|
||||
for app_name in $depends
|
||||
do
|
||||
app_data=$( type -p $app_name )
|
||||
if [[ -z $app_data ]];then
|
||||
error_handler 5 "$app_name"
|
||||
fi
|
||||
done
|
||||
eval $LOGFE
|
||||
}
|
||||
|
||||
|
@ -651,14 +610,22 @@ make_ban_lists()
|
|||
{
|
||||
eval $LOGFS
|
||||
local ban_list=''
|
||||
local ban_string=$@
|
||||
# Iterate over $@
|
||||
## note: this is a weird, non-intuitive method, needs some documentation or rewriting
|
||||
## if you declare ban_string it stops working, have to read up on this
|
||||
# ban_string is $@, by declaring it, it wipes $@.
|
||||
for ban_string
|
||||
do
|
||||
# echo "term=\"$ban_string\"" # >&2
|
||||
if [[ ${ban_string:0:1} = $'\2' ]];then
|
||||
# per bash cheat sheet: when using ${name:start:lenght} and name is $@, as ban_string is,
|
||||
# start and lenght indicate the array index and count of elements.
|
||||
# so, here, start is 0 index of $@, lenght is the 1st element and this looks for $'/2' in that position
|
||||
# $'\2' is octal ascii for 'start of text', $'\1' is start of heading
|
||||
if [[ ${ban_string:0:1} = $'\2' ]];then
|
||||
ban_list="${ban_list}${ban_list+|}${ban_string:1:${#ban_string}-1}"
|
||||
# ${var+|} returns only | no matter what
|
||||
# ${var}${var+|} returns var|
|
||||
else
|
||||
# Automatically escapes [ ] ( ) . and +
|
||||
ban_list="${ban_list}${ban_list+|}$( echo "$ban_string" | gawk '{
|
||||
|
@ -680,20 +647,24 @@ set_color_scheme()
|
|||
eval $LOGFS
|
||||
local i='' script_colors='' color_codes=''
|
||||
|
||||
if [[ $1 -ge ${#A_COLOR_SCHEMES[@]} ]];then
|
||||
if [[ $1 -ge ${#A_COLOR_SCHEMES[@]} ]];then # what is $1 (needs a local variable with name) ?
|
||||
set -- 1
|
||||
fi
|
||||
# Set a global variable to allow checking for chosen scheme later
|
||||
# assumes we are running irc or shell,
|
||||
# there should be another choice (even if it is to throw an error message)
|
||||
SCHEME="$1"
|
||||
if [[ $B_RUNNING_IN_SHELL == 'true' ]];then
|
||||
color_codes=( $ANSI_COLORS )
|
||||
else
|
||||
else
|
||||
color_codes=( $IRC_COLORS )
|
||||
fi
|
||||
|
||||
for (( i=0; i < ${#A_COLORS_AVAILABLE[@]}; i++ ))
|
||||
do
|
||||
eval "${A_COLORS_AVAILABLE[i]}=\"${color_codes[i]}\""
|
||||
done
|
||||
|
||||
IFS=","
|
||||
script_colors=( ${A_COLOR_SCHEMES[$1]} )
|
||||
IFS="$ORIGINAL_IFS"
|
||||
|
@ -713,6 +684,19 @@ set_color_scheme()
|
|||
#### error handler, debugger, script updater
|
||||
#### -------------------------------------------------------------------
|
||||
|
||||
### Source global config overrides
|
||||
##
|
||||
func_source_global_conf_overrides()
|
||||
{
|
||||
if [[ -s /etc/$SCRIPT_NAME.conf ]];then
|
||||
source /etc/$SCRIPT_NAME.conf
|
||||
fi
|
||||
# Source user config overrides, ~/.inxi/inxi.conf
|
||||
if [[ -s $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf ]];then
|
||||
source $HOME/.$SCRIPT_NAME/$SCRIPT_NAME.conf
|
||||
fi
|
||||
}
|
||||
|
||||
# Error handling
|
||||
# args: $1 - error number; $2 - optional, extra information
|
||||
error_handler()
|
||||
|
@ -1543,7 +1527,7 @@ get_start_client()
|
|||
|
||||
## try to infer the use of Konversation >= 1.2, which shows $PPID improperly
|
||||
## no known method of finding Kovni >= 1.2 as parent process, so we look to see if it is running,
|
||||
## and all other irc clients are not running.
|
||||
## and all other irc clients are not running.
|
||||
is_this_qt4_konvi()
|
||||
{
|
||||
local konvi_qt4_client='' konvi_dbus_exist='' konvi_pid='' konvi_home_dir=''
|
||||
|
@ -1578,6 +1562,37 @@ is_this_qt4_konvi()
|
|||
#qdbus org.kde.konversation /irc say $1 $2 "getpid_dir: $konvi_qt4 qt4_konvi: $konvi_qt4_ver verNum: $konvi_qt4_ver_num pid: $konvi_pid ppid: $PPID konvi_home_dir: ${konvi[2]}"
|
||||
}
|
||||
|
||||
func_set_konvi_level()
|
||||
{
|
||||
kde_config=''
|
||||
|
||||
if [[ $KONVI -eq 1 || $KONVI -eq 3 ]];then
|
||||
|
||||
if [[ $KONVI -eq 1 ]]; then ## dcop Konversation (ie 1.x < 1.2(qt3))
|
||||
DCPORT="$1"
|
||||
DCSERVER="$2"
|
||||
DCTARGET="$3"
|
||||
shift 3
|
||||
elif [[ $KONVI -eq 3 ]]; then ## dbus Konversation (> 1.2 (qt4))
|
||||
DCSERVER="$1" ##dbus testing
|
||||
DCTARGET="$2" ##dbus testing
|
||||
shift 2
|
||||
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"
|
||||
fi
|
||||
}
|
||||
|
||||
# This needs some cleanup and comments, not quite understanding what is happening, although generally output is known
|
||||
# Parse the null separated commandline under /proc/<pid passed in $1>/cmdline
|
||||
# args: $1 - $PPID
|
||||
|
@ -3018,7 +3033,7 @@ get_uptime()
|
|||
calculate_multicore_data()
|
||||
{
|
||||
eval $LOGFS
|
||||
local string_number=$1 string_data=''
|
||||
local string_number=$1 string_data='' cpu_count=$2
|
||||
|
||||
if [[ -n $( egrep -i '( mb| kb)' <<< $1 ) ]];then
|
||||
string_data=" $( gawk '{print $2}' <<< $1 )" # add a space for output
|
||||
|
@ -3026,7 +3041,7 @@ calculate_multicore_data()
|
|||
fi
|
||||
# handle weird error cases where it's not a number
|
||||
if [[ -n $( egrep '^[0-9\.,]+$' <<< $string_number ) ]];then
|
||||
string_number=$( echo $string_number $2 | gawk '{
|
||||
string_number=$( echo $string_number $cpu_count | gawk '{
|
||||
total = $1*$2
|
||||
print total
|
||||
}' )
|
||||
|
@ -3071,7 +3086,7 @@ process_cpu_flags()
|
|||
s = $0
|
||||
}
|
||||
}
|
||||
/^(sse2?|pni)$/ {
|
||||
/^(sse?|pni)$/ {
|
||||
if (ssel[$0] > sse) {
|
||||
sse = ssel[$0]
|
||||
}
|
||||
|
@ -3846,14 +3861,10 @@ print_system_data()
|
|||
eval $LOGFS
|
||||
local system_data='' bits=''
|
||||
local host_name=$( hostname )
|
||||
local current_kernel=$( uname -rm ) # | gawk '{print $1,$3,$(NF-1)}' )
|
||||
local current_kernel=$( uname -rm )
|
||||
local distro="$( get_distro_data )"
|
||||
# check for 64 bit first
|
||||
if [[ -n $( uname -m | grep -o 'x86_64' ) ]];then
|
||||
bits="(64 bit)"
|
||||
else
|
||||
bits="(32 bit)"
|
||||
fi
|
||||
# check for 32/64 bit first
|
||||
bits="($(getconf LONG_BIT) bit)"
|
||||
|
||||
if [[ $B_SHOW_HOST == 'true' ]];then
|
||||
system_data=$( create_print_line "System:" "${C1}Host${C2} $host_name ${C1}Kernel${C2}" )
|
||||
|
|
Loading…
Reference in a new issue