mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 00:47:47 +00:00
More cleanup, added v4 output, partition filled information for hard disk, reordered output to have gfx all in one place,
cleaner indenting.
This commit is contained in:
parent
887c559ca8
commit
203501f56a
127
inxi
127
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 0.1.27
|
||||
#### version: 0.1.28
|
||||
#### Date: October 28 2008
|
||||
########################################################################
|
||||
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
||||
|
@ -398,7 +398,7 @@ get_parameters()
|
|||
VERBOSITY_LEVEL="$1"
|
||||
fi
|
||||
fi
|
||||
echo "$VERBOSITY_LEVEL" | grep -q '^[1-3]$' || error_handler 4 "$VERBOSITY_LEVEL"
|
||||
echo "$VERBOSITY_LEVEL" | grep -q '^[1-4]$' || error_handler 4 "$VERBOSITY_LEVEL"
|
||||
;;
|
||||
-U)
|
||||
print_screen_output "Updating $SCRIPT_NAME now..."
|
||||
|
@ -1057,7 +1057,9 @@ get_graphics_data()
|
|||
|
||||
print_networking_data()
|
||||
{
|
||||
IFS=$'\n' LNNET=($( echo "$LSPCI" | gawk '
|
||||
local i='' long_network='' card_plural='s' card_one='(1) '
|
||||
|
||||
IFS=$'\n' long_network=($( echo "$LSPCI" | gawk '
|
||||
BEGIN { IGNORECASE=1 }
|
||||
/^[0-9a-f:.]+ (ethernet|network) (controller|bridge)/ || /^[0-9a-f:.]+ [^:]+: .*(ethernet|network).*$/ {
|
||||
nic=gensub(/^[0-9a-f:.]+ [^:]+: (.+)$/,"\\1","g",$0)
|
||||
|
@ -1094,13 +1096,18 @@ print_networking_data()
|
|||
'))
|
||||
IFS="$OIFS"
|
||||
|
||||
if [[ -n ${LNNET[@]} ]]
|
||||
if [[ -n ${long_network[@]} ]]
|
||||
then
|
||||
I=0
|
||||
print_screen_output "$( printf "${C1}%-${INDENT}s${C2} %s" "Network cards" "${LNNET[I]}" )"
|
||||
while [[ -n ${LNNET[++I]} ]]
|
||||
if [[ ${#long_network[@]} -le 1 ]]
|
||||
then
|
||||
card_plural=''
|
||||
card_one=''
|
||||
fi
|
||||
i=0
|
||||
print_screen_output "$( printf "${C1}%-${INDENT}s${C2} %s" "Network Card$card_plural" "${C1}$card_one${C2}${long_network[i]}" )"
|
||||
while [[ -n ${long_network[++i]} ]]
|
||||
do
|
||||
print_screen_output "$( printf "${C1}%-${INDENT}s${C2} %s" " " "${LNNET[I]}" )"
|
||||
print_screen_output "$( printf "${C1}%-${INDENT}s${C2} %s" " " "${C1}($(($i+1)))${C2} ${long_network[i]}" )"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
@ -1108,18 +1115,20 @@ print_networking_data()
|
|||
print_it_out()
|
||||
{
|
||||
local hostName=$( hostname ) i=''
|
||||
local long_gfx='' long_cpu='' long_last='' long_intro='' short_full=''
|
||||
local root_home_data="$( df -h -T | egrep '(/|/boot|/var|/home)$' | C1=${C1} C2=${C2} awk '{print ENVIRON["C1"]"Partition:"ENVIRON["C2"], $7, ENVIRON["C1"]"- ", ENVIRON["C1"]"Size:"ENVIRON["C2"], $3, ENVIRON["C1"]"Used:"ENVIRON["C2"], $4, "(", $6, ")"}' )"
|
||||
root_home_data=$( echo $root_home_data )
|
||||
|
||||
# (IF VERBOSITY_LEVEL > 1)
|
||||
if [ "$VERBOSITY_LEVEL" -gt 0 ]
|
||||
then
|
||||
if [ "$SHOW_HOST" -gt 0 ]
|
||||
then
|
||||
LNINTRO=$( printf "${C1}%-${INDENT}s${C2} \"%s\"${C1} %s " "Host/Kernel/OS" "$hostName" "running" )
|
||||
long_intro=$( printf "${C1}%-${INDENT}s${C2} \"%s\"${C1} %s " "Host/Kernel/OS" "$hostName" "running" )
|
||||
else
|
||||
LNINTRO=$( printf "${C1}%-${INDENT}s${C2} " "OS/Kernel" )
|
||||
long_intro=$( printf "${C1}%-${INDENT}s${C2} " "OS/Kernel" )
|
||||
fi
|
||||
LNINTRO="$LNINTRO$( echo -ne "${C2}$OSKERN ${CN}[ ${C1}$DISTRO ${CN}]" )"
|
||||
print_screen_output "$LNINTRO"
|
||||
long_intro="$long_intro$( echo -ne "${C2}$OSKERN ${CN}[ ${C1}$DISTRO ${CN}]" )"
|
||||
print_screen_output "$long_intro"
|
||||
|
||||
##print_screen_output "CPU[0]=\"${CPU[0]}\""
|
||||
IFS=","
|
||||
|
@ -1142,93 +1151,103 @@ print_it_out()
|
|||
|
||||
if [[ ${#CPU[@]} -gt 2 ]]
|
||||
then
|
||||
CPUNUM="(1)"
|
||||
CPUNUM="${C1}(1)${C2} "
|
||||
else
|
||||
# Array CPU always has one element: max clockfreq found. Therefore -gt and not -ge
|
||||
unset CPUNUM
|
||||
fi
|
||||
LNCPU=$( printf "${C1}%-${INDENT}s${C2} %s" "CPU Info" "${CPUNUM}${CPUNUM+ }${CPUTMP[0]}" )
|
||||
long_cpu=$( printf "${C1}%-${INDENT}s${C2} %s" "CPU Info" "${CPUNUM}${CPUTMP[0]}" )
|
||||
if [ "$VERBOSITY_LEVEL" -ge 3 ]
|
||||
then
|
||||
LNCPU=$( printf "%s${C2} %s %s ${C1}%s${CN}%s${C2} %s ${CN}%s" "$LNCPU" "${CPUTMP[2]}" "cache" "flags" "(" "$CPUFLAGS" ")" )
|
||||
long_cpu=$( printf "%s${C2} %s %s ${C1}%s${CN}%s${C2} %s ${CN}%s" "$long_cpu" "${CPUTMP[2]}" "cache" "flags" "(" "$CPUFLAGS" ")" )
|
||||
fi
|
||||
LNCPU=$( printf "%s ${C1}%s${C2} ${CN}%s${C2} %s ${CN}%s" "$LNCPU" "clocked at" "[" "${CPUTMP[1]} MHz" "]" )
|
||||
print_screen_output "$LNCPU"
|
||||
long_cpu=$( printf "%s ${C1}%s${C2} ${CN}%s${C2} %s ${CN}%s" "$long_cpu" "clocked at" "[" "${CPUTMP[1]} MHz" "]" )
|
||||
print_screen_output "$long_cpu"
|
||||
|
||||
for (( i=1; i < ${#CPU[@]}-1; i++ ))
|
||||
do
|
||||
IFS=","
|
||||
CPUTMP=(${CPU[i]})
|
||||
IFS="$OIFS"
|
||||
LNCPU=$( printf "${C1}%-${INDENT}s${C2} %s" " " "($((i+1))) ${CPUTMP[0]}" )
|
||||
long_cpu=$( printf "${C1}%-${INDENT}s${C2} %s" " " "${C1}($((i+1)))${C2} ${CPUTMP[0]}" )
|
||||
if [[ $VERBOSITY_LEVEL -ge 3 ]]
|
||||
then
|
||||
LNCPU=$( printf "%s${C2} %s %s ${C1}%s${CN}%s${C2} %s ${CN}%s" "$LNCPU" "${CPUTMP[2]}" "cache" "flags" "(" "$CPUFLAGS" ")" )
|
||||
long_cpu=$( printf "%s${C2} %s %s ${C1}%s${CN}%s${C2} %s ${CN}%s" "$long_cpu" "${CPUTMP[2]}" "cache" "flags" "(" "$CPUFLAGS" ")" )
|
||||
fi
|
||||
LNCPU=$( printf "%s ${C1}%s${C2} ${CN}%s${C2} %s ${CN}%s" "$LNCPU" "clocked at" "[" "${CPUTMP[1]} MHz" "]" )
|
||||
print_screen_output "$LNCPU"
|
||||
if [[ $i -gt 10 ]]
|
||||
long_cpu=$( printf "%s ${C1}%s${C2} ${CN}%s${C2} %s ${CN}%s" "$long_cpu" "clocked at" "[" "${CPUTMP[1]} MHz" "]" )
|
||||
print_screen_output "$long_cpu"
|
||||
if [ "$i" -gt 10 ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
LNGFX=$( printf "${C1}%-${INDENT}s${C2} %s" "Videocard" "${GFX[0]}" )
|
||||
long_gfx=$( printf "${C1}%-${INDENT}s${C2} %s" "Graphics Info" "${C1}Video Card${C2} ${GFX[0]}" )
|
||||
if ((X))
|
||||
then
|
||||
LNGFX="${LNGFX}$( echo -ne "${C1} $XVER ${CN}[${C2} ${RES} ${CN}]" )"
|
||||
long_gfx="${long_gfx}$( echo -ne "${C1} $XVER ${CN}[${C2} ${RES} ${CN}]" )"
|
||||
else
|
||||
LNGFX="${LNGFX}$( echo -ne "${C1} tty resolution ${CN}(${C2} ${RES} ${CN})" )"
|
||||
long_gfx="${long_gfx}$( echo -ne "${C1} tty resolution ${CN}(${C2} ${RES} ${CN})" )"
|
||||
fi
|
||||
print_screen_output "$long_gfx"
|
||||
|
||||
if ((X)) && ! ((MESA))
|
||||
then
|
||||
#long_gfx="$( echo -ne "${INDENT}${C1}GLX Renderer${C2} ${GLXR}${CN} | ${C1}GLX Version${C2} ${GLXV}${CN}" )"
|
||||
long_gfx=$( printf "${C1}%-${INDENT}s${C2} %s" " " "${C1}GLX Renderer${C2} ${GLXR}${CN} | ${C1}GLX Version${C2} ${GLXV}${CN}" )
|
||||
if ((CRAP))
|
||||
then
|
||||
long_gfx="${long_gfx}$( echo -ne "${C1}Direct rendering${C2} ${GLXDR}${CN}" )"
|
||||
fi
|
||||
fi
|
||||
|
||||
print_screen_output "$LNGFX"
|
||||
print_screen_output "$long_gfx"
|
||||
i=1
|
||||
while [[ -n ${GFX[i]} && $i -le 3 ]]
|
||||
do
|
||||
LNGFX=$( printf "${C1}%-${INDENT}s${C2} %s" " " "${GFX[i]}" )
|
||||
print_screen_output "$LNGFX"
|
||||
long_gfx=$( printf "${C1}%-${INDENT}s${C2} %s" " " "${GFX[i]}" )
|
||||
print_screen_output "$long_gfx"
|
||||
(( i++ ))
|
||||
done
|
||||
|
||||
if [[ $VERBOSITY_LEVEL -ge 2 ]]
|
||||
if [ "$VERBOSITY_LEVEL" -ge 2 ]
|
||||
then
|
||||
print_networking_data
|
||||
fi
|
||||
|
||||
# Some code could look superfluous but BitchX doesn't like lines not ending in a newline. F*&k that bitch!
|
||||
LNLAST=$( echo -ne "${C1}Processes${C2} ${PROC}${CN} | ${C1}Uptime${C2} ${UPT}${CN} | ${C1}Memory${C2} ${MEM}${CN}" )
|
||||
if [[ $VERBOSITY_LEVEL -ge 2 ]]
|
||||
# long_last=$( echo -ne "${C1}Processes${C2} ${PROC}${CN} | ${C1}Uptime${C2} ${UPT}${CN} | ${C1}Memory${C2} ${MEM}${CN}" )
|
||||
if [ "$VERBOSITY_LEVEL" -ge 2 ]
|
||||
then
|
||||
LNLAST="${LNLAST}$( echo -ne " | ${C1}HDD${C2} ${HDDMOD} ${C1}Size${C2} ${HDD} (${HDDUSG})${CN}" )"
|
||||
long_last="$( printf "${C1}%-${INDENT}s${C2} %s" "System Info" "${C1}HDD${C2} ${HDDMOD} ${C1}Size${C2} ${HDD} (${HDDUSG})${CN}" )"
|
||||
else
|
||||
LNLAST="${LNLAST}$( echo -ne " | ${C1}HDD Size${C2} ${HDD} (${HDDUSG})${CN}" )"
|
||||
long_last="$( printf "${C1}%-${INDENT}s${C2} %s" "System Info" "${C1}HDD Size${C2} ${HDD} (${HDDUSG})${CN}" )"
|
||||
fi
|
||||
|
||||
if ((X)) && ! ((MESA))
|
||||
print_screen_output "$long_last"
|
||||
if [ "$VERBOSITY_LEVEL" -gt 3 ]
|
||||
then
|
||||
LNLAST="${LNLAST}$( echo -ne " | ${C1}GLX Renderer${C2} ${GLXR}${CN} | ${C1}GLX Version${C2} ${GLXV}${CN}" )"
|
||||
if ((CRAP))
|
||||
then
|
||||
LNLAST="${LNLAST}$( echo -ne " | ${C1}Direct rendering${C2} ${GLXDR}${CN}" )"
|
||||
fi
|
||||
long_last=$( printf "${C1}%-${INDENT}s${C2} %s" " " "${root_home_data}" )
|
||||
print_screen_output "$long_last"
|
||||
:
|
||||
fi
|
||||
|
||||
|
||||
long_last=$( printf "${C1}%-${INDENT}s${C2} %s" " " "${C1}Processes${C2} ${PROC}${CN} | ${C1}Uptime${C2} ${UPT}${CN} | ${C1}Memory${C2} ${MEM}${CN}" )
|
||||
if [[ $RUNLVL ]]
|
||||
then
|
||||
LNLAST="${LNLAST}$( echo -ne " | ${C1}Runlevel${C2} ${RUNLVL}${CN}" )"
|
||||
long_last="${long_last}$( echo -ne " | ${C1}Runlevel${C2} ${RUNLVL}${CN}" )"
|
||||
fi
|
||||
|
||||
if ((SHOW_IRC))
|
||||
then
|
||||
LNLAST="${LNLAST}$( echo -ne " | ${C1}Client${C2} ${IRC_CLIENT}${IRC_CLIENT_VERSION}${CN}" )"
|
||||
long_last="${long_last}$( echo -ne " | ${C1}Client${C2} ${IRC_CLIENT}${IRC_CLIENT_VERSION}${CN}" )"
|
||||
fi
|
||||
LNLAST="${LNLAST}$( echo -ne " | ${C1}${MY_VERSION}" )"
|
||||
long_last="${long_last}$( echo -ne " | ${C1}${MY_VERSION}" )"
|
||||
|
||||
if ((SCHEME))
|
||||
then
|
||||
LNLAST="${LNLAST}$( echo -ne "${NORMAL}" )"
|
||||
long_last="${long_last}$( echo -ne "${NORMAL}" )"
|
||||
fi
|
||||
print_screen_output "$LNLAST"
|
||||
else # (IF VERBOSITY_LEVEL > 1 ... ELSE)
|
||||
print_screen_output "$long_last"
|
||||
else
|
||||
#set_color_scheme 12
|
||||
if ! ((IBSHELL))
|
||||
then
|
||||
|
@ -1253,18 +1272,18 @@ print_it_out()
|
|||
#C1="${C1},1"; C2="${C2},1"; CN="${CN},1"
|
||||
fi
|
||||
fi
|
||||
LNSHORT=$( echo -ne "${C1}CPU${CN}[${C2}${CPUMODEL} clocked at ${CPUCLOCK}${CN}] ${C1}Kernel${CN}[${C2}${OSKERN}${CN}] ${C1}Up${CN}[${C2}${FL2}${FL1}${UPT}${FL1}${CN}] ${C1}Mem${CN}[${C2}${FL2}${FL1}${MEM}${FL1}${CN}] ${C1}HDD${CN}[${C2}${FL2}${FL1}${HDD}($HDDUSG)${FL1}${CN}] ${C1}Procs${CN}[${C2}${FL2}${FL1}${PROC}${FL1}${CN}]" )
|
||||
short_full=$( echo -ne "${C1}CPU${CN}[${C2}${CPUMODEL} clocked at ${CPUCLOCK}${CN}] ${C1}Kernel${CN}[${C2}${OSKERN}${CN}] ${C1}Up${CN}[${C2}${FL2}${FL1}${UPT}${FL1}${CN}] ${C1}Mem${CN}[${C2}${FL2}${FL1}${MEM}${FL1}${CN}] ${C1}HDD${CN}[${C2}${FL2}${FL1}${HDD}($HDDUSG)${FL1}${CN}] ${C1}Procs${CN}[${C2}${FL2}${FL1}${PROC}${FL1}${CN}]" )
|
||||
|
||||
if ((SHOW_IRC))
|
||||
then
|
||||
LNSHORT="${LNSHORT}$( echo -ne " ${C1}Client${CN}[${C2}${IRC_CLIENT}${IRC_CLIENT_VERSION}${CN}]" )"
|
||||
short_full="${short_full}$( echo -ne " ${C1}Client${CN}[${C2}${IRC_CLIENT}${IRC_CLIENT_VERSION}${CN}]" )"
|
||||
fi
|
||||
if ((SCHEME))
|
||||
then
|
||||
LNSHORT="${LNSHORT}$( echo -ne "$NORMAL" )"
|
||||
short_full="${short_full}$( echo -ne "$NORMAL" )"
|
||||
fi
|
||||
print_screen_output "$LNSHORT"
|
||||
fi # (IF VERBOSITY_LEVEL > 1)
|
||||
print_screen_output "$short_full"
|
||||
fi
|
||||
}
|
||||
|
||||
########################################################################
|
||||
|
|
Loading…
Reference in a new issue