From 1ab0749006f13b50b268fe05ca77334330027f1b Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Fri, 13 Mar 2009 22:18:03 +0000 Subject: [PATCH] branch test, no version change, adding quassel support --- inxi | 97 +++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 76 insertions(+), 21 deletions(-) diff --git a/inxi b/inxi index c7d5278..045563b 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.0.4-b1-t5 -#### Date: 1 March 2009 +#### version: 1.0.7-b1-t1 +#### Date: 13 March 2009 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -1037,7 +1037,7 @@ print_version_info() print_screen_output "This script is a fork of Infobash 3.02, which is:" print_screen_output "Copyright (C) 2005-2007 Michiel de Boer a.k.a. locsmif" print_screen_output "Subsequent changes and modifications (after Infobash 3.02) are:" - print_screen_output "Copyright (C) 2008 Scott Rogers, Harald Hope, aka trash80 & h2" + print_screen_output "Copyright (C) 2008-9 Scott Rogers, Harald Hope, aka trash80 & h2" print_screen_output "" print_screen_output "This program is free software; you can redistribute it and/or modify" print_screen_output "it under the terms of the GNU General Public License as published by" @@ -1086,7 +1086,9 @@ get_start_client() # as they appear. case $app_working_name in irssi-text|irssi) - IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { print $2 }' )" + IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { + print $2 + }' )" IRC_CLIENT="Irssi" ;; konversation) @@ -1121,8 +1123,7 @@ get_start_client() T2="${T[0]}" fi # Remove any dots except the first, and make sure there are no trailing zeroes, - T2=$( echo "$T2" | gawk ' - { + T2=$( echo "$T2" | gawk '{ sub(/\./, " ") gsub(/\./, "") sub(/ /, ".") @@ -1137,11 +1138,15 @@ get_start_client() IRC_CLIENT="Konversation" ;; xchat-gnome) - IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { print $2 }' )" + IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { + print $2 + }' )" IRC_CLIENT="X-Chat-Gnome" ;; xchat) - IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { print $2 }' )" + IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { + print $2 + }' )" IRC_CLIENT="X-Chat" ;; bitchx) @@ -1161,25 +1166,66 @@ get_start_client() IRC_CLIENT="BitchX" ;; ircii) - IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { print $3 }' )" + IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { + print $3 + }' )" IRC_CLIENT="ircII" ;; gaim) - IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { print $2 }' )" + IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { + print $2 + }' )" IRC_CLIENT="Gaim" ;; pidgin) - IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { print $2 }' )" + IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { + print $2 + }' )" IRC_CLIENT="Pidgin" ;; + quassel*) + # sample: quassel -v + # Qt: 4.5.0 + # KDE: 4.2.65 (KDE 4.2.65 (KDE 4.3 >= 20090226)) + # Quassel IRC: v0.4.0 [+60] (git-22effe5) + # note: early < 0.4.1 quassels do not have -v + IRC_CLIENT_VERSION=" $( $irc_client_path -v 2>/dev/null | gawk -F ': ' ' + BEGIN { + IGNORECASE=1 + clientVersion="" + } + /Quassel IRC/ { + clientVersion = $2 + } + END { + # this handles pre 0.4.1 cases with no -v + if ( clientVersion == "" ) { + clientVersion = "(pre v0.4.1)" + } + print clientVersion + }' )" + # now handle primary, client, and core. quasselcore doesn't actually + # handle scripts with exec, but it's here just to be complete + case $app_working_name in + quassel) + IRC_CLIENT="Quassel [M]" + ;; + quasselclient) + IRC_CLIENT="Quassel" + ;; + quasselcore) + IRC_CLIENT="Quassel (core)" + ;; + esac + ;; weechat-curses) - IRC_CLIENT_VERSION=" $( $irc_client_path -v) " + IRC_CLIENT_VERSION=" $( $irc_client_path -v ) " IRC_CLIENT="Weechat" ;; kvirc) IRC_CLIENT_VERSION=" $( $irc_client_path -v 2>&1 | gawk '{ for ( i=2; i<=NF; i++) { - if (i==NF) { + if ( i == NF ) { print $i } else { @@ -2375,16 +2421,22 @@ get_partition_data() BEGIN { IGNORECASE=1 } - # this is required because below we are subtracting from NF, so it has to be - # > 1, actually greater than 4, but that is so unlikely to occur because + # this has to be nulled for every iteration so it does not retain value from last iteration + devBase="" + # this is required because below we are subtracting from NF, so it has to be > 4 # the real issue is long file system names that force the wrap of df output: //fileserver/main + # but we still need to handle more dynamically long space containing file names, but later. ( NF < 5 ) && ( $0 !~ /[0-9]+\%/ ) { + # set the dev location here for cases of wrapped output + if ( NF == 1 ){ + devBase=gensub( /^(\/dev\/)(.+)$/, "\\2", 1, $1 ) + } getline } # this handles yet another fredforfaen special case where a mounted drive # has the search string in its name $NF ~ /^\/$|^\/boot$|^\/var$|^\/home$|^\/tmp$|^\/usr$/ { - print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",main" + print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",main," devBase } # skip all these, including the first, header line. Use the --exclude-type # to handle new filesystems types we do not want listed here @@ -2393,14 +2445,14 @@ get_partition_data() # the test show the wrong data in each of the fields, if no x%, then do not use # using 3 cases, first default, standard, 2nd, 3rd, handles one and two spaces in name if ( $(NF - 1) ~ /[0-9]+\%/ ) { - print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",secondary" + print $NF "," $(NF - 4) "," $(NF - 3) "," $(NF - 1) ",secondary," devBase } # these two cases construct the space containing name else if ( $(NF - 2) ~ /[0-9]+\%/ ) { - print $(NF - 1) " " $NF "," $(NF - 5) "," $(NF - 4) "," $(NF - 2) ",secondary" + print $(NF - 1) " " $NF "," $(NF - 5) "," $(NF - 4) "," $(NF - 2) ",secondary," devBase } else if ( $(NF - 3) ~ /[0-9]+\%/ ) { - print $(NF - 2) " " $(NF - 1) " " $NF "," $(NF - 6) "," $(NF - 5) "," $(NF - 3) ",secondary" + print $(NF - 2) " " $(NF - 1) " " $NF "," $(NF - 6) "," $(NF - 5) "," $(NF - 3) ",secondary," devBase } } ' ) @@ -2420,7 +2472,7 @@ get_partition_data() swapCounter = ++swapCounter }' ) ) IFS="$ORIGINAL_IFS" - echo A_PARTITION_DATA ${A_PARTITION_DATA[@]} + if [[ $B_SHOW_LABELS == 'true' || $B_SHOW_UUIDS == 'true' ]];then get_partition_data_advanced fi @@ -2475,7 +2527,7 @@ get_partition_data_advanced() partition = "" } - # handle Arch /dev/root for / id + # handle /dev/root for / id if ( partition == "root" ) { # if this works, great, otherwise, just set this to null values partTemp="'$( readlink /dev/root 2>/dev/null )'" @@ -2485,9 +2537,11 @@ get_partition_data_advanced() } else if ( partTemp ~ /by-uuid/ ) { uuid=gensub( /^(\/dev\/disk\/by-uuid\/)(.+)$/, "\\2", 1, partTemp ) + partition="" # set null to let real location get discovered } else if ( partTemp ~ /by-label/ ) { label=gensub( /^(\/dev\/disk\/by-label\/)(.+)$/, "\\2", 1, partTemp ) + partition="" # set null to let real location get discovered } } else { @@ -3300,6 +3354,7 @@ print_partition_data() dev_remote='remote' fi else + dev_remote='dev' part_dev='N/A' fi full_dev=" ${C1}$dev_remote:${C2} $part_dev"