From d11d6cb6cb78323e36d8edbb3a18c685c30ba541 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Wed, 12 Mar 2014 23:41:33 +0000 Subject: [PATCH] branch one, trying rough draft of init systme output --- inxi | 1063 ++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 671 insertions(+), 392 deletions(-) diff --git a/inxi b/inxi index a219e34..75f4609 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/usr/bin/env bash ######################################################################## #### Script Name: inxi -#### Version: 1.9.12 -#### Date: August 12 2013 +#### Version: 2.0.0 +#### Date: 2014-03-12 #### Patch Number: 01-b1 ######################################################################## #### SPECIAL THANKS @@ -20,7 +20,7 @@ #### Gaim/Pidgin, Weechat, KVIrc and Kopete. #### Original infobash author and copyright holder: #### Copyright (C) 2005-2007 Michiel de Boer a.k.a. locsmif -#### inxi version: Copyright (C) 2008-2013 Scott Rogers & Harald Hope +#### inxi version: Copyright (C) 2008-2014 Scott Rogers & Harald Hope #### Further fixes (listed as known): Horst Tritremmel #### Steven Barrett (aka: damentz) - usb audio patch; swap percent used patch #### Jarett.Stevens - dmidecde -M patch for older systems with the /sys @@ -143,6 +143,11 @@ #### * In gawk search patterns, . is a wildcard EXCEPT in [0-9.] type containers, then it's a literal #### So outside of bracketed items, it must be escaped, \. but inside, no need. Outside of gawk it should #### be escaped in search patterns if you are using it as a literal. +#### +#### PACKAGE MANAGER DATA (note, while inxi tries to avoid using package managers to get data, sometimes +#### it's the only way to get some data): +#### * dpkg options: http://www.cyberciti.biz/howto/question/linux/dpkg-cheat-sheet.php +#### * pacman options: https://wiki.archlinux.org/index.php/Pacman_Rosetta #### #### As with all 'rules' there are acceptions, these are noted where used. ################################################################################### @@ -224,10 +229,11 @@ A_CPU_DATA='' A_CPU_TYPE_PCNT_CCNT='' A_DEBUG_BUFFER='' A_GCC_VERSIONS='' -A_GFX_CARD_DATA='' A_GLX_DATA='' +A_GRAPHICS_CARD_DATA='' A_GRAPHIC_DRIVERS='' A_HDD_DATA='' +A_INIT_DATA='' A_INTERFACES_DATA='' A_MACHINE_DATA='' A_NETWORK_DATA='' @@ -239,7 +245,7 @@ A_RAID_DATA='' A_SENSORS_DATA='' A_UNMOUNTED_PARTITION_DATA='' A_WEATHER_DATA='' -A_X_DATA='' +A_DISPLAY_SERVER_DATA='' ### Boolean true/false globals ## usage: 'B_' ## Distro maintainer flags ## @@ -282,6 +288,7 @@ B_PORTABLE='false' B_RAID_SET='false' B_ROOT='false' B_RUN_COLOR_SELECTOR='false' +B_RUNNING_IN_DISPLAY='false' # in x type display server # Running in a shell? Defaults to false, and is determined later. B_RUNNING_IN_SHELL='false' if tty >/dev/null;then @@ -297,6 +304,7 @@ B_SHOW_BASIC_CPU='false' B_SHOW_BASIC_DISK='false' B_SHOW_BASIC_OPTICAL='false' B_SHOW_CPU='false' +B_SHOW_DISPLAY_DATA='false' B_SHOW_DISK_TOTAL='false' B_SHOW_DISK='false' # Show full hard disk output @@ -319,7 +327,6 @@ B_SHOW_RAID='false' # because many systems have no mdstat file, -b/-F should not show error if no raid file found B_SHOW_RAID_R='false' B_SHOW_REPOS='false' -B_RUNNING_IN_X='false' B_SHOW_SENSORS='false' # triggers only short inxi output B_SHOW_SHORT_OUTPUT='false' @@ -327,7 +334,6 @@ B_SHOW_SYSTEM='false' B_SHOW_UNMOUNTED_PARTITIONS='false' B_SHOW_UUIDS='false' B_SHOW_WEATHER='false' -B_SHOW_X_DATA='false' B_SYSCTL='false' # triggers various debugging and new option testing B_TESTING_1='false' @@ -544,12 +550,12 @@ CN='' ### Distro Data # In cases of derived distros where the version file of the base distro can also be found under /etc, # the derived distro's version file should go first. (Such as with Sabayon / Gentoo) -DISTROS_DERIVED="antix-version aptosid-version kanotix-version knoppix-version mandrake-release pardus-release sabayon-release siduction-version sidux-version turbolinux-release zenwalk-version" +DISTROS_DERIVED="antix-version aptosid-version kanotix-version knoppix-version mandrake-release pardus-release sabayon-release siduction-version sidux-version solusos-release turbolinux-release zenwalk-version" # debian_version excluded from DISTROS_PRIMARY so Debian can fall through to /etc/issue detection. Same goes for Ubuntu. DISTROS_EXCLUDE_LIST="debian_version ubuntu_version" DISTROS_PRIMARY="arch-release gentoo-release redhat-release slackware-version SuSE-release" DISTROS_LSB_GOOD="mandrake-release mandriva-release mandrakelinux-release" -# this is being used both by core distros and derived distros now, eg, solusos uses it for solusos id, while +# this is being used both by core distros and derived distros now, eg, solusos 1 uses it for solusos id, while # debian, solusos base, uses it as well, so we have to know which it is. DISTROS_OS_RELEASE_GOOD="arch-release SuSE-release" ## Distros with known problems @@ -567,7 +573,7 @@ SENSORS_GPU_SEARCH='intel|radeon|nouveau' ### USB networking search string data, because some brands can have other products than ### wifi/nic cards, they need further identifiers, with wildcards. ### putting the most common and likely first, then the less common, then some specifics -USB_NETWORK_SEARCH="Wi-Fi.*Adapter|Wireless.*Adapter|WLAN.*Adapter|Network.*Adapter|802\.11|Atheros|Atmel|D-Link.*Adapter|D-Link.*Wireless|Linksys|Netgea|Ralink|Realtek.*Network|Realtek.*Wireless|Realtek.*WLAN|Belkin.*Wireless|Belkin.*WLAN|Belkin.*Network" +USB_NETWORK_SEARCH="Wi-Fi.*Adapter|Wireless.*Adapter|Ethernet.*Adapter|WLAN.*Adapter|Network.*Adapter|802\.11|Atheros|Atmel|D-Link.*Adapter|D-Link.*Wireless|Linksys|Netgea|Ralink|Realtek.*Network|Realtek.*Wireless|Realtek.*WLAN|Belkin.*Wireless|Belkin.*WLAN|Belkin.*Network" USB_NETWORK_SEARCH="$USB_NETWORK_SEARCH|Actiontec.*Wireless|Actiontec.*Network|AirLink.*Wireless|Asus.*Network|Asus.*Wireless|Buffalo.*Wireless|Davicom|DWA-.*RangeBooster|DWA-.*Wireless|ENUWI-.*Wireless|LG.*Wi-Fi|Rosewill.*Wireless|RNX-.*Wireless|Samsung.*LinkStick|Samsung.*Wireless|Sony.*Wireless|TEW-.*Wireless|TP-Link.*Wireless|WG[0-9][0-9][0-9].*Wireless|WNA[0-9][0-9][0-9]|WNDA[0-9][0-9][0-9]|Zonet.*ZEW.*Wireless|54 Mbps" # then a few known hard to ID ones added # belkin=050d; d-link=07d1; netgear=0846; ralink=148f; realtek=0bda; @@ -682,7 +688,7 @@ main() color_scheme=$VIRT_TERM_COLOR_SCHEME fi else - if [[ -n $IRC_X_TERM_COLOR_SCHEME && $B_CONSOLE_IRC == 'true' && -n $B_RUNNING_IN_X ]];then + if [[ -n $IRC_X_TERM_COLOR_SCHEME && $B_CONSOLE_IRC == 'true' && -n $B_RUNNING_IN_DISPLAY ]];then color_scheme=$IRC_X_TERM_COLOR_SCHEME elif [[ -n $IRC_CONS_COLOR_SCHEME && -z $DISPLAY ]];then color_scheme=$IRC_CONS_COLOR_SCHEME @@ -803,8 +809,8 @@ initialize_data() fi if [[ -n $DISPLAY ]];then - B_SHOW_X_DATA='true' - B_RUNNING_IN_X='true' + B_SHOW_DISPLAY_DATA='true' + B_RUNNING_IN_DISPLAY='true' fi if [[ -e $FILE_MDSTAT ]];then @@ -959,16 +965,16 @@ check_required_apps() depends="$depends sysctl lspci" fi # no need to add xprop because it will just give N/A if not there, but if we expand use of xprop, - # should add that here as a test, then use the B_SHOW_X_DATA flag to trigger the tests in de function + # should add that here as a test, then use the B_SHOW_DISPLAY_DATA flag to trigger the tests in de function local x_apps="xrandr xdpyinfo glxinfo" - if [[ $B_RUNNING_IN_X == 'true' ]];then + if [[ $B_RUNNING_IN_DISPLAY == 'true' ]];then for app_name in $x_apps do app_path=$( type -p $app_name ) if [[ -z $app_path ]];then script_debugger "Resuming in non X mode: $app_name not found. For package install advice run: $SCRIPT_NAME --recommends" - B_SHOW_X_DATA='false' + B_SHOW_DISPLAY_DATA='false' break fi done @@ -1518,7 +1524,13 @@ debug_data_collector() lspci -v &> $debug_data_dir/lspci-v.txt lsusb &> $debug_data_dir/lsusb.txt ps aux &> $debug_data_dir/ps-aux.txt + runlevel &> $debug_data_dir/runlevel.txt + systemctl list-units &> $debug_data_dir/systemctl-list-units.txt + systemctl list-units --type=target &> $debug_data_dir/systemctl-list-units-target.txt + initctl list &> $debug_data_dir/initctl-list.txt sensors &> $debug_data_dir/sensors.txt + nvidia-smi -q &> $debug_data_dir/nvidia-smi-q.txt + nvidia-smi -q -x &> $debug_data_dir/nvidia-smi-xq.txt ls /usr/bin/gcc* &> $debug_data_dir/gcc-sys-versions.txt gcc --version &> $debug_data_dir/gcc-version.txt @@ -1585,7 +1597,7 @@ debug_data_collector() fi fi if [[ $1 == 'xorg' || $1 == 'all' ]];then - if [[ $B_RUNNING_IN_X != 'true' ]];then + if [[ $B_RUNNING_IN_DISPLAY != 'true' ]];then echo 'Warning: only some of the data collection can occur if you are not in X' touch $debug_data_dir/warning-user-not-in-x fi @@ -1617,6 +1629,12 @@ debug_data_collector() xrandr &> $debug_data_dir/xrandr.txt X -version &> $debug_data_dir/x-version.txt Xorg -version &> $debug_data_dir/xorg-version.txt + echo $GNOME_DESKTOP_SESSION_ID &> $debug_data_dir/gnome-desktop-session-id.txt + # kde 3 id + echo $KDE_FULL_SESSION &> $debug_data_dir/kde3-ful-session.txt + echo $KDE_SESSION_VERSION &> $debug_data_dir/kde456-session-version.txt + echo "$(kded$KDE_SESSION_VERSION --version )" &> $debug_data_dir/kde-version-data.txt + echo $XDG_CURRENT_DESKTOP &> $debug_data_dir/xdg-current-desktop.txt fi if [[ $1 == 'disk' || $1 == 'all' ]];then echo 'Collecting dev, label, disk, uuid data, df...' @@ -2456,7 +2474,7 @@ show_options() print_screen_output "-f All cpu flags, triggers -C. Not shown with -F to avoid spamming. ARM cpus show 'features'." print_screen_output "-F Full output for $SCRIPT_NAME. Includes all Upper Case line letters, plus -s and -n." print_screen_output " Does not show extra verbose options like -x -d -f -u -l -o -p -t -r" - print_screen_output "-G Graphic card information (card, x type, resolution, glx renderer, version)." + print_screen_output "-G Graphic card information (card, display server type/version, resolution, glx renderer, version)." print_screen_output "-i Wan IP address, and shows local interfaces (requires ifconfig network tool). Same as -Nni" print_screen_output " Not shown with -F for user security reasons, you shouldn't paste your local/wan IP." print_screen_output "-I Information: processes, uptime, memory, irc client (or shell type), $SCRIPT_NAME version." @@ -2471,7 +2489,7 @@ show_options() print_screen_output "-p Full ${partition_string} information (-P plus all other detected ${partition_string}s)." print_screen_output "-P Basic ${partition_string} information (shows what -v 4 would show, but without extra data)." print_screen_output " Shows, if detected: / /boot /home /tmp /usr /var. Use -p to see all mounted ${partition_string}s." - print_screen_output "-r Distro repository data. Currently supported repo types: APT; PACMAN; PISI; YUM; Ports." + print_screen_output "-r Distro repository data. Supported repo types: APT; PACMAN; PISI; YUM; URPMQ; Ports." print_screen_output "-R RAID data. Shows RAID devices, states, levels, and components, and extra data with -x/-xx" print_screen_output " md-raid: If device is resyncing, shows resync progress line as well." print_screen_output "-s Sensors output (if sensors installed/configured): mobo/cpu/gpu temp; detected fan speeds." @@ -2511,7 +2529,8 @@ show_options() print_screen_output " -G - (for single gpu, nvidia driver) screen number gpu is running on." print_screen_output " -i - IPv6 as well for LAN interface (IF) devices." print_screen_output " -I - System GCC, default. With -xx, also show other installed GCC versions." - print_screen_output " - If running in console, not in IRC client, shows shell version number if detected." + print_screen_output " If running in console, not in IRC client, shows shell version number," + print_screen_output " if detected. Adds current runlevel." print_screen_output " -N -A - Version/port(s)/driver version (if available) for Network/Audio;" print_screen_output " -N -A -G - Network, audio, graphics, shows PCI Bus ID/Usb ID number of card;" print_screen_output " -R - md-raid: Shows component raid id. Adds second RAID Info line: raid level; report on drives (like 5/5);" @@ -2526,7 +2545,7 @@ show_options() print_screen_output " -A - Chip vendor:product ID for each audio device." print_screen_output " -D - Disk serial number." print_screen_output " -G - Chip vendor:product ID for each video card." - print_screen_output " -I - Other detected installed gcc versions (if present)." + print_screen_output " -I - Other detected installed gcc versions (if present). System default runlevel." print_screen_output " Adds parent program (or tty) for shell info if not in IRC (like Konsole or Gterm)." print_screen_output " -M - Chassis information, bios rom size (dmidecode only), if data for either is available." print_screen_output " -N - Chip vendor:product ID for each nic." @@ -3002,7 +3021,7 @@ set_perl_python_konvi() { if [[ -z $IRC_CLIENT_VERSION ]];then # 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" | grep -v 'grep' ) && $B_RUNNING_IN_X == 'true' ]];then + if [[ -n $( grep -i 'konversation' <<< "$Ps_aux_Data" | grep -v 'grep' ) && $B_RUNNING_IN_DISPLAY == 'true' ]];then IRC_CLIENT='Konversation' IRC_CLIENT_VERSION=" $( konversation --version 2>/dev/null | gawk '/^Konversation/ {print $2}' )" B_CONSOLE_IRC='false' @@ -3762,78 +3781,24 @@ get_cpu_ht_multicore_smp_data() # Detect desktop environment in use, initial rough logic from: compiz-check # http://forlong.blogage.de/entries/pages/Compiz-Check +# NOTE $XDG_CURRENT_DESKTOP envvar is not reliable, but it shows certain desktops better. +# most desktops are not using it as of 2014-01-13 (KDE, UNITY, LXDE. Not Gnome) get_desktop_environment() { eval $LOGFS # set the default, this function only runs in X, if null, don't print data out - local desktop_environment='' xprop_root='' + local desktop_environment='' xprop_root='' local version='' version_data='' toolkit='' - - if [[ -n $( type -p xprop ) ]];then - xprop_root="$( xprop -root 2>/dev/null )" - fi - # note that cinnamon split from gnome, and and can now be id'ed via xprop, - # but it will still trigger the next gnome true case, so this needs to go before gnome test - # 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' ) - # not certain cinn will always have version, so keep output right if not - if [[ -n $version ]];then - version="$version " - fi - if [[ $B_EXTRA_DATA == 'true' ]];then - toolkit=$( get_de_gtk_data ) - if [[ -n $toolkit ]];then - version="${version}(Gtk ${toolkit})" - fi - 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' ) - # not certain cinn/mate will always have version, so keep output right if not - if [[ -n $version ]];then - version="$version " - fi - if [[ $B_EXTRA_DATA == 'true' ]];then - toolkit=$( get_de_gtk_data ) - if [[ -n $toolkit ]];then - version="${version}(Gtk ${toolkit})" - fi - fi - desktop_environment="MATE" - # note, GNOME_DESKTOP_SESSION_ID is deprecated so we'll see how that works out - # https://bugzilla.gnome.org/show_bug.cgi?id=542880 - elif [[ -n $GNOME_DESKTOP_SESSION_ID ]]; then - version=$( get_de_app_version 'gnome-about' 'gnome' '3' ) - if [[ $B_EXTRA_DATA == 'true' ]];then - toolkit=$( get_de_gtk_data ) - if [[ -n $toolkit ]];then - version="$version (Gtk $toolkit)" - fi - fi - desktop_environment="Gnome" - # assume 5 will id the same, why not, no need to update in future - elif [[ $KDE_SESSION_VERSION == '5' ]]; then - version_data=$( kded5 --version 2>/dev/null ) + # works on 4, assume 5 will id the same, why not, no need to update in future + # KDE_SESSION_VERSION is the integer version of the desktop + if [[ $XDG_CURRENT_DESKTOP == 'KDE' || -n $KDE_SESSION_VERSION ]]; then + # note the command is actually like, kded4 --version, so we construct it + version_data=$( kded$KDE_SESSION_VERSION --version 2>/dev/null ) version=$( grep -si '^KDE Development Platform:' <<< "$version_data" | gawk '{print $4}' ) if [[ -z $version ]];then - version='5' - fi - if [[ $B_EXTRA_DATA == 'true' ]];then - toolkit=$( grep -si '^Qt:' <<< "$version_data" | gawk '{print $2}' ) - if [[ -n $toolkit ]];then - version="$version (Qt $toolkit)" - fi - fi - desktop_environment="KDE" - elif [[ $KDE_SESSION_VERSION == '4' ]]; then - version_data=$( kded4 --version 2>/dev/null ) - version=$( grep -si '^KDE Development Platform:' <<< "$version_data" | gawk '{print $4}' ) - if [[ -z $version ]];then - version='4' + version=$KDE_SESSION_VERSION fi if [[ $B_EXTRA_DATA == 'true' ]];then toolkit=$( grep -si '^Qt:' <<< "$version_data" | gawk '{print $2}' ) @@ -3858,128 +3823,205 @@ get_desktop_environment() fi fi desktop_environment="KDE" - # now that the primary ones have been handled, next is to find the ones with unique - # xprop detections possible - else - if [[ -n $xprop_root ]];then - # String: "This is xfdesktop version 4.2.12" - if [[ -n $( grep -Eis '\"xfce4\"' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'xfdesktop' 'xfdesktop[[:space:]]version' '5' ) - if [[ -z $version ]];then - version='4' - fi - if [[ $B_EXTRA_DATA == 'true' ]];then - toolkit=$( get_de_app_version 'xfdesktop' 'Built[[:space:]]with[[:space:]]GTK' '4' ) - if [[ -n $toolkit ]];then - version="$version (Gtk $toolkit)" - fi - fi - 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' ) - if [[ -z $version ]];then - version='5' - fi - if [[ $B_EXTRA_DATA == 'true' ]];then - toolkit=$( get_de_app_version 'xfdesktop' 'Built[[:space:]]with[[:space:]]GTK' '4' ) - if [[ -n $toolkit ]];then - version="$version (Gtk $toolkit)" - fi - fi - desktop_environment="Xfce" - elif [[ -n $( grep -is 'BLACKBOX_PID' <<< "$xprop_root" ) ]];then - if [[ -n $( grep -is 'fluxbox' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then - version=$( get_de_app_version 'fluxbox' '^fluxbox' '2' ) - desktop_environment='Fluxbox' - else - desktop_environment='Blackbox' - fi - elif [[ -n $( grep -is 'OPENBOX_PID' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'openbox' '^openbox' '2' ) - if [[ -n $( grep -is 'lxde' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then - if [[ -n $version ]];then - version="(Openbox $version)" - fi - desktop_environment='LXDE' - elif [[ -n $( grep -is 'razor-desktop' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then - if [[ -n $version ]];then - version="(Openbox $version)" - fi - desktop_environment='Razor-QT' - else - desktop_environment='Openbox' - fi - elif [[ -n $( grep -is 'ICEWM' <<< "$xprop_root" ) ]];then - version=$( get_de_app_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 - # ENLIGHTENMENT_VERSION(STRING) = "Enlightenment 0.16.999.49898" - 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' ) - desktop_environment='i3' - elif [[ -n $( grep -is 'WINDOWMAKER' <<< "$xprop_root" ) ]];then - version=$( get_de_app_version 'wmaker' '^Window[[:space:]]*Maker' 'NF' ) - if [[ -n $version ]];then - version="$version " - fi - desktop_environment="WindowMaker" - 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' ) - # 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' ) - if [[ -n $version ]];then - version="$version " - fi - desktop_environment="herbstluftwm" + elif [[ $XDG_CURRENT_DESKTOP == 'Unity' ]];then + version=$( get_de_app_version 'unity' '^unity' '2' ) + # not certain cinn will always have version, so keep output right if not + if [[ -n $version ]];then + version="$version " + fi + if [[ $B_EXTRA_DATA == 'true' ]];then + toolkit=$( get_de_gtk_data ) + if [[ -n $toolkit ]];then + version="${version}(Gtk ${toolkit})" fi fi - # a few manual hacks for things that don't id with xprop, these are just good guesses - # note that gawk is going to exit after first occurance of search string, so no need for extra + desktop_environment="Unity" + fi + # did we find it? If not, start the xprop tests + if [[ -z $desktop_environment ]];then + if [[ -n $( type -p xprop ) ]];then + xprop_root="$( xprop -root 2>/dev/null )" + fi + # note that cinnamon split from gnome, and and can now be id'ed via xprop, + # but it will still trigger the next gnome true case, so this needs to go before gnome test + # 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' ) + # not certain cinn will always have version, so keep output right if not + if [[ -n $version ]];then + version="$version " + fi + if [[ $B_EXTRA_DATA == 'true' ]];then + toolkit=$( get_de_gtk_data ) + if [[ -n $toolkit ]];then + version="${version}(Gtk ${toolkit})" + fi + 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' ) + # not certain cinn/mate will always have version, so keep output right if not + if [[ -n $version ]];then + version="$version " + fi + if [[ $B_EXTRA_DATA == 'true' ]];then + toolkit=$( get_de_gtk_data ) + if [[ -n $toolkit ]];then + version="${version}(Gtk ${toolkit})" + fi + fi + desktop_environment="MATE" + # note, GNOME_DESKTOP_SESSION_ID is deprecated so we'll see how that works out + # https://bugzilla.gnome.org/show_bug.cgi?id=542880 + elif [[ -n $GNOME_DESKTOP_SESSION_ID ]]; then + if [[ -n $( type -p gnome-shell ) ]];then + version=$( get_de_app_version 'gnome-shell' 'gnome' '3' ) + elif [[ -n $( type -p gnome-about ) ]];then + version=$( get_de_app_version 'gnome-about' 'gnome' '3' ) + fi + if [[ $B_EXTRA_DATA == 'true' ]];then + toolkit=$( get_de_gtk_data ) + if [[ -n $toolkit ]];then + version="$version (Gtk $toolkit)" + fi + fi + desktop_environment="Gnome" + fi if [[ -z $desktop_environment ]];then - if [[ -n $( grep -is 'fvwm-crystal' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then - version=$( get_de_app_version 'fvwm' '^fvwm' '2' ) - desktop_environment='FVWM-Crystal' - elif [[ -n $( grep -is 'fvwm' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then - version=$( get_de_app_version 'fvwm' '^fvwm' '2' ) - desktop_environment='FVWM' - elif [[ -n $( grep -is 'pekwm' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then - version=$( get_de_app_version 'pekwm' '^pekwm' '3' ) - desktop_environment='pekwm' - elif [[ -n $( grep -is 'awesome' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then - version=$( get_de_app_version 'awesome' '^awesome' '2' ) - desktop_environment='Awesome' - elif [[ -n $( grep -is 'scrotwm' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then - version=$( get_de_app_version 'scrotwm' '^welcome.*scrotwm' '4' ) - desktop_environment='Scrotwm' # no --version for this one - elif [[ -n $( grep -is 'spectrwm' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then - version=$( get_de_app_version 'spectrwm' '^spectrwm.*welcome.*spectrwm' '5' ) - desktop_environment='Spectrwm' # no --version for this one - elif [[ -n $( grep -Eis '([[:space:]]|/)twm' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then - desktop_environment='Twm' # no --version for this one - elif [[ -n $( grep -Eis '([[:space:]]|/)dwm' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then - version=$( get_de_app_version 'dwm' '^dwm' '1' ) - desktop_environment='dwm' - elif [[ -n $( grep -is 'wmii2' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then - version=$( get_de_app_version 'wmii2' '^wmii2' '1' ) - desktop_environment='wmii2' - # note: in debian at least, wmii is actuall wmii3 - elif [[ -n $( grep -is 'wmii' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then - version=$( get_de_app_version 'wmii' '^wmii' '1' ) - desktop_environment='wmii' - elif [[ -n $( grep -Eis '([[:space:]]|/)jwm' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then - version=$( get_de_app_version 'jwm' '^jwm' '2' ) - desktop_environment='JWM' + # now that the primary ones have been handled, next is to find the ones with unique + # xprop detections possible + if [[ -n $xprop_root ]];then + # 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' ) + # arch linux reports null, so use alternate if null + if [[ -z $version ]];then + version=$( get_de_app_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' ) + if [[ -n $toolkit ]];then + version="$version (Gtk $toolkit)" + fi + fi + 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' ) + # arch linux reports null, so use alternate if null + if [[ -z $version ]];then + version=$( get_de_app_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' ) + if [[ -n $toolkit ]];then + version="$version (Gtk $toolkit)" + fi + fi + desktop_environment="Xfce" + elif [[ -n $( grep -is 'BLACKBOX_PID' <<< "$xprop_root" ) ]];then + if [[ -n $( grep -is 'fluxbox' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then + version=$( get_de_app_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' ) + if [[ $XDG_CURRENT_DESKTOP == 'LXDE' || \ + -n $( grep -is 'lxde' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then + if [[ -n $version ]];then + version="(Openbox $version)" + fi + desktop_environment='LXDE' + elif [[ -n $( grep -is 'razor-desktop' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then + if [[ -n $version ]];then + version="(Openbox $version)" + fi + desktop_environment='Razor-QT' + else + desktop_environment='Openbox' + fi + elif [[ -n $( grep -is 'ICEWM' <<< "$xprop_root" ) ]];then + version=$( get_de_app_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 + # ENLIGHTENMENT_VERSION(STRING) = "Enlightenment 0.16.999.49898" + 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' ) + desktop_environment='i3' + elif [[ -n $( grep -is 'WINDOWMAKER' <<< "$xprop_root" ) ]];then + version=$( get_de_app_version 'wmaker' '^Window[[:space:]]*Maker' 'NF' ) + if [[ -n $version ]];then + version="$version " + fi + desktop_environment="WindowMaker" + 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' ) + # 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' ) + if [[ -n $version ]];then + version="$version " + fi + desktop_environment="herbstluftwm" + fi + fi + # a few manual hacks for things that don't id with xprop, these are just good guesses + # 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" | grep -v 'grep' ) ]];then + version=$( get_de_app_version 'fvwm' '^fvwm' '2' ) + desktop_environment='FVWM-Crystal' + elif [[ -n $( grep -is 'fvwm' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then + version=$( get_de_app_version 'fvwm' '^fvwm' '2' ) + desktop_environment='FVWM' + elif [[ -n $( grep -is 'pekwm' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then + version=$( get_de_app_version 'pekwm' '^pekwm' '3' ) + desktop_environment='pekwm' + elif [[ -n $( grep -is 'awesome' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then + version=$( get_de_app_version 'awesome' '^awesome' '2' ) + desktop_environment='Awesome' + elif [[ -n $( grep -is 'scrotwm' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then + version=$( get_de_app_version 'scrotwm' '^welcome.*scrotwm' '4' ) + desktop_environment='Scrotwm' # no --version for this one + elif [[ -n $( grep -is 'spectrwm' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then + version=$( get_de_app_version 'spectrwm' '^spectrwm.*welcome.*spectrwm' '5' ) + desktop_environment='Spectrwm' # no --version for this one + elif [[ -n $( grep -Eis '([[:space:]]|/)twm' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then + desktop_environment='Twm' # no --version for this one + elif [[ -n $( grep -Eis '([[:space:]]|/)dwm' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then + version=$( get_de_app_version 'dwm' '^dwm' '1' ) + desktop_environment='dwm' + elif [[ -n $( grep -is 'wmii2' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then + version=$( get_de_app_version 'wmii2' '^wmii2' '1' ) + desktop_environment='wmii2' + # note: in debian at least, wmii is actuall wmii3 + elif [[ -n $( grep -is 'wmii' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then + version=$( get_de_app_version 'wmii' '^wmii' '1' ) + desktop_environment='wmii' + elif [[ -n $( grep -Eis '([[:space:]]|/)jwm' <<< "$Ps_aux_Data" | grep -v 'grep' ) ]];then + version=$( get_de_app_version 'jwm' '^jwm' '2' ) + desktop_environment='JWM' + fi fi fi fi @@ -4001,6 +4043,9 @@ get_de_app_version() dwm|jwm|mate-about|wmii|wmii2) get_version='-v' ;; + epoch) + get_version='version' + ;; esac case $1 in @@ -4029,8 +4074,8 @@ get_de_app_version() } /'$2'/ { # sample: dwm-5.8.2, ©.. etc, why no space? who knows. Also get rid of v in number string - # xfce, and other, output has , in it, so dump all commas - gsub(/(,|dwm-|wmii2-|wmii-|v|V)/, "",$'$3') + # xfce, and other, output has , in it, so dump all commas and parentheses + gsub(/(,|dwm-|wmii2-|wmii-|v|V|\(|\))/, "",$'$3') print $'$3' exit # quit after first match prints }' <<< "$version_data" ) @@ -4069,13 +4114,38 @@ get_de_gtk_data() local toolkit='' - # this is a hack, and has to be changed with every toolkit version change - toolkit=$( pkg-config --modversion gtk+-4.0 2>/dev/null ) - if [[ -z $toolkit ]];then - toolkit=$( pkg-config --modversion gtk+-3.0 2>/dev/null ) + # this is a hack, and has to be changed with every toolkit version change, and only dev systems + # have this installed, but it's a cross distro command so let's test it first + if [[ -n $( type -p pkg-config ) ]];then + toolkit=$( pkg-config --modversion gtk+-4.0 2>/dev/null ) + # note: opensuse gets null output here, we need the command to get version and output sample + if [[ -z $toolkit ]];then + toolkit=$( pkg-config --modversion gtk+-3.0 2>/dev/null ) + fi + if [[ -z $toolkit ]];then + toolkit=$( pkg-config --modversion gtk+-2.0 2>/dev/null ) + fi fi + # now let's go to more specific version tests, this will never cover everything and that's fine. if [[ -z $toolkit ]];then - toolkit=$( pkg-config --modversion gtk+-2.0 2>/dev/null ) + # we'll try some known package managers next. dpkg will handle a lot of distros + # this is the most likely order as of: 2014-01-13. Not going to try to support all package managers + # too much work, just the very biggest ones. + if [[ -n $( type -p dpkg ) ]];then + toolkit=$( dpkg -s libgtk-3-0 2>/dev/null | gawk -F ':' '/^Version/ {print $2}' ) + if [[ -z $toolkit ]];then + toolkit=$( dpkg -s libgtk2.0-0 2>/dev/null | gawk -F ':' '/^Version/ {print $2}' ) + fi + # just guessing on gkt 4 package name + if [[ -z $toolkit ]];then + toolkit=$( dpkg -s libgtk-4-0 2>/dev/null | gawk -F ':' '/^Version/ {print $2}' ) + fi + elif [[ -n $( type -p pacman ) ]];then + toolkit=$( pacman -Qi gtk3 2>/dev/null | gawk -F ':' '/^Version/ {print $2}' ) + if [[ -z $toolkit ]];then + toolkit=$( pacman -Qi gtk2 2>/dev/null | gawk -F ':' '/^Version/ {print $2}' ) + fi + fi fi echo $toolkit @@ -4670,7 +4740,7 @@ get_graphics_card_data() local i='' temp_array='' IFS=$'\n' - A_GFX_CARD_DATA=( $( gawk -F': ' ' + A_GRAPHICS_CARD_DATA=( $( gawk -F': ' ' BEGIN { IGNORECASE=1 busId="" @@ -4684,15 +4754,15 @@ get_graphics_card_data() print $NF "," busId }' <<< "$Lspci_v_Data" ) ) IFS="$ORIGINAL_IFS" -# for (( i=0; i < ${#A_GFX_CARD_DATA[@]}; i++ )) +# for (( i=0; i < ${#A_GRAPHICS_CARD_DATA[@]}; i++ )) # do -# A_GFX_CARD_DATA[i]=$( sanitize_characters BAN_LIST_NORMAL "${A_GFX_CARD_DATA[i]}" ) +# A_GRAPHICS_CARD_DATA[i]=$( sanitize_characters BAN_LIST_NORMAL "${A_GRAPHICS_CARD_DATA[i]}" ) # done # GFXMEM is UNUSED at the moment, because it shows AGP aperture size, which is not necessarily equal to GFX memory.. # GFXMEM="size=[$(echo "$Lspci_v_Data" | gawk '/VGA/{while (!/^$/) {getline;if (/size=[0-9][0-9]*M/) {size2=gensub(/.*\[size=([0-9]+)M\].*/,"\\1","g",$0);if (size version : ...etc # Later on, the normal textual version string returned, e.g. like: X.Org version: 6.8.2 - # A failover mechanism is in place. (if $x_version is empty, the release number is parsed instead) + # A failover mechanism is in place. (if $version is empty, the release number is parsed instead) # xdpy_info="$( xdpyinfo )" IFS="," - a_x_working=( $( xdpyinfo | gawk -F': +' ' + a_display_vendor_working=( $( xdpyinfo | gawk -F': +' ' BEGIN { IGNORECASE=1 vendorString="" @@ -4940,44 +5011,44 @@ get_graphics_x_data() END { print vendorString "," version "," vendorRelease }' ) ) - x_vendor=${a_x_working[0]} - x_version=${a_x_working[1]} + vendor=${a_display_vendor_working[0]} + version=${a_display_vendor_working[1]} # this gives better output than the failure last case, which would only show: # for example: X.org: 1.9 instead of: X.org: 1.9.0 - if [[ -z $x_version ]];then - x_version=$( get_graphics_x_version ) + if [[ -z $version ]];then + version=$( get_graphics_display_server_version ) fi - if [[ -z $x_version ]];then - x_version=${a_x_working[2]} + if [[ -z $version ]];then + version=${a_display_vendor_working[2]} fi # some distros, like fedora, report themselves as the xorg vendor, so quick check # here to make sure the vendor string includes Xorg in string - if [[ -z $( grep -E '(X|xorg|x\.org)' <<< $x_vendor ) ]];then - x_vendor="$x_vendor X.org" + if [[ -z $( grep -E '(X|xorg|x\.org)' <<< $vendor ) ]];then + vendor="$vendor X.org" fi IFS="$ORIGINAL_IFS" - A_X_DATA[0]="$x_vendor" - A_X_DATA[1]="$x_version" + A_DISPLAY_SERVER_DATA[0]="$vendor" + A_DISPLAY_SERVER_DATA[1]="$version" else - x_version=$( get_graphics_x_version ) - if [[ -n $x_version ]];then - x_vendor='X.org' - A_X_DATA[0]="$x_vendor" - A_X_DATA[1]="$x_version" + version=$( get_graphics_display_server_version ) + if [[ -n $version ]];then + vendor='X.org' + A_DISPLAY_SERVER_DATA[0]="$vendor" + A_DISPLAY_SERVER_DATA[1]="$version" fi fi - temp_array=${A_X_DATA[@]} - log_function_data "A_X_DATA: $temp_array" + temp_array=${A_DISPLAY_SERVER_DATA[@]} + log_function_data "A_DISPLAY_SERVER_DATA: $temp_array" eval $LOGFE } # if other tests fail, try this one, this works for root, out of X also -get_graphics_x_version() +get_graphics_display_server_version() { eval $LOGFS - local x_version='' x_data='' + local version='' x_data='' # note that some users can have /usr/bin/Xorg but not /usr/bin/X if [[ -n $( type -p X ) ]];then # note: MUST be this syntax: X -version 2>&1 @@ -4989,7 +5060,7 @@ get_graphics_x_version() x_data="$( Xorg -version 2>&1)" fi if [[ -n $x_data ]];then - x_version=$( + version=$( gawk ' BEGIN { IGNORECASE=1 @@ -5003,8 +5074,8 @@ get_graphics_x_version() exit }' <<< "$x_data" ) fi - echo $x_version - log_function_data " x_version: $x_version" + echo $version + log_function_data " version: $version" eval $LOGFE } @@ -5339,6 +5410,83 @@ get_hdd_temp_data() eval $LOGFE } +get_init_data() +{ + eval $LOGFS + + local init_type='' init_version='' rc_type='' rc_version='' temp_array='' + local ls_run='' strings_init_version='' + local runlevel=$( get_runlevel_data ) + local default_runlevel=$( get_runlevel_default ) + + # this test is pretty solid, if pid 1 is owned by systemd, it is systemd + # otherwise that is 'init', which covers the rest of the init systems, I think anyway. + # more data may be needed for other init systems. + if [[ -e /proc/1/comm && -n $( grep -s 'systemd' /proc/1/comm ) ]];then + init_type='systemd' + init_version=$( get_de_app_version 'systemd' '^systemd' '2' ) + else + ls_run=$(ls /run) + # note: upstart-file-bridge.pid upstart-socket-bridge.pid upstart-udev-bridge.pid + if [[ -n $( grep 'upstart' <<< "$ls_run" ) ]];then + init_type='Upstart' + # /sbin/init --version == init (upstart 1.12.1) + init_version=$( get_de_app_version 'init' 'upstart' '3' ) + elif [[ -n $( type -p epoch ) ]];then + init_type='Epoch' + # epoch version == Epoch Init System 1.0.1 "Sage" + init_version=$( get_de_app_version 'epoch' '^Epoch' '4' ) + # missing data: + # http://smarden.org/runit/sv.8.html + elif [[ -e /etc/runit || -n $( type -p sv ) ]];then + init_type='runit' # lower case + # no data on version yet + elif [[ -f /etc/inittab ]];then + init_type='SysVinit' + if [[ -n $( type -p strings ) ]];then + strings_init_version="$( strings /sbin/init | grep -E 'version[[:space:]]+[0-9]' )" + fi + if [[ -n $strings_init_version ]];then + init_version=$( gawk '{print $2}' <<< "$strings_init_version" ) + fi + fi + + if [[ -n $( grep 'openrc' <<< "$ls_run" ) ]];then + rc_type='OpenRC' + # /sbin/openrc --version == openrc (OpenRC) 0.13 + if [[ -n $( type -p openrc ) ]];then + rc_version=$( get_de_app_version 'openrc' '^openrc' '3' ) + # /sbin/rc --version == rc (OpenRC) 0.11.8 (Gentoo Linux) + elif [[ -n $( type -p rc ) ]];then + rc_version=$( get_de_app_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 +# elif [[ -f /etc/inittab ]];then +# rc_type='SysVrc' +# # this is a guess that rc and init are same versions, may need updates / fixes +# rc_version=$init_version + fi + fi + + IFS=$'\n' + + A_INIT_DATA=( + "$init_type" + "$init_version" + "$rc_type" + "$rc_version" + "$runlevel" + "$default_runlevel" ) + + IFS="$ORIGINAL_IFS" + + temp_array=${A_INIT_DATA[@]} + log_function_data "A_INIT_DATA: $temp_array" + + eval $LOGFE +} + get_kernel_version() { eval $LOGFS @@ -5380,20 +5528,20 @@ get_lspci_data() } # args: $1 - busid -get_lspci_vendor_product() +get_lspci_chip_id() { eval $LOGFS - local vendor_product='' + local chip_id='' - vendor_product=$( gawk ' + chip_id=$( gawk ' /^'$1'/ { if ( $3 != "" ) { print $3 } }' <<< "$Lspci_n_Data" ) - echo $vendor_product + echo $chip_id eval $LOGFE } @@ -5748,7 +5896,7 @@ get_network_advanced_data() { eval $LOGFS local a_network_adv_working='' if_path='' working_path='' working_uevent_path='' dir_path='' - local if_id='' speed='' duplex='' mac_id='' oper_state='' vendor_product='' + local if_id='' speed='' duplex='' mac_id='' oper_state='' chip_id='' local usb_data='' usb_vendor='' usb_product='' product_path='' driver_test='' for (( i=0; i < ${#A_NETWORK_DATA[@]}; i++ )) @@ -5763,7 +5911,7 @@ get_network_advanced_data() mac_id='' oper_state='' usb_data='' - vendor_product='' + chip_id='' if [[ -z $( grep '^usb-' <<< ${a_network_adv_working[4]} ) ]];then # note although this may exist technically don't use it, it's a virtual path # and causes weird cat errors when there's a missing file as well as a virtual path @@ -5862,9 +6010,9 @@ get_network_advanced_data() fi if [[ -n ${a_network_adv_working[10]} ]];then - vendor_product=${a_network_adv_working[10]} + chip_id=${a_network_adv_working[10]} fi - A_NETWORK_DATA[i]=${a_network_adv_working[0]}","${a_network_adv_working[1]}","${a_network_adv_working[2]}","${a_network_adv_working[3]}","${a_network_adv_working[4]}","$if_id","$oper_state","$speed","$duplex","$mac_id","$vendor_product + A_NETWORK_DATA[i]=${a_network_adv_working[0]}","${a_network_adv_working[1]}","${a_network_adv_working[2]}","${a_network_adv_working[3]}","${a_network_adv_working[4]}","$if_id","$oper_state","$speed","$duplex","$mac_id","$chip_id IFS="$ORIGINAL_IFS" done @@ -6907,7 +7055,7 @@ get_pciconf_card_data() ;; display) array_string="$device_string,${a_temp[4]},${a_temp[5]}" - A_GFX_CARD_DATA[j]=$array_string + A_GRAPHICS_CARD_DATA[j]=$array_string ;; network) if [[ -n $ip_tool_command && -n ${a_temp[3]} ]];then @@ -7412,37 +7560,7 @@ $repo_data_working" fi done fi - # pacman - archlinux, going to assume that pisi and arch/pacman don't have the above issue with apt/yum - # pisi - pardus - elif [[ -d $pisi_dir && -n $( type -p pisi ) ]];then - REPO_DATA="$( pisi list-repo )" - # now we need to create the structure: repo info: repo path - # we do that by looping through the lines of the output and then - # putting it back into the : format print repos expects to see - # note this structure in the data, so store first line and make start of line - # then when it's an http line, add it, and create the full line collection. -# Pardus-2009.1 [Aktiv] -# http://packages.pardus.org.tr/pardus-2009.1/pisi-index.xml.bz2 -# Contrib [Aktiv] -# http://packages.pardus.org.tr/contrib-2009/pisi-index.xml.bz2 - while read repo_line - do - repo_line=$( gawk ' - { - # need to dump leading/trailing spaces and clear out color codes for irc output - sub(/^[[:space:]]+|[[:space:]]+$/,"",$0) -# gsub(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/,"",$0) # leaving this pattern in case need it - gsub(/\[([0-9];)?[0-9]+m/,"",$0) - print $0 - }' <<< $repo_line ) - if [[ -n $( grep '://' <<< $repo_line ) ]];then - repo_data_working="$repo_data_working:$repo_line\n" - else - repo_data_working="${repo_data_working}pisi repo:$repo_line" - fi - done <<< "$REPO_DATA" - # echo and execute the line breaks inserted - REPO_DATA="$( echo -e $repo_data_working )" + # pacman - archlinux, going to assume that pisi and arch/pacman, etc don't have the above issue with apt/yum elif [[ -f $pacman_conf ]];then # get list of mirror include files, trim white space off ends repo_data_working="$( gawk ' @@ -7478,6 +7596,71 @@ $repo_data_working" done # execute line breaks REPO_DATA="$( echo -e $repo_data_working2 )" + # pisi - pardus + elif [[ -d $pisi_dir && -n $( type -p pisi ) ]];then + REPO_DATA="$( pisi list-repo )" + # now we need to create the structure: repo info: repo path + # we do that by looping through the lines of the output and then + # putting it back into the : format print repos expects to see + # note this structure in the data, so store first line and make start of line + # then when it's an http line, add it, and create the full line collection. +# Pardus-2009.1 [Aktiv] +# http://packages.pardus.org.tr/pardus-2009.1/pisi-index.xml.bz2 +# Contrib [Aktiv] +# http://packages.pardus.org.tr/contrib-2009/pisi-index.xml.bz2 + while read repo_line + do + repo_line=$( gawk ' + { + # need to dump leading/trailing spaces and clear out color codes for irc output + sub(/^[[:space:]]+|[[:space:]]+$/,"",$0) +# gsub(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/,"",$0) # leaving this pattern in case need it + gsub(/\[([0-9];)?[0-9]+m/,"",$0) + print $0 + }' <<< $repo_line ) + if [[ -n $( grep '://' <<< $repo_line ) ]];then + repo_data_working="$repo_data_working:$repo_line\n" + else + repo_data_working="${repo_data_working}pisi repo:$repo_line" + fi + done <<< "$REPO_DATA" + # echo and execute the line breaks inserted + REPO_DATA="$( echo -e $repo_data_working )" + # Mandriva/Mageia using: urpmq + elif [[ -n $( type -p urpmq ) ]];then + REPO_DATA="$( urpmq --list-media active --list-url )" + # now we need to create the structure: repo info: repo path + # we do that by looping through the lines of the output and then + # putting it back into the : format print repos expects to see + # note this structure in the data, so store first line and make start of line + # then when it's an http line, add it, and create the full line collection. +# Contrib ftp://ftp.uwsg.indiana.edu/linux/mandrake/official/2011/x86_64/media/contrib/release +# Contrib Updates ftp://ftp.uwsg.indiana.edu/linux/mandrake/official/2011/x86_64/media/contrib/updates +# Non-free ftp://ftp.uwsg.indiana.edu/linux/mandrake/official/2011/x86_64/media/non-free/release +# Non-free Updates ftp://ftp.uwsg.indiana.edu/linux/mandrake/official/2011/x86_64/media/non-free/updates +# Nonfree Updates (Local19) /mnt/data/mirrors/mageia/distrib/cauldron/x86_64/media/nonfree/updates + while read repo_line + do + repo_line=$( gawk ' + { + # need to dump leading/trailing spaces and clear out color codes for irc output + sub(/^[[:space:]]+|[[:space:]]+$/,"",$0) +# gsub(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/,"",$0) # leaving this pattern in case need it + gsub(/\[([0-9];)?[0-9]+m/,"",$0) + print $0 + }' <<< $repo_line ) + # urpmq output is the same each line, repo name space repo url, can be: + # rsync://, ftp://, file://, http:// OR repo is locally mounted on FS in some cases + if [[ -n $( grep -E '(://|[[:space:]]/)' <<< $repo_line ) ]];then + # cut out the repo first + repo_data_working2=$( grep -Eo '([^[:space:]]+://|[[:space:]]/).*' <<< $repo_line ) + # then get the repo name string by slicing out the url string + repo_name=$( sed "s|[[:space:]]*$repo_data_working2||" <<< $repo_line ) + repo_data_working="${repo_data_working}urpmq repo:$repo_name:$repo_data_working2\n" + fi + done <<< "$REPO_DATA" + # echo and execute the line breaks inserted + REPO_DATA="$( echo -e $repo_data_working )" elif [[ -f $freebsd_conf ]];then REPO_DATA="$( gawk -F '=' -v repoFile=$freebsd_conf ' BEGIN { @@ -7503,6 +7686,44 @@ get_runlevel_data() eval $LOGFE } +# note: it appears that at least as of 2014-01-13, /etc/inittab is going to be used for +# default runlevel in upstart/sysvinit. systemd default is not always set so check to see +# if it's linked. +get_runlevel_default() +{ + eval $LOGFS + local default_runlvl='' + local inittab='/etc/inittab' + local systemd_default='/etc/systemd/system/default.target' + local upstart_default='/etc/init/rc-sysinit.conf' + + # note: systemd systems do not necessarily have this link created + if [[ -L $systemd_default ]];then + default_runlvl=$( readlink $systemd_default ) + if [[ -n $default_runlvl ]];then + default_runlvl=$( basename $default_runlvl ) + fi + # http://askubuntu.com/questions/86483/how-can-i-see-or-change-default-run-level + # note that technically default can be changed at boot but for inxi purposes that does + # not matter, we just want to know the system default + elif [[ -e $upstart_default ]];then + # env DEFAULT_RUNLEVEL=2 + default_runlvl=$( gawk -F '=' '/^env[[:space:]]+DEFAULT_RUNLEVEL/ { + print $2 + }' $upstart_default ) + fi + + # handle weird cases where null but inittab exists + if [[ -z $default_runlvl && -f $inittab ]];then + default_runlvl=$( gawk -F ':' ' + /^id.*initdefault/ { + print $2 + }' $inittab ) + fi + echo $default_runlvl + eval $LOGFE +} + get_sensors_data() { eval $LOGFS @@ -8515,7 +8736,7 @@ print_it_out() print_cpu_data fi if [[ $B_SHOW_GRAPHICS == 'true' ]];then - print_gfx_data + print_graphics_data fi if [[ $B_SHOW_AUDIO == 'true' ]];then print_audio_data @@ -8655,7 +8876,7 @@ print_audio_data() { eval $LOGFS local i='' card_id='' audio_data='' a_audio_data='' port_data='' pci_bus_id='' card_string='' - local a_audio_working='' audio_driver='' alsa_data='' port_plural='' module_version='' + local a_audio_working='' audio_driver='' alsa_data='' port_plural='' module_version='' chip_id='' local bus_usb_text='' bus_usb_id='' line_starter='Audio:' alsa='' alsa_version='' print_data='' local driver='' # set A_AUDIO_DATA and get alsa data @@ -8703,7 +8924,8 @@ print_audio_data() bus_usb_text='' bus_usb_id='' print_data='' - vendor_product='' + card_id='' + chip_id='' if [[ ${#A_AUDIO_DATA[@]} -gt 1 ]];then card_id="-$(( $i + 1 ))" @@ -8736,26 +8958,26 @@ print_audio_data() bus_usb_text='bus-ID' if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then if [[ $BSD_TYPE != 'bsd' ]];then - vendor_product=$( get_lspci_vendor_product "${a_audio_working[4]}" ) + chip_id=$( get_lspci_chip_id "${a_audio_working[4]}" ) else - vendor_product=${a_audio_working[6]} + chip_id=${a_audio_working[6]} fi fi else bus_usb_text='usb-ID' if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then - vendor_product=${a_audio_working[5]} + chip_id=${a_audio_working[5]} fi fi bus_usb_id=${a_audio_working[4]} pci_bus_id="${C1}$bus_usb_text$SEP3${C2} $bus_usb_id " - if [[ -n $vendor_product ]];then - vendor_product="${C1}chip-ID$SEP3${C2} $vendor_product " + if [[ -n $chip_id ]];then + chip_id="${C1}chip-ID$SEP3${C2} $chip_id " fi fi if [[ -n ${a_audio_working[0]} ]];then card_string="${C1}Card$card_id:${C2} ${a_audio_working[0]} " - audio_data="$audio_driver$port_data$pci_bus_id$vendor_product" + audio_data="$audio_driver$port_data$pci_bus_id$chip_id" fi # only print alsa on last line if short enough, otherwise print on its own line if [[ $i -eq 0 ]];then @@ -8975,22 +9197,22 @@ print_cpu_flags_full() eval $LOGFE } -print_gfx_data() +print_graphics_data() { eval $LOGFS - local gfx_data='' i='' card_id='' root_alert='' root_x_string='' a_gfx_working='' - local b_is_mesa='false' display_full_string='' gfx_bus_id='' gfx_card_data='' - local res_tty='Resolution' xorg_data='' x_vendor_string='' vendor_product='' - local spacer='' x_driver='' x_driver_string='' x_driver_plural='' direct_render_string='' + local graphics_data='' card_id='' i='' root_alert='' root_x_string='' a_graphics_working='' + local b_is_mesa='false' display_full_string='' card_bus_id='' card_data='' + local res_tty='Resolution' xorg_data='' display_vendor_string='' chip_id='' + local spacer='' driver='' driver_string='' driver_plural='' direct_render_string='' local separator_loaded='' separator_unloaded='' separator_failed='' - local loaded='' unloaded='' failed='' + local loaded='' unloaded='' failed='' display_server_string='' local line_starter='Graphics:' local screen_resolution="$( get_graphics_res_data )" - # set A_X_DATA - get_graphics_x_data - local x_vendor=${A_X_DATA[0]} - local x_version=${A_X_DATA[1]} + # set A_DISPLAY_SERVER_DATA + get_graphics_display_server_data + local display_vendor=${A_DISPLAY_SERVER_DATA[0]} + local display_version=${A_DISPLAY_SERVER_DATA[1]} # set A_GLX_DATA get_graphics_glx_data local glx_renderer="${A_GLX_DATA[0]}" @@ -8999,7 +9221,7 @@ print_gfx_data() # note: using grep -ioE '(No|Yes)' <<< ${A_GLX_DATA[2]} did not work in Arch, no idea why local glx_direct_render=$( gawk '{print $1}' <<< "${A_GLX_DATA[2]}" ) - # set A_GFX_CARD_DATA + # set A_GRAPHICS_CARD_DATA if [[ $BSD_TYPE == 'bsd' ]];then if [[ $B_PCICONF_SET == 'false' ]];then get_pciconf_data @@ -9012,57 +9234,58 @@ print_gfx_data() get_graphics_driver if [[ ${#A_GRAPHIC_DRIVERS[@]} -eq 0 ]];then - x_driver=' N/A' + driver=' N/A' else for (( i=0; i < ${#A_GRAPHIC_DRIVERS[@]}; i++ )) do IFS="," - a_gfx_working=( ${A_GRAPHIC_DRIVERS[i]} ) + a_graphics_working=( ${A_GRAPHIC_DRIVERS[i]} ) IFS="$ORIGINAL_IFS" - case ${a_gfx_working[1]} in + case ${a_graphics_working[1]} in loaded) - loaded="$loaded$separator_loaded${a_gfx_working[0]}" + loaded="$loaded$separator_loaded${a_graphics_working[0]}" separator_loaded=',' ;; unloaded) - unloaded="$unloaded$separator_unloaded${a_gfx_working[0]}" + unloaded="$unloaded$separator_unloaded${a_graphics_working[0]}" separator_unloaded=',' ;; failed) - failed="$failed$separator_failed${a_gfx_working[0]}" + failed="$failed$separator_failed${a_graphics_working[0]}" separator_failed=',' ;; esac done fi if [[ -n $loaded ]];then - x_driver="${x_driver} $loaded" + driver="${driver} $loaded" fi if [[ -n $unloaded ]];then - x_driver="${x_driver} (unloaded: $unloaded)" + driver="${driver} (unloaded: $unloaded)" fi if [[ -n $failed ]];then - x_driver="${x_driver} ${RED}FAILED:${C2} $failed" + driver="${driver} ${RED}FAILED:${C2} $failed" fi # sometimes for some reason there is no driver found but the array is started - if [[ -z $x_driver ]];then - x_driver=' N/A' + if [[ -z $driver ]];then + driver=' N/A' fi if [[ ${#A_GRAPHIC_DRIVERS[@]} -gt 1 ]];then - x_driver_plural='s' + driver_plural='s' fi - x_driver_string="${C1}driver$x_driver_plural$SEP3${C2}$x_driver " + driver_string="${C1}driver$driver_plural$SEP3${C2}$driver " # some basic error handling: if [[ -z $screen_resolution ]];then screen_resolution='N/A' fi - if [[ -z $x_vendor || -z $x_version ]];then - x_vendor_string="${C1}X-Vendor:${C2} N/A " + if [[ -z $display_vendor || -z $display_version ]];then + display_vendor_string="N/A" else - x_vendor_string="${C1}$x_vendor$SEP3${C2} $x_version " + display_vendor_string="$display_vendor $display_version" fi + display_server_string="${C1}Display Server${SEP3}${C2} $display_vendor_string " if [[ $B_ROOT == 'true' ]];then root_x_string='for root ' @@ -9070,7 +9293,7 @@ print_gfx_data() res_tty='tty size' fi fi - if [[ $B_RUNNING_IN_X != 'true' ]];then + if [[ $B_RUNNING_IN_DISPLAY != 'true' ]];then root_x_string="${root_x_string}out of X" res_tty='tty size' fi @@ -9079,68 +9302,68 @@ print_gfx_data() root_x_string="${C1}Advanced Data:${C2} N/A $root_x_string" fi - display_full_string="$x_vendor_string$x_driver_string${C1}${res_tty}$SEP3${C2} ${screen_resolution} $root_x_string" + display_full_string="$display_server_string$driver_string${C1}${res_tty}$SEP3${C2} ${screen_resolution} $root_x_string" - if [[ ${#A_GFX_CARD_DATA[@]} -gt 0 ]];then - for (( i=0; i < ${#A_GFX_CARD_DATA[@]}; i++ )) + if [[ ${#A_GRAPHICS_CARD_DATA[@]} -gt 0 ]];then + for (( i=0; i < ${#A_GRAPHICS_CARD_DATA[@]}; i++ )) do IFS="," - a_gfx_working=( ${A_GFX_CARD_DATA[i]} ) + a_graphics_working=( ${A_GRAPHICS_CARD_DATA[i]} ) IFS="$ORIGINAL_IFS" - gfx_bus_id='' - gfx_card_data=${a_gfx_working[0]} + card_bus_id='' + card_data=${a_graphics_working[0]} if [[ $B_EXTRA_DATA == 'true' ]];then - if [[ -n ${a_gfx_working[1]} ]];then - gfx_bus_id=" ${C1}bus-ID$SEP3${C2} ${a_gfx_working[1]}" + if [[ -n ${a_graphics_working[1]} ]];then + card_bus_id=" ${C1}bus-ID$SEP3${C2} ${a_graphics_working[1]}" if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then if [[ $BSD_TYPE != 'bsd' ]];then - vendor_product=$( get_lspci_vendor_product "${a_gfx_working[1]}" ) + chip_id=$( get_lspci_chip_id "${a_graphics_working[1]}" ) else - vendor_product=${a_gfx_working[2]} + chip_id=${a_graphics_working[2]} fi fi else - gfx_bus_id=" ${C1}bus-ID$SEP3${C2} N/A" + card_bus_id=" ${C1}bus-ID$SEP3${C2} N/A" fi fi - if [[ -n $vendor_product ]];then - vendor_product=" ${C1}chip-ID$SEP3${C2} $vendor_product" + if [[ -n $chip_id ]];then + chip_id=" ${C1}chip-ID$SEP3${C2} $chip_id" fi - if [[ ${#A_GFX_CARD_DATA[@]} -gt 1 ]];then + if [[ ${#A_GRAPHICS_CARD_DATA[@]} -gt 1 ]];then card_id="Card-$(($i+1)):" else card_id='Card:' fi - gfx_data="${C1}$card_id${C2} $gfx_card_data$gfx_bus_id$vendor_product " - if [[ ${#A_GFX_CARD_DATA[@]} -gt 1 ]];then - gfx_data=$( create_print_line "$line_starter" "${gfx_data}" ) - print_screen_output "$gfx_data" + graphics_data="${C1}$card_id${C2} $card_data$card_bus_id$chip_id " + if [[ ${#A_GRAPHICS_CARD_DATA[@]} -gt 1 ]];then + graphics_data=$( create_print_line "$line_starter" "${graphics_data}" ) + print_screen_output "$graphics_data" line_starter=' ' - gfx_data='' + graphics_data='' fi done # handle cases where card detection fails, like in PS3, where lspci gives no output, or headless boxes.. else - gfx_data="${C1}Card:${C2} Failed to Detect Video Card! " + graphics_data="${C1}Card:${C2} Failed to Detect Video Card! " fi - if [[ -n $gfx_data && $( calculate_line_length "${gfx_data}$display_full_string" ) -lt $LINE_MAX ]];then - gfx_data=$( create_print_line "$line_starter" "${gfx_data}$display_full_string" ) + if [[ -n $graphics_data && $( calculate_line_length "${graphics_data}$display_full_string" ) -lt $LINE_MAX ]];then + graphics_data=$( create_print_line "$line_starter" "${graphics_data}$display_full_string" ) else - if [[ -n $gfx_data ]];then - gfx_data=$( create_print_line "$line_starter" "$gfx_data" ) - print_screen_output "$gfx_data" + if [[ -n $graphics_data ]];then + graphics_data=$( create_print_line "$line_starter" "$graphics_data" ) + print_screen_output "$graphics_data" line_starter=' ' fi - gfx_data=$( create_print_line "$line_starter" "$display_full_string" ) + graphics_data=$( create_print_line "$line_starter" "$display_full_string" ) fi - print_screen_output "$gfx_data" -# if [[ -z $glx_renderer || -z $glx_version ]];then -# b_is_mesa='true' -# fi + print_screen_output "$graphics_data" + # if [[ -z $glx_renderer || -z $glx_version ]];then + # b_is_mesa='true' + # fi - ## note: if glx render or version have no content, then mesa is true - # if [[ $B_SHOW_X_DATA == 'true' ]] && [[ $b_is_mesa != 'true' ]];then - if [[ $B_SHOW_X_DATA == 'true' && $B_ROOT != 'true' ]];then + ## note: if glx render or display_version have no content, then mesa is true + # if [[ $B_SHOW_DISPLAY_DATA == 'true' ]] && [[ $b_is_mesa != 'true' ]];then + if [[ $B_SHOW_DISPLAY_DATA == 'true' && $B_ROOT != 'true' ]];then if [[ -z $glx_renderer ]];then glx_renderer='N/A' fi @@ -9153,10 +9376,10 @@ print_gfx_data() if [[ $B_HANDLE_CORRUPT_DATA == 'true' || $B_EXTRA_DATA == 'true' ]];then direct_render_string=" ${C1}Direct Rendering$SEP3${C2} ${glx_direct_render}${CN}" fi - gfx_data="${C1}GLX Renderer$SEP3${C2} ${glx_renderer} ${C1}GLX Version$SEP3${C2} ${glx_version}${CN}$direct_render_string" - gfx_data=$( create_print_line " " "$gfx_data" ) + graphics_data="${C1}GLX Renderer$SEP3${C2} ${glx_renderer} ${C1}GLX Version$SEP3${C2} ${glx_version}${CN}$direct_render_string" + graphics_data=$( create_print_line " " "$graphics_data" ) - print_screen_output "$gfx_data" + print_screen_output "$graphics_data" fi eval $LOGFE } @@ -9289,8 +9512,9 @@ print_info_data() { eval $LOGFS - local info_data='' line_starter='Info:' - local runlvl='' client_data='' shell_data='' shell_parent='' tty_session='' + local info_data='' line_starter='Info:' runlvl_default='' runlvl='' runlvl_title='runlevel' + local init_data='' init_type='' init_version='' rc_type='' rc_version='' + local client_data='' shell_data='' shell_parent='' tty_session='' local memory="$( get_memory_data )" local processes=$(( $( wc -l <<< "$Ps_aux_Data" ) - 1 )) local up_time="$( get_uptime )" @@ -9320,7 +9544,7 @@ print_info_data() if [[ -n $shell_data ]];then # note, if you start this in tty, it will give 'login' as the parent, which we don't want. if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then - if [[ $B_RUNNING_IN_X != 'true' ]];then + if [[ $B_RUNNING_IN_DISPLAY != 'true' ]];then shell_parent=$( get_tty_number ) shell_parent="tty $shell_parent" else @@ -9341,30 +9565,83 @@ print_info_data() info_data="${C1}Processes$SEP3${C2} ${processes} ${C1}Uptime$SEP3${C2} ${up_time} ${C1}Memory$SEP3${C2} ${memory}${CN} " # this only triggers if no X data is present or if extra data switch is on - if [[ $B_SHOW_X_DATA != 'true' || $B_EXTRA_DATA == 'true' ]];then - runlvl="$( get_runlevel_data )" - if [[ -n $runlvl ]];then - info_data="${info_data}${C1}Runlevel$SEP3${C2} ${runlvl} " + if [[ $B_SHOW_DISPLAY_DATA != 'true' || $B_EXTRA_DATA == 'true' ]];then + get_init_data + if [[ ${A_INIT_DATA[0]} == 'systemd' ]];then + runlvl_title='target' fi + init_type=${A_INIT_DATA[0]} + if [[ -z $init_type ]];then + init_type='N/A' + fi + + if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then + init_version=${A_INIT_DATA[1]} + if [[ -z $init_version ]];then + init_version='N/A' + fi + init_version=" ${C1}v$SEP3${C2} $init_version" + rc_version=${A_INIT_DATA[3]} + if [[ -n $rc_version ]];then + rc_version=" ${C1}v$SEP3${C2} $rc_version" + fi + + runlvl_default=${A_INIT_DATA[5]} + if [[ -z $runlvl_default ]];then + runlvl_default='N/A' + fi + fi + # currently only using openrc here, otherwise show nothing + rc_type=${A_INIT_DATA[2]} + if [[ -n $rc_type ]];then + rc_type=" ${C1}rc$SEP3${C2} $rc_type$rc_version" + fi + init_type="${C1}Init$SEP3${C2} $init_type$init_version " + + runlvl=${A_INIT_DATA[4]} + if [[ -n $runlvl ]];then + runlvl="${C1}$runlvl_title$SEP3${C2} $runlvl " + fi + if [[ -n $runlvl_default ]];then + runlvl_default="${C1}default$SEP3${C2} $runlvl_default " + fi + init_data="$init_type$rc_type$runlvl$runlvl_default" fi if [[ $SHOW_IRC -gt 0 ]];then client_data="${C1}Client$SEP3${C2} ${IRC_CLIENT}${IRC_CLIENT_VERSION} " fi - info_data="${info_data}$gcc_installed" + info_data="${info_data}" closing_data="$client_data${C1}$SCRIPT_NAME$SEP3${C2} $SCRIPT_VERSION_NUMBER$patch_version_number${CN}" - if [[ -n $info_data && $( calculate_line_length "$info_data$closing_data" ) -gt $LINE_MAX ]];then + + # sometimes gcc is very long, and default runlevel can be long with systemd, so create a gcc-less line first + if [[ $( calculate_line_length "${info_data}${init_data}${gcc_installed}${closing_data}" ) -gt $LINE_MAX ]];then + info_data=${info_data}${init_data} info_data=$( create_print_line "$line_starter" "$info_data" ) print_screen_output "$info_data" - info_data="$closing_data" + init_data='' + info_data='' + # closing_data='' line_starter=' ' - else - info_data="${info_data}$closing_data" + #echo 1 fi + if [[ $( calculate_line_length "${info_data}${init_data}${gcc_installed}${closing_data}" ) -gt $LINE_MAX ]];then + info_data=${info_data}${init_data}${gcc_installed} + info_data=$( create_print_line "$line_starter" "$info_data" ) + print_screen_output "$info_data" + info_data='' + gcc_installed='' + init_data='' + line_starter=' ' + #echo 2 + fi + info_data="${info_data}${init_data}${gcc_installed}${closing_data}" + info_data=$( create_print_line "$line_starter" "$info_data" ) if [[ $SCHEME -gt 0 ]];then info_data="${info_data} ${NORMAL}" fi print_screen_output "$info_data" + eval $LOGFE } @@ -9581,7 +9858,7 @@ print_networking_data() eval $LOGFS local i='' card_id='' network_data='' a_network_working='' port_data='' driver_data='' local card_string='' port_plural='' module_version='' pci_bus_id='' bus_usb_text='' - local bus_usb_id='' line_starter='Network:' card_string='' card_data='' vendor_product='' + local bus_usb_id='' line_starter='Network:' card_string='' card_data='' chip_id='' local driver='' # set A_NETWORK_DATA if [[ $BSD_TYPE == 'bsd' ]];then @@ -9611,10 +9888,11 @@ print_networking_data() pci_bus_id='' port_data='' port_plural='' - vendor_product='' + card_id='' + chip_id='' if [[ ${#A_NETWORK_DATA[@]} -gt 1 ]];then - card_id="-$(( $i + 1 ))" + chip_id="-$(( $i + 1 ))" fi if [[ -n ${a_network_working[1]} && $B_EXTRA_DATA == 'true' && $BSD_TYPE != 'bsd' ]];then module_version=$( print_module_version "${a_network_working[1]}" ) @@ -9640,25 +9918,25 @@ print_networking_data() bus_usb_id=${a_network_working[4]} if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then if [[ $BSD_TYPE != 'bsd' ]];then - vendor_product=$( get_lspci_vendor_product "${a_network_working[4]}" ) + chip_id=$( get_lspci_chip_id "${a_network_working[4]}" ) else - vendor_product=${a_network_working[10]} + chip_id=${a_network_working[10]} fi fi else bus_usb_text='usb-ID' bus_usb_id=$( cut -d '-' -f '2-4' <<< ${a_network_working[4]} ) if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then - vendor_product=${a_network_working[10]} + chip_id=${a_network_working[10]} fi fi pci_bus_id="${C1}$bus_usb_text$SEP3${C2} $bus_usb_id" - if [[ -n $vendor_product ]];then - vendor_product=" ${C1}chip-ID$SEP3${C2} $vendor_product" + if [[ -n $chip_id ]];then + chip_id=" ${C1}chip-ID$SEP3${C2} $chip_id" fi fi card_string="${C1}Card$card_id:${C2} ${a_network_working[0]} " - card_data="$driver_data$port_data$pci_bus_id$vendor_product" + card_data="$driver_data$port_data$pci_bus_id$chip_id" if [[ $( calculate_line_length "$card_string$card_data" ) -gt $LINE_MAX ]];then network_data=$( create_print_line "$line_starter" "$card_string" ) line_starter=' ' @@ -10494,12 +10772,13 @@ print_repo_data() else file_content=$( echo $file_content ) fi + # echo $file_name : $file_name_holder : $repo_type : $file_content # check file name, if different, update the holder for print out if [[ $file_name != $file_name_holder ]];then - if [[ $repo_type != 'pisi repo' ]];then - repo_full="${C1}Active $repo_type in file:${C2} $file_name" - else + if [[ $repo_type == 'pisi repo' || $repo_type == 'urpmq repo' ]];then repo_full="${C1}$repo_type:${C2} $file_name" + else + repo_full="${C1}Active $repo_type in file:${C2} $file_name" fi file_name_holder=$file_name b_print_next_line='true' @@ -10683,7 +10962,7 @@ print_system_data() local tty_session='' # I think these will work, maybe, if logged in as root and in X - if [[ $B_RUNNING_IN_X == 'true' ]];then + if [[ $B_RUNNING_IN_DISPLAY == 'true' ]];then desktop_environment=$( get_desktop_environment ) if [[ -z $desktop_environment ]];then desktop_environment='N/A' @@ -10711,7 +10990,7 @@ print_system_data() if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then dm_data=$( get_display_manager ) # here we only want the dm info to show N/A if in X - if [[ -z $dm_data && $B_RUNNING_IN_X == 'true' ]];then + if [[ -z $dm_data && $B_RUNNING_IN_DISPLAY == 'true' ]];then dm_data='N/A' fi # only print out of X if dm_data has info, then it's actually useful, but