mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
more refactoring and code cleanup, it's starting to get readable now
This commit is contained in:
parent
a5dd519b0f
commit
46f05dc2fc
26
inxi
26
inxi
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
########################################################################
|
########################################################################
|
||||||
#### Script Name: inxi
|
#### Script Name: inxi
|
||||||
#### version: 0.1.6
|
#### version: 0.1.7
|
||||||
#### Date: October 27 2008
|
#### Date: October 27 2008
|
||||||
########################################################################
|
########################################################################
|
||||||
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
||||||
|
@ -38,7 +38,11 @@ ALLUP=0 # inxi hasn't been 'booted' yet.
|
||||||
DEBUG=0 # Set levels from 1-10
|
DEBUG=0 # Set levels from 1-10
|
||||||
DEBUG_FLOOD=0 # Debug flood override: toggle on to allow long debug output
|
DEBUG_FLOOD=0 # Debug flood override: toggle on to allow long debug output
|
||||||
DBI=0 # Debug Buffer Index, index into a debug buffer storing debug messages until infobash is 'all up'
|
DBI=0 # Debug Buffer Index, index into a debug buffer storing debug messages until infobash is 'all up'
|
||||||
((DEBUG)) || exec 2>/dev/null # Reroute all error messages to the bitbucket (if not debugging)
|
if ! ((DEBUG))
|
||||||
|
then
|
||||||
|
# Reroute all error messages to the bitbucket (if not debugging)
|
||||||
|
exec 2>/dev/null
|
||||||
|
fi
|
||||||
#((DEBUG)) && exec 2>&1 # This is for debugging konversation
|
#((DEBUG)) && exec 2>&1 # This is for debugging konversation
|
||||||
|
|
||||||
# Clear nullglob, because it creates unpredictable situations with IFS=$'\n' ARR=($VAR) IFS="$OIFS"
|
# Clear nullglob, because it creates unpredictable situations with IFS=$'\n' ARR=($VAR) IFS="$OIFS"
|
||||||
|
@ -79,10 +83,10 @@ IBSHELL=0 # Running in a shell? Defaults to false, and is determined later.
|
||||||
NO_CPU_COUNT=0 # Wether or not the string "dual" or similar is found in cpuinfo output. If so, avoid dups.
|
NO_CPU_COUNT=0 # Wether or not the string "dual" or similar is found in cpuinfo output. If so, avoid dups.
|
||||||
# In cases of derived distros where the version file of the base distro can also be found under /etc, the derived distro's
|
# 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)
|
# version file should go first. (Such as with Sabayon / Gentoo)
|
||||||
DIST_DERIV="antiX kanotix-version knoppix-version redhat-release sabayon-release sidux-version turbolinux-release zenwalk-version"
|
DISTROS_SECONDARY="antiX kanotix-version knoppix-version redhat-release sabayon-release sidux-version turbolinux-release zenwalk-version"
|
||||||
DIST_MAIN="gentoo-release mandrake-release redhat-release slackware-version SuSE-release"
|
DISTROS_PRIMARY="gentoo-release mandrake-release redhat-release slackware-version SuSE-release"
|
||||||
# debian_version excluded from DIST_MAIN so Debian can fall through to /etc/issue detection. Same goes for Ubuntu.
|
# debian_version excluded from DISTROS_PRIMARY so Debian can fall through to /etc/issue detection. Same goes for Ubuntu.
|
||||||
DIST_BLIST="debian_version ubuntu_version"
|
DISTROS_BLIST="debian_version ubuntu_version"
|
||||||
FL1='-' # These two determine seperators in single line output, to force irc clients not to break off sections
|
FL1='-' # These two determine seperators in single line output, to force irc clients not to break off sections
|
||||||
FL2=''
|
FL2=''
|
||||||
# Precede a banword with $'\2' to prevent it from being subject to automated escaping by the make_bans routine
|
# Precede a banword with $'\2' to prevent it from being subject to automated escaping by the make_bans routine
|
||||||
|
@ -329,7 +333,10 @@ get_start_app()
|
||||||
# Since Konversation 1.0, the DCOP interface has changed a bit: dcop "$DCPORT" Konversation ..etc
|
# Since Konversation 1.0, the DCOP interface has changed a bit: dcop "$DCPORT" Konversation ..etc
|
||||||
# becomes : dcop "$DCPORT" default ... or dcop "$DCPORT" irc ..etc. So we check for versions smaller
|
# becomes : dcop "$DCPORT" default ... or dcop "$DCPORT" irc ..etc. So we check for versions smaller
|
||||||
# than 1 and change the DCOP parameter/object accordingly.
|
# than 1 and change the DCOP parameter/object accordingly.
|
||||||
[[ ${T2} < 1 ]] && DCOPOBJ="Konversation"
|
if [[ ${T2} < 1 ]]
|
||||||
|
then
|
||||||
|
DCOPOBJ="Konversation"
|
||||||
|
fi
|
||||||
IRC="Konversation"
|
IRC="Konversation"
|
||||||
;;
|
;;
|
||||||
*xchat*)
|
*xchat*)
|
||||||
|
@ -580,7 +587,7 @@ then
|
||||||
DISTFILE="${DISTGLOB}"
|
DISTFILE="${DISTGLOB}"
|
||||||
elif (( ${#DISTGLOB[@]} > 1 ))
|
elif (( ${#DISTGLOB[@]} > 1 ))
|
||||||
then
|
then
|
||||||
for I in $DIST_DERIV $DIST_MAIN
|
for I in $DISTROS_SECONDARY $DISTROS_PRIMARY
|
||||||
do
|
do
|
||||||
# Only echo works with ${var[@]}, not print_screen_output() or script_debugger()
|
# Only echo works with ${var[@]}, not print_screen_output() or script_debugger()
|
||||||
# This is a known bug, search for the word "strange" inside comments
|
# This is a known bug, search for the word "strange" inside comments
|
||||||
|
@ -592,7 +599,7 @@ then
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if [ -n "$DISTFILE" -a -s /etc/$DISTFILE -a " $DIST_BLIST " != *" $DISTFILE "* ]
|
if [ -n "$DISTFILE" -a -s /etc/$DISTFILE -a " $DISTROS_BLIST " != *" $DISTFILE "* ]
|
||||||
then
|
then
|
||||||
DISTRO=$( eat "/etc/$DISTFILE" )
|
DISTRO=$( eat "/etc/$DISTFILE" )
|
||||||
else
|
else
|
||||||
|
@ -858,6 +865,7 @@ then
|
||||||
print(line)
|
print(line)
|
||||||
}
|
}
|
||||||
' )
|
' )
|
||||||
|
|
||||||
if [[ -z $RES ]]
|
if [[ -z $RES ]]
|
||||||
then
|
then
|
||||||
RES=$( xdpyinfo | gawk '/dimensions/ { print $2 }' )
|
RES=$( xdpyinfo | gawk '/dimensions/ { print $2 }' )
|
||||||
|
|
Loading…
Reference in a new issue