New version, new tarball, new man page. Fixed an old bug where if you start inxi with

an ssh command sometimes it will not show any client information, just the debugger 
PPID output. Now it will test as a final check to see if it can detect any parent to
the process. Actually grandparent I believe. Seems to work, it's a fringe case but
why not handle it?

New -xx feature, for -I it will show, if inxi is not running in IRC client and if 
is running in X, and if the grandparent is not 'login', will show the application
the shell is running in.

Example: 
Info:      Processes: 271 Uptime: 5:36 Memory: 3255.8/4048.5MB Runlevel: 3 
           Gcc sys: 4.7.2 alt: 4.0/4.2/4.4/4.5/4.6 
                      Client: Shell (bash 4.2.37 - started in konsole) inxi: 1.8.33
This commit is contained in:
inxi-svn 2013-01-29 00:03:06 +00:00
parent 3e51b33047
commit 4d59973cd1
3 changed files with 73 additions and 9 deletions

46
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 1.8.32
#### Date: January 23 2013
#### version: 1.8.33
#### Date: January 28 2013
#### Patch Number: 00
########################################################################
#### SPECIAL THANKS
@ -2299,6 +2299,7 @@ show_options()
print_screen_output " -D - Adds disk serial number."
print_screen_output " -G - Adds chip vendor:product ID for each video card."
print_screen_output " -I - Adds other detected installed gcc versions to primary gcc output (if present)."
print_screen_output " Adds parent program for shell info if running in X (like Konsole or Gterm)."
print_screen_output " -M - Adds chassis information, if any data for that is available."
print_screen_output " -N - Adds chip vendor:product ID for each nic."
print_screen_output " -R - Adds superblock (if present); algorythm, U data. Adds system info line (kernel support,"
@ -2413,7 +2414,7 @@ get_start_client()
eval $LOGFS
local irc_client_path='' irc_client_path_lower='' non_native_konvi='' i=''
local b_non_native_app='false' pppid='' app_working_name='' file_data=''
local b_qt4_konvi='false'
local b_qt4_konvi='false' ps_parent=''
if [[ $B_RUNNING_IN_SHELL == 'true' ]];then
IRC_CLIENT='Shell'
@ -2714,8 +2715,15 @@ get_start_client()
}
exit
}' )"
else
# this should handle certain cases where it's ssh or some other startup tool
# that falls through all the other tests
ps_parent=$(ps -p $PPID --no-headers 2>/dev/null | gawk '{print $NF}' )
if [[ -n $ps_parent ]];then
IRC_CLIENT=$ps_parent
else
IRC_CLIENT="PPID=\"$PPID\" - empty?"
fi
unset IRC_CLIENT_VERSION
fi
fi
@ -6661,6 +6669,13 @@ get_shell_data()
shell_version=$( get_de_app_version "$shell_type" "^zsh" "2" )
;;
esac
if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then
script_parent=$( ps -fp $PPID --no-headers 2>/dev/null | awk '/'"$PPID"'/ { print $3 }' )
shell_parent=$( ps -p $script_parent --no-headers 2>/dev/null | awk '/'"$script_parent"'/ { print $NF}' )
if [[ -n $shell_parent ]];then
shell_parent=" - parent $shell_parent"
fi
fi
fi
if [[ -n $shell_version ]];then
shell_type="$shell_type $shell_version"
@ -6670,6 +6685,18 @@ get_shell_data()
eval $LOGFS
}
get_shell_parent()
{
eval $LOGFS
local shell_parent='' script_parent=''
script_parent=$( ps -fp $PPID --no-headers 2>/dev/null | awk '/'"$PPID"'/ { print $3 }' )
shell_parent=$( ps -p $script_parent --no-headers 2>/dev/null | awk '/'"$script_parent"'/ { print $NF}' )
echo $shell_parent
eval $LOGFE
}
get_unmounted_partition_data()
{
eval $LOGFS
@ -7596,7 +7623,7 @@ print_info_data()
eval $LOGFS
local info_data='' line_starter='Info:'
local runlvl='' client_data='' shell_data=''
local runlvl='' client_data='' shell_data='' shell_parent=''
local memory="$( get_memory_data )"
local processes="$(( $( ps aux | wc -l ) - 1 ))"
local up_time="$( get_uptime )"
@ -7620,7 +7647,16 @@ print_info_data()
if [[ $B_RUNNING_IN_SHELL == 'true' ]];then
shell_data=$( get_shell_data )
if [[ -n $shell_data ]];then
IRC_CLIENT="$IRC_CLIENT ($shell_data)"
# note, if you start this in tty, it will give 'login' as the parent, which we don't want.
if [[ $B_EXTRA_EXTRA_DATA == 'true' && $B_RUNNING_IN_X == 'true' ]];then
shell_parent=$( get_shell_parent )
if [[ $shell_parent == 'login' ]];then
shell_parent=''
elif [[ -n $shell_parent ]];then
shell_parent=" running in $shell_parent"
fi
fi
IRC_CLIENT="$IRC_CLIENT ($shell_data$shell_parent)"
fi
fi

5
inxi.1
View file

@ -1,4 +1,4 @@
.TH INXI 1 "2013-01-26" inxi "inxi manual"
.TH INXI 1 "2013-01-28" inxi "inxi manual"
.SH NAME
inxi - Command line system information script for console and IRC
@ -330,6 +330,9 @@ The following shows which lines / items get extra information with each extra da
.B -xx -I
- Adds other detected installed gcc versions to primary gcc output (if present).
.TP
.B -xx -I
- Adds parent program that started shell if running in X and not IRC client to shell information.
.TP
.B -xx -M
- Adds chassis information, if any data for that is available.
.TP

View file

@ -1,3 +1,28 @@
=====================================================================================
Version: 1.8.33
Patch Version: 00
Script Date: January 28 2013
-----------------------------------
Changes:
-----------------------------------
New version, new tarball, new man page. Fixed an old bug where if you start inxi with
an ssh command sometimes it will not show any client information, just the debugger
PPID output. Now it will test as a final check to see if it can detect any parent to
the process. Actually grandparent I believe. Seems to work, it's a fringe case but
why not handle it?
New -xx feature, for -I it will show, if inxi is not running in IRC client and if
is running in X, and if the grandparent is not 'login', will show the application
the shell is running in.
Example:
Info: Processes: 271 Uptime: 5:36 Memory: 3255.8/4048.5MB Runlevel: 3
Gcc sys: 4.7.2 alt: 4.0/4.2/4.4/4.5/4.6
Client: Shell (bash 4.2.37 - started in konsole) inxi: 1.8.33
-----------------------------------
-- Harald Hope - Mon, 28 Jan 2013 15:57:15 -0800
=====================================================================================
Version: 1.8.32
Patch Version: 00