mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 08:11:39 +00:00
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:
parent
3e51b33047
commit
4d59973cd1
52
inxi
52
inxi
|
@ -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'
|
||||
|
@ -2715,7 +2716,14 @@ get_start_client()
|
|||
exit
|
||||
}' )"
|
||||
else
|
||||
IRC_CLIENT="PPID=\"$PPID\" - empty?"
|
||||
# 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
|
||||
|
@ -6637,7 +6645,7 @@ get_shell_data()
|
|||
eval $LOGFS
|
||||
|
||||
local shell_type="$( ps -p $PPID -o comm= 2>/dev/null )"
|
||||
local shell_version=''
|
||||
local shell_version=''
|
||||
|
||||
if [[ $B_EXTRA_DATA == 'true' && -n $shell_type ]];then
|
||||
case $shell_type in
|
||||
|
@ -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,12 +7623,12 @@ 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 )"
|
||||
local script_patch_number=$( get_patch_version_string )
|
||||
local gcc_string='' gcc_installed='' gcc_others='' closing_data=''
|
||||
local gcc_string='' gcc_installed='' gcc_others='' closing_data=''
|
||||
|
||||
if [[ $B_EXTRA_DATA == 'true' ]];then
|
||||
get_gcc_system_version
|
||||
|
@ -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
5
inxi.1
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue