diff --git a/inxi b/inxi index 1318215..7efa8ce 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/usr/bin/env bash ######################################################################## #### Script Name: inxi -#### Version: 2.1.9 -#### Date: 2014-03-24 +#### Version: 2.1.10 +#### Date: 2014-03-25 #### Patch Number: 00 ######################################################################## #### SPECIAL THANKS @@ -108,6 +108,7 @@ #### * Note: [[ -n $something ]] - double brackets does not require quotes for variables: ie, "$something". #### * Always use quotes, double or single, for all string values. #### * All new code/methods must be in a function. + #### * For all boolean tests, use 'true' / 'false'. #### !! Do NOT use 0 or 1 unless it's a function return. #### * Avoid complicated tests in the if condition itself. @@ -3134,18 +3135,16 @@ get_irc_client_version() ;; esac ;; - supybot|limnoria) - # ff=$(nano --version);ff=( $ff );time for ((i=0;i<1000;i++)); do ff=${ff[3]};done;echo $ff - # time for ((i=0;i<1000;i++)); do ff=$(nano --version| gawk 'NR == 1 {print $4}' );done;echo $ff - # ff=$(nano --version);time for ((i=0;i<1000;i++)); do ff=$(gawk 'NR == 1 {print $4}' <<< $ff );done;echo $ff - IRC_CLIENT_VERSION=" $( $Irc_Client_Path --version | gawk 'NR == 1 { - print $2 - }' )" - if [[ -n $IRC_CLIENT_VERSION ]] && \ - [[ -n $( grep 'limnoria' <<< $IRC_CLIENT_VERSION ) || $App_Working_Name == 'limnoria' ]];then - IRC_CLIENT="Limnoria" - else - IRC_CLIENT="Supybot" + gribble|limnoria|supybot) + IRC_CLIENT_VERSION=" $( get_program_version 'supybot' '^Supybot' '2' )" + if [[ -n $IRC_CLIENT_VERSION ]];then + if [[ -n ${IRC_CLIENT_VERSION/*gribble*/} || $App_Working_Name == 'gribble' ]];then + IRC_CLIENT="Gribble" + elif [[ -n ${IRC_CLIENT_VERSION/*limnoria*/} || $App_Working_Name == 'limnoria' ]];then + IRC_CLIENT="Limnoria" + else + IRC_CLIENT="Supybot" + fi fi ;; weechat|weechat-curses) @@ -3193,11 +3192,11 @@ get_irc_client_version() esac done B_CONSOLE_IRC='true' - set_perl_python_konvi "$App_Working_Name" + set_perl_python_client_data "$App_Working_Name" ;; python*) # B_CONSOLE_IRC='true' # are there even any python type console irc clients? check. - set_perl_python_konvi "$App_Working_Name" + set_perl_python_client_data "$App_Working_Name" ;; # then unset, set unknown data *) @@ -3211,23 +3210,46 @@ get_irc_client_version() } # args: $1 - App_Working_Name -set_perl_python_konvi() +set_perl_python_client_data() { if [[ -z $IRC_CLIENT_VERSION ]];then + local version='' # this is a hack to try to show konversation if inxi is running but started via /cmd - if [[ -n $( grep -i 'konversation' <<< "$Ps_aux_Data" ) && $B_RUNNING_IN_DISPLAY == 'true' ]];then + # OR via script shortcuts, both cases in fact now + if [[ $B_RUNNING_IN_DISPLAY == 'true' && -z ${Ps_aux_Data/*konversation*/} ]];then IRC_CLIENT='Konversation' - IRC_CLIENT_VERSION=" $( konversation --version 2>/dev/null | gawk '/^Konversation/ {print $2}' )" + version=$( get_program_version 'konversation' '^konversation' '2' ) B_CONSOLE_IRC='false' + ## NOTE: supybot only appears in ps aux using 'SHELL' command; the 'CALL' command + ## gives the user system irc priority, and you don't see supybot listed, so use SHELL + elif [[ $B_RUNNING_IN_DISPLAY == 'false' && -z ${Ps_aux_Data/*supybot*/} ]];then + version=$( get_program_version 'supybot' '^Supybot' '2' ) + if [[ -n $version ]];then + IRC_CLIENT_VERSION=" $version" + if [[ -z ${version/*gribble*/} ]];then + IRC_CLIENT='Gribble' + elif [[ -z ${version/*limnoria*/} ]];then + IRC_CLIENT='Limnoria' + else + IRC_CLIENT='Supybot' + fi + else + IRC_CLIENT='Supybot' + # currently all use the same actual app name, this will probably change. + fi + B_CONSOLE_IRC='true' else IRC_CLIENT="Unknown $1 client" fi + if [[ -n $version ]];then + IRC_CLIENT_VERSION=" $version" + fi fi } ## try to infer the use of Konversation >= 1.2, which shows $PPID improperly ## no known method of finding Kovni >= 1.2 as parent process, so we look to see if it is running, -## and all other irc clients are not running. +## and all other irc clients are not running. As of 2014-03-25 this isn't used in my cases is_this_qt4_konvi() { local konvi_qt4_client='' konvi_dbus_exist='' konvi_pid='' konvi_home_dir='' @@ -4012,7 +4034,7 @@ get_desktop_environment() elif [[ $KDE_FULL_SESSION == 'true' ]]; then version_data=$( kded --version 2>/dev/null ) version=$( grep -si '^KDE:' <<< "$version_data" | gawk '{print $2}' ) - # version=$( get_de_app_version 'kded' '^KDE:' '2' ) + # version=$( get_program_version 'kded' '^KDE:' '2' ) if [[ -z $version ]];then version='3.5' fi @@ -4024,7 +4046,7 @@ get_desktop_environment() fi desktop_environment="KDE" elif [[ $XDG_CURRENT_DESKTOP == 'Unity' ]];then - version=$( get_de_app_version 'unity' '^unity' '2' ) + version=$( get_program_version 'unity' '^unity' '2' ) # not certain cinn will always have version, so keep output right if not if [[ -n $version ]];then version="$version " @@ -4047,7 +4069,7 @@ get_desktop_environment() # eventually this needs to be better organized so all the xprop tests are in the same # section, but this is good enough for now. if [[ -n $xprop_root && -n $( grep -is '^_MUFFIN' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'cinnamon' '^cinnamon' '2' ) + version=$( get_program_version 'cinnamon' '^cinnamon' '2' ) # not certain cinn will always have version, so keep output right if not if [[ -n $version ]];then version="$version " @@ -4060,7 +4082,7 @@ get_desktop_environment() fi desktop_environment="Cinnamon" elif [[ -n $xprop_root && -n $( grep -is '^_MARCO' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'mate-about' '^MATE[[:space:]]DESKTOP' 'NF' ) + version=$( get_program_version 'mate-about' '^MATE[[:space:]]DESKTOP' 'NF' ) # not certain cinn/mate will always have version, so keep output right if not if [[ -n $version ]];then version="$version " @@ -4076,9 +4098,9 @@ get_desktop_environment() # https://bugzilla.gnome.org/show_bug.cgi?id=542880 elif [[ -n $GNOME_DESKTOP_SESSION_ID ]]; then if type -p gnome-shell &>/dev/null;then - version=$( get_de_app_version 'gnome-shell' 'gnome' '3' ) + version=$( get_program_version 'gnome-shell' 'gnome' '3' ) elif type -p gnome-about &>/dev/null;then - version=$( get_de_app_version 'gnome-about' 'gnome' '3' ) + version=$( get_program_version 'gnome-about' 'gnome' '3' ) fi if [[ $B_EXTRA_DATA == 'true' ]];then toolkit=$( get_de_gtk_data ) @@ -4095,16 +4117,16 @@ get_desktop_environment() # String: "This is xfdesktop version 4.2.12" # alternate: xfce4-about --version > xfce4-about 4.10.0 (Xfce 4.10) if [[ -n $( grep -Eis '\"xfce4\"' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'xfdesktop' 'xfdesktop[[:space:]]version' '5' ) + version=$( get_program_version 'xfdesktop' 'xfdesktop[[:space:]]version' '5' ) # arch linux reports null, so use alternate if null if [[ -z $version ]];then - version=$( get_de_app_version 'xfce4-panel' '^xfce4-panel' '2' ) + version=$( get_program_version 'xfce4-panel' '^xfce4-panel' '2' ) if [[ -z $version ]];then version='4' fi fi if [[ $B_EXTRA_DATA == 'true' ]];then - toolkit=$( get_de_app_version 'xfdesktop' 'Built[[:space:]]with[[:space:]]GTK' '4' ) + toolkit=$( get_program_version 'xfdesktop' 'Built[[:space:]]with[[:space:]]GTK' '4' ) if [[ -n $toolkit ]];then version="$version (Gtk $toolkit)" fi @@ -4112,16 +4134,16 @@ get_desktop_environment() desktop_environment="Xfce" # when 5 is released, the string may need updating elif [[ -n $( grep -is '\"xfce5\"' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'xfdesktop' 'xfdesktop[[:space:]]version' '5' ) + version=$( get_program_version 'xfdesktop' 'xfdesktop[[:space:]]version' '5' ) # arch linux reports null, so use alternate if null if [[ -z $version ]];then - version=$( get_de_app_version 'xfce5-panel' '^xfce5-panel' '2' ) + version=$( get_program_version 'xfce5-panel' '^xfce5-panel' '2' ) if [[ -z $version ]];then version='5' fi fi if [[ $B_EXTRA_DATA == 'true' ]];then - toolkit=$( get_de_app_version 'xfdesktop' 'Built[[:space:]]with[[:space:]]GTK' '4' ) + toolkit=$( get_program_version 'xfdesktop' 'Built[[:space:]]with[[:space:]]GTK' '4' ) if [[ -n $toolkit ]];then version="$version (Gtk $toolkit)" fi @@ -4129,14 +4151,14 @@ get_desktop_environment() desktop_environment="Xfce" elif [[ -n $( grep -is 'BLACKBOX_PID' <<< "$xprop_root" ) ]];then if [[ -n $( grep -is 'fluxbox' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'fluxbox' '^fluxbox' '2' ) + version=$( get_program_version 'fluxbox' '^fluxbox' '2' ) desktop_environment='Fluxbox' else desktop_environment='Blackbox' fi elif [[ -n $( grep -is 'OPENBOX_PID' <<< "$xprop_root" ) ]];then # note: openbox-lxde --version may be present, but returns openbox data - version=$( get_de_app_version 'openbox' '^openbox' '2' ) + version=$( get_program_version 'openbox' '^openbox' '2' ) if [[ $XDG_CURRENT_DESKTOP == 'LXDE' || \ -n $( grep -is 'lxde' <<< "$Ps_aux_Data" ) ]];then if [[ -n $version ]];then @@ -4152,7 +4174,7 @@ get_desktop_environment() desktop_environment='Openbox' fi elif [[ -n $( grep -is 'ICEWM' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'icewm' '^icewm' '2' ) + version=$( get_program_version 'icewm' '^icewm' '2' ) desktop_environment='IceWM' elif [[ -n $( grep -is 'ENLIGHTENMENT' <<< "$xprop_root" ) ]];then # no -v or --version but version is in xprop -root @@ -4160,10 +4182,10 @@ get_desktop_environment() version=$( grep -is 'ENLIGHTENMENT_VERSION' <<< "$xprop_root" | cut -d '"' -f 2 | gawk '{print $2}' ) desktop_environment='Enlightenment' elif [[ -n $( grep -is '^I3_' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'i3' '^i3' '3' ) + version=$( get_program_version 'i3' '^i3' '3' ) desktop_environment='i3' elif [[ -n $( grep -is 'WINDOWMAKER' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'wmaker' '^Window[[:space:]]*Maker' 'NF' ) + version=$( get_program_version 'wmaker' '^Window[[:space:]]*Maker' 'NF' ) if [[ -n $version ]];then version="$version " fi @@ -4171,14 +4193,14 @@ get_desktop_environment() elif [[ -n $( grep -is '^_WM2' <<< "$xprop_root" ) ]];then # note; there isn't actually a wm2 version available but error handling should cover it and return null # maybe one day they will add it? - version=$( get_de_app_version 'wm2' '^wm2' 'NF' ) + version=$( get_program_version 'wm2' '^wm2' 'NF' ) # not certain will always have version, so keep output right if not if [[ -n $version ]];then version="$version " fi desktop_environment="WM2" elif [[ -n $( grep -is 'herbstluftwm' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'herbstluftwm' '^herbstluftwm' 'NF' ) + version=$( get_program_version 'herbstluftwm' '^herbstluftwm' 'NF' ) if [[ -n $version ]];then version="$version " fi @@ -4189,37 +4211,37 @@ get_desktop_environment() # note that gawk is going to exit after first occurance of search string, so no need for extra if [[ -z $desktop_environment ]];then if [[ -n $( grep -is 'fvwm-crystal' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'fvwm' '^fvwm' '2' ) + version=$( get_program_version 'fvwm' '^fvwm' '2' ) desktop_environment='FVWM-Crystal' elif [[ -n $( grep -is 'fvwm' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'fvwm' '^fvwm' '2' ) + version=$( get_program_version 'fvwm' '^fvwm' '2' ) desktop_environment='FVWM' elif [[ -n $( grep -is 'pekwm' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'pekwm' '^pekwm' '3' ) + version=$( get_program_version 'pekwm' '^pekwm' '3' ) desktop_environment='pekwm' elif [[ -n $( grep -is 'awesome' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'awesome' '^awesome' '2' ) + version=$( get_program_version 'awesome' '^awesome' '2' ) desktop_environment='Awesome' elif [[ -n $( grep -is 'scrotwm' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'scrotwm' '^welcome.*scrotwm' '4' ) + version=$( get_program_version 'scrotwm' '^welcome.*scrotwm' '4' ) desktop_environment='Scrotwm' # no --version for this one elif [[ -n $( grep -is 'spectrwm' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'spectrwm' '^spectrwm.*welcome.*spectrwm' '5' ) + version=$( get_program_version 'spectrwm' '^spectrwm.*welcome.*spectrwm' '5' ) desktop_environment='Spectrwm' # no --version for this one elif [[ -n $( grep -Eis '([[:space:]]|/)twm' <<< "$Ps_aux_Data" ) ]];then desktop_environment='Twm' # no --version for this one elif [[ -n $( grep -Eis '([[:space:]]|/)dwm' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'dwm' '^dwm' '1' ) + version=$( get_program_version 'dwm' '^dwm' '1' ) desktop_environment='dwm' elif [[ -n $( grep -is 'wmii2' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'wmii2' '^wmii2' '1' ) + version=$( get_program_version 'wmii2' '^wmii2' '1' ) desktop_environment='wmii2' # note: in debian at least, wmii is actuall wmii3 elif [[ -n $( grep -is 'wmii' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'wmii' '^wmii' '1' ) + version=$( get_program_version 'wmii' '^wmii' '1' ) desktop_environment='wmii' elif [[ -n $( grep -Eis '([[:space:]]|/)jwm' <<< "$Ps_aux_Data" ) ]];then - version=$( get_de_app_version 'jwm' '^jwm' '2' ) + version=$( get_program_version 'jwm' '^jwm' '2' ) desktop_environment='JWM' fi fi @@ -4234,7 +4256,7 @@ get_desktop_environment() # note: gawk doesn't support white spaces in search string, gave errors, so use [[:space:]] instead # args: $1 - desktop/app command for --version; $2 - search string; $3 - gawk print number -get_de_app_version() +get_program_version() { local version_data='' version='' get_version='--version' @@ -5642,11 +5664,11 @@ get_init_data() if [[ -e /proc/1/comm && -n $( grep -s 'systemd' /proc/1/comm ) ]];then init_type='systemd' if type -p systemd &>/dev/null;then - init_version=$( get_de_app_version 'systemd' '^systemd' '2' ) + init_version=$( get_program_version 'systemd' '^systemd' '2' ) fi if [[ -z $init_version ]];then if type -p systemctl &>/dev/null;then - init_version=$( get_de_app_version 'systemctl' '^systemd' '2' ) + init_version=$( get_program_version 'systemctl' '^systemd' '2' ) fi fi else @@ -5655,11 +5677,11 @@ get_init_data() if [[ -n $( /sbin/init --version 2>/dev/null | grep 'upstart' ) ]];then init_type='Upstart' # /sbin/init --version == init (upstart 1.12.1) - init_version=$( get_de_app_version 'init' 'upstart' '3' ) + init_version=$( get_program_version 'init' 'upstart' '3' ) elif type -p epoch &>/dev/null;then init_type='Epoch' # epoch version == Epoch Init System 1.0.1 "Sage" - init_version=$( get_de_app_version 'epoch' '^Epoch' '4' ) + init_version=$( get_program_version 'epoch' '^Epoch' '4' ) # missing data: # http://smarden.org/runit/sv.8.html elif [[ -e /sbin/runit-init || -e /etc/runit || -n $( type -p sv ) ]];then @@ -5682,10 +5704,10 @@ get_init_data() rc_type='OpenRC' # /sbin/openrc --version == openrc (OpenRC) 0.13 if type -p openrc &>/dev/null;then - rc_version=$( get_de_app_version 'openrc' '^openrc' '3' ) + rc_version=$( get_program_version 'openrc' '^openrc' '3' ) # /sbin/rc --version == rc (OpenRC) 0.11.8 (Gentoo Linux) elif type -p rc &>/dev/null;then - rc_version=$( get_de_app_version 'rc' '^rc' '3' ) + rc_version=$( get_program_version 'rc' '^rc' '3' ) fi ## assume sysvrc, but this data is too buggy and weird and inconsistent to have meaning # leaving this off for now @@ -8325,24 +8347,24 @@ get_shell_data() if [[ $B_EXTRA_DATA == 'true' && -n $shell_type ]];then case $shell_type in bash) - shell_version=$( get_de_app_version "$shell_type" "^GNU[[:space:]]bash,[[:space:]]version" "4" | \ + shell_version=$( get_program_version "$shell_type" "^GNU[[:space:]]bash,[[:space:]]version" "4" | \ sed $SED_RX 's/(\(.*|-release|-version)//' ) ;; # csh/dash use dpkg package version data, debian/buntu only csh) - shell_version=$( get_de_app_version "$shell_type" "^tcsh" "2" ) + shell_version=$( get_program_version "$shell_type" "^tcsh" "2" ) ;; dash) - shell_version=$( get_de_app_version "$shell_type" "$shell_type" "3" ) + shell_version=$( get_program_version "$shell_type" "$shell_type" "3" ) ;; ksh) - shell_version=$( get_de_app_version "$shell_type" "version" "5" ) + shell_version=$( get_program_version "$shell_type" "version" "5" ) ;; tcsh) - shell_version=$( get_de_app_version "$shell_type" "^tcsh" "2" ) + shell_version=$( get_program_version "$shell_type" "^tcsh" "2" ) ;; zsh) - shell_version=$( get_de_app_version "$shell_type" "^zsh" "2" ) + shell_version=$( get_program_version "$shell_type" "^zsh" "2" ) ;; esac fi diff --git a/inxi.changelog b/inxi.changelog index 51c5eb7..0a83628 100755 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,3 +1,19 @@ +===================================================================================== +Version: 2.1.10 +Patch Version: 00 +Script Date: 2014-03-25 +----------------------------------- +Changes: +----------------------------------- +New version; added supybot/limnoria/gribble support. This only works when the supybot +'SHELL' command is used, 'CALL' gives the user irc client data, and supybot etc are +not detectable. + +Fine tuned some error message lengths so they fit into 80 columns or so. + +----------------------------------- +-- Harald Hope - Tue, 25 Mar 2014 13:55:13 -0700 + ===================================================================================== Version: 2.1.9 Patch Version: 00