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

38
inxi
View file

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