Made just the one test, for sh|bash|dash|perl that handles now all cases, including konversation

This commit is contained in:
inxi-svn 2008-11-09 04:16:13 +00:00
parent d019d7b7c5
commit d63f5d8d39

36
inxi
View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 0.4.17 #### version: 0.4.18
#### Date: November 8 2008 #### Date: November 8 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
@ -589,6 +589,7 @@ script_self_updater()
get_start_client() get_start_client()
{ {
local irc_client_path='' irc_client_path_lower='' non_native_konvi='' i='' local irc_client_path='' irc_client_path_lower='' non_native_konvi='' i=''
local b_non_native_app='false' pppid=''
if tty >/dev/null;then if tty >/dev/null;then
IRC_CLIENT="Shell" IRC_CLIENT="Shell"
@ -598,23 +599,25 @@ get_start_client()
irc_client_path=$( readlink /proc/$PPID/exe ) irc_client_path=$( readlink /proc/$PPID/exe )
irc_client_path_lower=$( tr '[:upper:]' '[:lower:]' <<< $irc_client_path ) irc_client_path_lower=$( tr '[:upper:]' '[:lower:]' <<< $irc_client_path )
# from sidux infobash, handle bad detection of shell; Horst Tritremmel <hjt at sidux.com> # from sidux infobash, handle bad detection of shell; Horst Tritremmel <hjt at sidux.com>
# note: do NOT put into '' or "" the dash|bash stuff, otherwise the structure fails # note: do NOT put into '' or "" the dash|bash\perl stuff, otherwise the structure fails
if [[ ${irc_client_path_lower##*/} =~ dash|bash|sh ]]; then # handles the xchat/sh/bash/dash cases, and the konversation perl cases
# We want to know who wrapped it into the shell. # handles the problem with konversation reporting itself as perl, which was missed because
PPPID="$( ps -p $PPID -o ppid --no-headers | sed 's/ //g' )" # when konversation starts inxi from inside itself, as a script, the parent is konversation, not perl
if [[ -n $PPPID && -f /proc/$PPPID/exe ]];then if [[ ${irc_client_path_lower##*/} =~ dash|bash|sh|perl ]]; then
irc_client_path="$( readlink /proc/$PPPID/exe )" # We want to know who wrapped it into the shell or perl.
pppid="$( ps -p $PPID -o ppid --no-headers | sed 's/ //g' )"
if [[ -n $pppid && -f /proc/$pppid/exe ]];then
irc_client_path="$( readlink /proc/$pppid/exe )"
irc_client_path_lower="$( tr '[:upper:]' '[:lower:]' <<< $irc_client_path )" irc_client_path_lower="$( tr '[:upper:]' '[:lower:]' <<< $irc_client_path )"
b_non_native_app='true'
fi fi
fi fi
# replacing this fix with the one above, which is more globally affective
# this handles the problem with konversation reporting itself as perl, which was missed because # if [[ -z $( grep -i 'konversation' <<< $irc_client_path ) && -n $( grep -i 'perl' <<< $irc_client_path ) && -n $( pidof konversation ) ]];then
# when konversation starts inxi from inside itself, as a script, the parent is konversation, not perl # irc_client_path=$( which konversation )
if [[ -z $( grep -i 'konversation' <<< $irc_client_path ) && -n $( grep -i 'perl' <<< $irc_client_path ) && -n $( pidof konversation ) ]];then # irc_client_path_lower=$( tr '[:upper:]' '[:lower:]' <<< $irc_client_path )
irc_client_path=$( which konversation ) # non_native_konvi='true'
irc_client_path_lower=$( tr '[:upper:]' '[:lower:]' <<< $irc_client_path ) # fi
non_native_konvi='true'
fi
case $irc_client_path_lower in case $irc_client_path_lower in
*irssi-text*|*irssi*) *irssi-text*|*irssi*)
@ -623,7 +626,7 @@ get_start_client()
;; ;;
*konversation*) *konversation*)
# this is necessary to avoid the dcop errors from starting inxi as a /cmd started script # this is necessary to avoid the dcop errors from starting inxi as a /cmd started script
if [[ $non_native_konvi == 'true' ]];then if [[ $b_non_native_app == 'true' ]];then
KONVI=2 KONVI=2
else else
KONVI=1 KONVI=1
@ -640,6 +643,7 @@ get_start_client()
} }
exit exit
}' )" }' )"
T=($IRC_CLIENT_VERSION) T=($IRC_CLIENT_VERSION)
if [[ ${T[0]} == *+* ]];then if [[ ${T[0]} == *+* ]];then
# < Sho_> locsmif: The version numbers of SVN versions look like this: # < Sho_> locsmif: The version numbers of SVN versions look like this: