diff options
Diffstat (limited to 'inxi')
-rwxr-xr-x | inxi | 164 |
1 files changed, 143 insertions, 21 deletions
@@ -1,8 +1,8 @@ #!/usr/bin/env bash ######################################################################## #### Script Name: inxi -#### Version: 1.9.19 -#### Date: 2014-03-03 +#### Version: 2.0.0 +#### Date: 2014-03-12 #### Patch Number: 00 ######################################################################## #### SPECIAL THANKS @@ -233,6 +233,7 @@ 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='' @@ -1820,6 +1821,7 @@ check_recommends_items() ifconfig:net-tools~net-tools~net-tools~:-i_ip_lan-deprecated ip:iproute~iproute2~iproute~:-i_ip_lan sensors:lm-sensors~lm_sensors~lm-sensors~:-s_sensors_output + strings:binutils~~~:-I_sysvinit_version lsusb:usbutils~usbutils~usbutils~:-A_usb_audio;-N_usb_networking modinfo:module-init-tools~module-init-tools~module-init-tools~:-Ax,-Nx_module_version runlevel:sysvinit~sysvinit~systemd~:-I_runlevel @@ -2529,7 +2531,7 @@ show_options() 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," - print_screen_output " if detected. Adds current runlevel." + print_screen_output " if detected. Init/RC Type and runlevel (if available)." 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);" @@ -2546,6 +2548,7 @@ show_options() print_screen_output " -G - Chip vendor:product ID for each video card." 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 " Adds Init/RC (if found) version number." 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." print_screen_output " -R - md-raid: Superblock (if present); algorythm, U data. Adds system info line" @@ -4042,6 +4045,9 @@ get_de_app_version() dwm|jwm|mate-about|wmii|wmii2) get_version='-v' ;; + epoch) + get_version='version' + ;; esac case $1 in @@ -4070,8 +4076,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" ) @@ -5406,6 +5412,89 @@ 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' + if [[ -n $( type -p systemd ) ]];then + init_version=$( get_de_app_version 'systemd' '^systemd' '2' ) + fi + if [[ -z $init_version && -n $( type -p systemctl ) ]];then + init_version=$( get_de_app_version 'systemctl' '^systemd' '2' ) + fi + else + ls_run=$(ls /run) + # note: upstart-file-bridge.pid upstart-socket-bridge.pid upstart-udev-bridge.pid + # /sbin/init --version == init (upstart 1.12.1) + 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' ) + 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 @@ -9431,8 +9520,9 @@ print_info_data() { eval $LOGFS - local info_data='' line_starter='Info:' runlvl_default='' - 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 )" @@ -9484,17 +9574,46 @@ print_info_data() # this only triggers if no X data is present or if extra data switch is on if [[ $B_SHOW_DISPLAY_DATA != 'true' || $B_EXTRA_DATA == 'true' ]];then + get_init_data + if [[ ${A_INIT_DATA[0]} == 'systemd' && -z $( grep -E '^[0-9]$' <<< ${A_INIT_DATA[4]} ) ]];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 - runlvl_default=$( get_runlevel_default ) + 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 - runlvl_default=" ${C1}default$SEP3${C2} $runlvl_default" fi - runlvl="$( get_runlevel_data )" + # 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 - info_data="${info_data}${C1}Runlevel$SEP3${C2} $runlvl$runlvl_default " + 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} " @@ -9503,24 +9622,27 @@ print_info_data() closing_data="$client_data${C1}$SCRIPT_NAME$SEP3${C2} $SCRIPT_VERSION_NUMBER$patch_version_number${CN}" # sometimes gcc is very long, and default runlevel can be long with systemd, so create a gcc-less line first - if [[ -n $info_data && $( calculate_line_length "${info_data}${gcc_installed}" ) -gt $LINE_MAX ]];then + 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="${gcc_installed}${closing_data}" - gcc_installed='' - closing_data='' + init_data='' + info_data='' + # closing_data='' line_starter=' ' - elif [[ -n $info_data && $( calculate_line_length "${info_data}${gcc_installed}${closing_data}" ) \ - -gt $LINE_MAX ]];then + #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}${closing_data}" + info_data='' gcc_installed='' - closing_data='' + init_data='' line_starter=' ' - else - info_data="${info_data}${gcc_installed}${closing_data}" + #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 |