mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
more refactoring, some bug fixes that made layout display wrong in editors
This commit is contained in:
parent
04674b0e72
commit
a5dd519b0f
71
inxi
71
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 0.1.5
|
||||
#### version: 0.1.6
|
||||
#### Date: October 27 2008
|
||||
########################################################################
|
||||
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
||||
|
@ -146,7 +146,7 @@ error_handler()
|
|||
print_screen_output "$SCRIPT_NAME: large flood danger, debug buffer full!"
|
||||
;;
|
||||
3)
|
||||
print_screen_output "$SCRIPT_NAME: error in colorscheme, or unknown parameter: $2"
|
||||
print_screen_output "$SCRIPT_NAME: error in colorscheme - unsupported number: $2"
|
||||
;;
|
||||
4)
|
||||
print_screen_output "$SCRIPT_NAME: unknown verbosity level $2"
|
||||
|
@ -157,6 +157,9 @@ error_handler()
|
|||
6)
|
||||
print_screen_output "$SCRIPT_NAME: /proc not found! Quitting..."
|
||||
;;
|
||||
7)
|
||||
print_screen_output "$SCRIPT_NAME: unknown parameter: $2"
|
||||
;;
|
||||
*)
|
||||
print_screen_output "$SCRIPT_NAME: error unknown: $@"
|
||||
set -- 99
|
||||
|
@ -460,12 +463,16 @@ get_parameters()
|
|||
exit 0
|
||||
;;
|
||||
*)
|
||||
# these will need to be converted to standard type options
|
||||
echo "$1" | grep -q '^[0-9][0-9]\?$' || error_handler 3 "$1"
|
||||
if ! ((CSCHEME))
|
||||
then
|
||||
set_color_scheme "$1"
|
||||
fi
|
||||
;;
|
||||
# *)
|
||||
# error_handler 7 "$1"
|
||||
# ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
@ -689,7 +696,7 @@ CPUTMP=(${CPU[0]})
|
|||
IFS="$OIFS"
|
||||
# For the short line
|
||||
CPUMODEL="${CPU2}${CPU2+ }${CPUTMP[0]}" # clocked at [${CPU[${#CPU[@]}-1]}]" # old CPU2
|
||||
CPUCLOCK="${CPU[${#CPU[@]}-1]}" # old CPU3
|
||||
CPUCLOCK="$CPU[${#CPU[@]}-1]" # old CPU3
|
||||
CPUFLAGS="${CPUTMP[3]}" # old CPU4
|
||||
# nx = AMD stack protection extensions
|
||||
# lm = Intel 64bit extensions
|
||||
|
@ -747,7 +754,8 @@ if [[ -e /proc/scsi/scsi ]]
|
|||
then
|
||||
# Silly sata detection, will also pick up usb sticks, and it is all I will put into infobash. if you want more, infoperl is on
|
||||
# the way :)
|
||||
IFS=$'\n'; THDD=($(gawk '
|
||||
IFS=$'\n'
|
||||
THDD=($(gawk '
|
||||
BEGIN { IGNORECASE=1 }
|
||||
/host/ {
|
||||
getline a[$0]
|
||||
|
@ -850,7 +858,10 @@ then
|
|||
print(line)
|
||||
}
|
||||
')
|
||||
[[ -z $RES ]] && RES=$(xdpyinfo | gawk '/dimensions/ { print $2 }')
|
||||
if [[ -z $RES ]]
|
||||
then
|
||||
RES=$( xdpyinfo | gawk '/dimensions/ { print $2 }' )
|
||||
fi
|
||||
|
||||
# X vendor and version detection.
|
||||
XVENDOR=$( xdpyinfo | gawk -F': +' '
|
||||
|
@ -866,7 +877,9 @@ then
|
|||
# Later on, the normal textual version string returned, e.g. like: X.Org version: 6.8.2
|
||||
# A failover mechanism is in place. (if $XVERNUM is empty, the release number is parsed instead)
|
||||
XVERNUM=$( xdpyinfo | awk '/version:/ { print $NF }' )
|
||||
[[ -z $XVERNUM ]] && XVERNUM=$(xdpyinfo | gawk -F': +' '
|
||||
if [[ -z $XVERNUM ]]
|
||||
then
|
||||
XVERNUM=$(xdpyinfo | gawk -F': +' '
|
||||
BEGIN { IGNORECASE=1 }
|
||||
/vendor release number/ {
|
||||
gsub(/0+$/,"",$2)
|
||||
|
@ -874,6 +887,7 @@ then
|
|||
print $2
|
||||
}
|
||||
')
|
||||
fi
|
||||
|
||||
#X -version 2>&1 | gawk '/^X Window System Version/ { print $5 }'
|
||||
#This method could be used in the future to detect X when X is not running,
|
||||
|
@ -913,12 +927,17 @@ then
|
|||
}
|
||||
' ) )
|
||||
IFS="$OIFS"
|
||||
GLXR="${GLX[0]}"; GLXV="${GLX[1]}"; GLXDR="${GLX[2]}"
|
||||
GLXR="${GLX[0]}"
|
||||
GLXV="${GLX[1]}"
|
||||
GLXDR="${GLX[2]}"
|
||||
|
||||
# GLXR=$(glxinfo | gawk -F ': ' 'BEGIN {IGNORECASE=1} /opengl renderer/ && $2 !~ /mesa/ {seen[$2]++} END {for (i in seen) {printf("%s ",i)}}')
|
||||
# GLXV=$(glxinfo | gawk -F ': ' 'BEGIN {IGNORECASE=1} /opengl version/ && $2 !~ /mesa/ {seen[$2]++} END {for (i in seen) {printf("%s ",i)}}')
|
||||
|
||||
[[ -z $GLXR || -z $GLXV ]] && MESA=1
|
||||
if [[ -z $GLXR || -z $GLXV ]]
|
||||
then
|
||||
MESA=1
|
||||
fi
|
||||
AGPMOD=$(gawk '/agp/ && !/agpgart/ && $3 > 0 { print(gensub(/(.*)_agp.*/,"\\1","g",$1)) }' /proc/modules)
|
||||
else
|
||||
RES=$( stty -F $( readlink /proc/$PPID/fd/0 ) size | gawk '{ print $2"x"$1 }' )
|
||||
|
@ -937,7 +956,9 @@ then
|
|||
print_screen_output "$LNINTRO"
|
||||
|
||||
##print_screen_output "CPU[0]=\"${CPU[0]}\""
|
||||
IFS=","; CPUTMP=(${CPU[0]}); IFS="$OIFS"
|
||||
IFS=","
|
||||
CPUTMP=(${CPU[0]})
|
||||
IFS="$OIFS"
|
||||
# Strange (and also some expected) behavior encountered.
|
||||
# If print_screen_output() uses $1 as the parameter to output to the screen, then passing "<text1> ${ARR[@]} <text2>"
|
||||
# will output only <text1> and the first element of ARR. That "@" splits in elements and "*" _doesn't_, is to be expected.
|
||||
|
@ -1088,13 +1109,37 @@ else # (IF VBL > 1 ... ELSE)
|
|||
#set_color_scheme 12
|
||||
if ! ((IBSHELL))
|
||||
then
|
||||
for I in $C1 $C2 $CN ; do case "$I" in "$GREEN"|"$WHITE"|"$YELLOW"|"$CYAN") BGBLACK=1 ;; esac ; done
|
||||
((BGBLACK)) && { for I in C1 C2 CN ; do [[ "${!I}" = "$NORMAL" ]] && declare $I="${!I}15,1" || declare $I="${!I},1" ; done ; }
|
||||
for I in $C1 $C2 $CN
|
||||
do
|
||||
case "$I" in
|
||||
"$GREEN"|"$WHITE"|"$YELLOW"|"$CYAN") BGBLACK=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if ((BGBLACK))
|
||||
then
|
||||
for I in C1 C2 CN
|
||||
do
|
||||
if [[ "${!I}" = "$NORMAL" ]]
|
||||
then
|
||||
declare $I="${!I}15,1"
|
||||
else
|
||||
declare $I="${!I},1"
|
||||
fi
|
||||
done
|
||||
#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}]" )
|
||||
((SHOW_IRC)) && LNSHORT="${LNSHORT}$(echo -ne " ${C1}Client${CN}[${C2}${IRC}${IRCV}${CN}]")"
|
||||
((SCHEME)) && LNSHORT="${LNSHORT}$(echo -ne "$NORMAL")"
|
||||
|
||||
if ((SHOW_IRC))
|
||||
then
|
||||
LNSHORT="${LNSHORT}$( echo -ne " ${C1}Client${CN}[${C2}${IRC}${IRCV}${CN}]" )"
|
||||
fi
|
||||
if ((SCHEME))
|
||||
then
|
||||
LNSHORT="${LNSHORT}$( echo -ne "$NORMAL" )"
|
||||
fi
|
||||
print_screen_output "$LNSHORT"
|
||||
fi # (IF VBL > 1)
|
||||
|
||||
|
|
Loading…
Reference in a new issue