diff --git a/inxi b/inxi index 9b05346..9b96421 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 0.4.20 +#### version: 0.4.21 #### Date: November 8 2008 ######################################################################## #### inxi is a fork of infobash, the original bash sys info script by locsmif @@ -13,6 +13,7 @@ #### Original infobash author and copyright holder: #### Copyright (C) 2005-2007 Michiel de Boer a.k.a. locsmif #### inxi version: Copyright (C) 2008 Warren Scott Rogers & Harald Hope +#### Further fixes (listed as known): Horst Tritremmel #### #### Current script home page: http://techpatterns.com/forums/about1131.html #### Script svn: http://code.google.com/p/inxi @@ -75,6 +76,8 @@ B_EXTRA_DATA='false' B_HANDLE_CORRUPT_DATA='false' # Running in a shell? Defaults to false, and is determined later. B_RUNNING_IN_SHELL='false' +# Show full hard disk output +B_SHOW_FULL_HDD='false' # Set this to 'false' to avoid printing the hostname B_SHOW_HOST='true' # Show sound card data @@ -455,7 +458,7 @@ get_parameters() return 1 fi - while getopts c:CdDfFhsTUv:Vx opt + while getopts c:CdDfFhHsTUv:Vx opt do case $opt in c) if [[ -n $( egrep '^[0-9][0-9]?$' <<< $OPTARG ) ]];then @@ -480,9 +483,12 @@ get_parameters() ;; F) VERBOSITY_LEVEL=$VERBOSITY_LEVELS B_CPU_FLAGS_FULL='true' + B_SHOW_FULL_HDD='true' B_SHOW_SOUND='true' B_EXTRA_DATA='true' ;; + H) B_SHOW_FULL_HDD='true' + ;; s) B_SHOW_SOUND='true' ;; T) B_TESTING_FLAG='true' @@ -525,6 +531,7 @@ show_options() print_screen_output "-d Default output verbosity level, same as: $SCRIPT_NAME -v 1" print_screen_output "-f Show all cpu flags used, not just the short list." print_screen_output "-F Show Full, all possible, output for $SCRIPT_NAME." + print_screen_output "-h Show full hard disk info, not only model, ie: /dev/sda - ST380817AS - 80.0GB." print_screen_output "-s Show sound card information." print_screen_output "-U Autoupdate script. Note: if you installed as root, you" print_screen_output " must be root to update, otherwise user is fine." @@ -590,7 +597,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='' + local b_non_native_app='false' pppid='' app_working_name='' if tty >/dev/null;then IRC_CLIENT='Shell' @@ -599,35 +606,29 @@ get_start_client() elif [[ -n $PPID && -f /proc/$PPID/exe ]];then 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 - # 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, where - # konversation reports itself as perl, which was missed because when konversation starts inxi - # from inside itself, as a script, the parent is konversation, not perl - ## note: this method: [[ ${irc_client_path_lower##*/} =~ dash|bash|sh|perl ]] fails in older bash, etch - case ${irc_client_path_lower##*/} in + app_working_name=$( basename $irc_client_path_lower ) + # handles the xchat/sh/bash/dash cases, and the konversation/perl cases, where clients + # report themselves as perl or unknown shell. IE: when konversation starts inxi + # from inside itself, as a script, the parent is konversation/xchat, not perl/bash etc + case $app_working_name in bash|dash|sh|perl) # 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 )" + app_working_name=$( basename $irc_client_path_lower ) b_non_native_app='true' fi ;; esac - # 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*) + # replacing loose detection with tight detection, bugs will be handled with app names + # 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="Irssi" ;; - *konversation*) + konversation) # this is necessary to avoid the dcop errors from starting inxi as a /cmd started script if [[ $b_non_native_app == 'true' ]];then KONVI=2 @@ -674,15 +675,15 @@ get_start_client() fi IRC_CLIENT="Konversation" ;; - *xchat-gnome) + xchat-gnome) IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { print $2 }' )" IRC_CLIENT="X-Chat-Gnome" ;; - *xchat*) + xchat) IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { print $2 }' )" IRC_CLIENT="X-Chat" ;; - *bitchx*) + bitchx) IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk ' /Version/ { a=tolower($2) @@ -698,23 +699,23 @@ get_start_client() }' )" IRC_CLIENT="BitchX" ;; - *ircii*) + ircii) IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { print $3 }' )" IRC_CLIENT="ircII" ;; - *gaim*) + gaim) IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { print $2 }' )" IRC_CLIENT="Gaim" ;; - *pidgin*) + pidgin) IRC_CLIENT_VERSION=" $( $irc_client_path -v | gawk 'NR == 1 { print $2 }' )" IRC_CLIENT="Pidgin" ;; - *weechat-curses*) + weechat-curses) IRC_CLIENT_VERSION=" $( $irc_client_path -v) " IRC_CLIENT="Weechat" ;; - *kvirc*) + kvirc) IRC_CLIENT_VERSION=" $( $irc_client_path -v 2>&1 | gawk '{ for ( i=2; i<=NF; i++) { if (i==NF) { @@ -727,7 +728,7 @@ get_start_client() }' )" IRC_CLIENT="KVIrc" ;; - *kopete*) + kopete) IRC_CLIENT_VERSION=" $( kopete -v | gawk ' /Kopete:/ { print $2 @@ -735,7 +736,7 @@ get_start_client() }' )" IRC_CLIENT="Kopete" ;; - *perl*|*ksirc*|*dsirc*) + perl|ksirc|dsirc) unset IRC_CLIENT_VERSION # KSirc is one of the possibilities now. KSirc is a wrapper around dsirc, a perl client get_cmdline $PPID @@ -765,7 +766,7 @@ get_start_client() IRC_CLIENT="Unknown Perl client" fi ;; - *bash*|*dash*|*sh*) + bash|dash|sh) unset IRC_CLIENT_VERSION IRC_CLIENT="Shell wrapper" ;; @@ -1726,7 +1727,7 @@ print_hard_disk_data() local hdd_data='' partition_data='' a_partition_working='' hdd_model='' a_hdd_working='' local dev_data='' size_data='' hdd_model_2='' hdd_data_2='' usb_data='' - if [[ $VERBOSITY_LEVEL -ge 3 ]];then + if [[ $VERBOSITY_LEVEL -ge 3 || $B_SHOW_FULL_HDD == 'true' ]];then ## note: the output part of this should be in the print hdd data function, not here get_hard_drive_data_advanced for (( i=0; i < ${#A_HDD_DATA[@]} - 1; i++ )) @@ -1735,17 +1736,17 @@ print_hard_disk_data() IFS="," a_hdd_working=( ${A_HDD_DATA[i]} ) IFS="$ORIGINAL_IFS" - if [[ $B_EXTRA_DATA == 'true' ]];then + if [[ $B_SHOW_FULL_HDD == 'true' ]];then if [[ -n ${a_hdd_working[3]} ]];then - usb_data="(${a_hdd_working[3]}) " + usb_data="(${a_hdd_working[3]})" else usb_data='' fi - dev_data="/dev/${a_hdd_working[0]} - " - size_data=" - ${a_hdd_working[1]}" + dev_data="/dev/${a_hdd_working[0]}-" + size_data="-${a_hdd_working[1]}" fi # wrap to avoid long lines - if [[ $i -gt 1 && $B_EXTRA_DATA == 'true' ]] || [[ $i -gt 3 ]];then + if [[ $i -gt 1 && $B_SHOW_FULL_HDD == 'true' ]] || [[ $i -gt 3 ]];then hdd_model_2="${hdd_model_2}${hdd_model_2+${C1}($(($i+1)))${C2}}$usb_data$dev_data${a_hdd_working[2]}$size_data " else hdd_model="${hdd_model}${hdd_model+ ${C1}($(($i+1)))${C2}}$usb_data$dev_data${a_hdd_working[2]}$size_data"