diff options
author | Unit 193 <unit193@ubuntu.com> | 2015-04-27 15:36:44 -0400 |
---|---|---|
committer | Unit 193 <unit193@ubuntu.com> | 2015-04-27 15:36:44 -0400 |
commit | 52ad6e5f318359be3fcdfa1405a8b8d4cad944e6 (patch) | |
tree | d84a10d1b26d43b0dfdb59c54f984bf1bc175e98 /inxi | |
parent | cbadc3fa6d5f17d8c2cb0b36bda9ebb837758dfc (diff) | |
download | inxi-52ad6e5f318359be3fcdfa1405a8b8d4cad944e6.tar.bz2 inxi-52ad6e5f318359be3fcdfa1405a8b8d4cad944e6.tar.xz inxi-52ad6e5f318359be3fcdfa1405a8b8d4cad944e6.tar.zst |
Imported Upstream version 2.2.19upstream/2.2.19
Diffstat (limited to 'inxi')
-rwxr-xr-x | inxi | 211 |
1 files changed, 170 insertions, 41 deletions
@@ -1,8 +1,8 @@ #!/usr/bin/env bash ######################################################################## #### Script Name: inxi -#### Version: 2.2.16 -#### Date: 2014-11-03 +#### Version: 2.2.19 +#### Date: 2015-02-15 #### Patch Number: 00 ######################################################################## #### 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-2014 Scott Rogers & Harald Hope +#### inxi version: Copyright (C) 2008-2015 Scott Rogers & Harald Hope #### Further fixes (listed as known): Horst Tritremmel <hjt at sidux.com> #### Steven Barrett (aka: damentz) - usb audio patch; swap percent used patch #### Jarett.Stevens - dmidecde -M patch for older systems with the /sys @@ -965,22 +965,22 @@ parse_version_data() # note, using ####[[:space:]]+ to avoid having this function also trip the version datas case $1 in date) - version_data="$( gawk -F ': ' ' + version_data=$( gawk -F ': ' ' /####[[:space:]]+Date:/ { print $NF - }' $SCRIPT_PATH/$SCRIPT_NAME )" + }' "$SCRIPT_PATH/$SCRIPT_NAME" ) ;; main) - version_data="$( gawk ' + version_data=$( gawk ' /####[[:space:]]+Version:/ { print $3 - }' $SCRIPT_PATH/$SCRIPT_NAME )" + }' "$SCRIPT_PATH/$SCRIPT_NAME" ) ;; patch) - version_data="$( gawk ' + version_data=$( gawk ' /####[[:space:]]+Patch Number:/ { print $4 - }' $SCRIPT_PATH/$SCRIPT_NAME )" + }' "$SCRIPT_PATH/$SCRIPT_NAME" ) ;; esac echo $version_data @@ -993,7 +993,7 @@ initialize_paths() local extra_paths="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/local/bin" # this needs to be set here because various options call the parent initialize function directly. - SCRIPT_PATH=$( dirname $0 ) + SCRIPT_PATH=$( dirname "$0" ) # Fallback paths put into $extra_paths; This might, among others, help on gentoo. # Now, create a difference of $PATH and $extra_paths and add that to $PATH: @@ -1677,18 +1677,42 @@ debug_data_collector() echo "Data going into: $SCRIPT_DATA_DIR/$debug_data_dir" # bsd tools http://cb.vu/unixtoolbox.xhtml # freebsd - pciconf -l -cv &> $debug_data_dir/bsd-pciconf-cvl.txt - pciconf -vl &> $debug_data_dir/bsd-pciconf-vl.txt - pciconf -l &> $debug_data_dir/bsd-pciconf-l.txt + if type -p pciconf &>/dev/null;then + pciconf -l -cv &> $debug_data_dir/bsd-pciconf-cvl.txt + pciconf -vl &> $debug_data_dir/bsd-pciconf-vl.txt + pciconf -l &> $debug_data_dir/bsd-pciconf-l.txt + else + touch $debug_data_dir/bsd-pciconf-absent + fi # openbsd - pcidump &> $debug_data_dir/bsd-pcidump.txt - pcidump -v &> $debug_data_dir/bsd-pcidump-v.txt + if type -p pcidump &>/dev/null;then + pcidump &> $debug_data_dir/bsd-pcidump-openbsd.txt + pcidump -v &> $debug_data_dir/bsd-pcidump-v-openbsd.txt + else + touch $debug_data_dir/bsd-pcidump-openbsd-absent + fi # netbsd - pcictl list &> $debug_data_dir/bsd-pcictl-list.txt - pcictl list -n &> $debug_data_dir/bsd-pcictl-list-n.txt - sysctl -a &> $debug_data_dir/bsd-sysctl-a.txt - usbdevs -v &> $debug_data_dir/bsd-usbdevs-v.txt - kldstat &> $debug_data_dir/bsd-kldstat.txt + if type -p pcictl &>/dev/null;then + pcictl list &> $debug_data_dir/bsd-pcictl-list-netbsd.txt + pcictl list -n &> $debug_data_dir/bsd-pcictl-list-n-netbsd.txt + else + touch $debug_data_dir/bsd-pcictl-netbsd-absent + fi + if type -p sysctl &>/dev/null;then + sysctl -a &> $debug_data_dir/bsd-sysctl-a.txt + else + touch $debug_data_dir/bsd-sysctl-absent + fi + if type -p usbdevs &>/dev/null;then + usbdevs -v &> $debug_data_dir/bsd-usbdevs-v.txt + else + touch $debug_data_dir/bsd-usbdevs-absent + fi + if type -p kldstat &>/dev/null;then + kldstat &> $debug_data_dir/bsd-kldstat.txt + else + touch $debug_data_dir/bsd-kldstat-absent + fi # diskinfo -v <disk> # fdisk <disk> dmidecode &> $debug_data_dir/dmidecode.txt @@ -1718,10 +1742,28 @@ debug_data_collector() lsusb &> $debug_data_dir/lsusb.txt ls /sys &> $debug_data_dir/ls-sys.txt ps aux &> $debug_data_dir/ps-aux.txt + ps -e &> $debug_data_dir/ps-e.txt + ps -p 1 &> $debug_data_dir/ps-p-1.txt + cat /proc/1/comm &> $debug_data_dir/proc-1-comm.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 + if type -p rc-status &>/dev/null;then + rc-status -a &> $debug_data_dir/rc-status-a.txt + rc-status -l &> $debug_data_dir/rc-status-l.txt + rc-status -r &> $debug_data_dir/rc-status-r.txt + else + touch $debug_data_dir/rc-status-absent + fi + if type -p systemctl &>/dev/null;then + systemctl list-units &> $debug_data_dir/systemctl-list-units.txt + systemctl list-units --type=target &> $debug_data_dir/systemctl-list-units-target.txt + else + touch $debug_data_dir/systemctl-absent + fi + if type -p initctl &>/dev/null;then + initctl list &> $debug_data_dir/initctl-list.txt + else + touch $debug_data_dir/initctl-absent + fi sensors &> $debug_data_dir/sensors.txt if type -p strings &>/dev/null;then touch $debug_data_dir/strings-present @@ -1740,8 +1782,16 @@ debug_data_collector() fi head -n 1 /proc/asound/card*/codec* &> $debug_data_dir/proc-asound-card-codec.txt ls /usr/bin/gcc* &> $debug_data_dir/gcc-sys-versions.txt - gcc --version &> $debug_data_dir/gcc-version.txt - clang --version &> $debug_data_dir/clang-version.txt + if type -p gcc &>/dev/null;then + gcc --version &> $debug_data_dir/gcc-version.txt + else + touch $debug_data_dir/gcc-absent + fi + if type -p clang &>/dev/null;then + clang --version &> $debug_data_dir/clang-version.txt + else + touch $debug_data_dir/clang-absent + fi cat /etc/src.conf &> $debug_data_dir/bsd-etc-src-conf.txt cat /etc/make.conf &> $debug_data_dir/bsd-etc-make-conf.txt cat /etc/issue &> $debug_data_dir/etc-issue.txt @@ -2807,7 +2857,7 @@ show_options() print_lines_basic "1" "-o" "Unmounted $partition_string information (includes UUID and LABEL if available). Shows file system type if you have file installed, if you are root OR if you have added to /etc/sudoers (sudo v. 1.7 or newer) Example:^<username>^ALL^=^NOPASSWD:^/usr/bin/file^" print_lines_basic "1" "-p" "Full $partition_string information (-P plus all other detected ${partition_string}s)." print_lines_basic "1" "-P" "Basic $partition_string information (shows what -v^4 would show, but without extra data). Shows, if detected: / /boot /home /tmp /usr /var. Use -p to see all mounted ${partition_string}s." - print_lines_basic "1" "-r" "Distro repository data. Supported repo types: APT; PACMAN; PISI; YUM; URPMQ; Ports." + print_lines_basic "1" "-r" "Distro repository data. Supported repo types: APT; PACMAN; PISI; PORTAGE; PORTS (BSDs); SLACKPKG; URPMQ; YUM; ZYPP." print_lines_basic "1" "-R" "RAID data. Shows RAID devices, states, levels, and components, and extra data with -x/-xx. md-raid: If device is resyncing, shows resync progress line as well." print_lines_basic "1" "-s" "Sensors output (if sensors installed/configured): mobo/cpu/gpu temp; detected fan speeds. Gpu temp only for Fglrx/Nvidia drivers. Nvidia shows screen number for > 1 screens." print_lines_basic "1" "-S" "System information: host name, kernel, desktop environment (if in X), distro" @@ -6377,10 +6427,18 @@ get_init_data() init_type='Upstart' # /sbin/init --version == init (upstart 1.12.1) init_version=$( get_program_version 'init' 'upstart' '3' ) - elif type -p epoch &>/dev/null;then + elif [[ -e /proc/1/comm && -n $( grep -s 'epoch' /proc/1/comm ) ]];then init_type='Epoch' # epoch version == Epoch Init System 1.0.1 "Sage" init_version=$( get_program_version 'epoch' '^Epoch' '4' ) + # missing data: note, runit can install as a dependency without being the init system + # http://smarden.org/runit/sv.8.html + # NOTE: the proc test won't work on bsds, so if runit is used on bsds we will need more data + elif [[ -e /proc/1/comm && -n $( grep -s 'runit' /proc/1/comm ) ]];then + # elif [[ -e /sbin/runit-init || -e /etc/runit || -n $( type -p sv ) ]];then + init_type='runit' # lower case + # no data on version yet + # freebsd at least elif type -p launchctl &>/dev/null;then init_type='launchd' # / launchd/ version.plist /etc/launchd.conf @@ -6393,16 +6451,9 @@ get_init_data() if [[ -n $strings_init_version ]];then init_version=$( gawk '{print $2}' <<< "$strings_init_version" ) fi - # missing data: note, runit can install as a dependency without being the init system - # http://smarden.org/runit/sv.8.html - elif [[ -e /sbin/runit-init || -e /etc/runit || -n $( type -p sv ) ]];then - init_type='runit' # lower case - # no data on version yet - # freebsd at least elif [[ -f /etc/ttys ]];then init_type='init (bsd)' fi - if [[ -n $( grep 'openrc' <<< "$ls_run" ) ]];then rc_type='OpenRC' # /sbin/openrc --version == openrc (OpenRC) 0.13 @@ -6412,6 +6463,13 @@ get_init_data() elif type -p rc &>/dev/null;then rc_version=$( get_program_version 'rc' '^rc' '3' ) fi + if [[ -e /run/openrc/softlevel ]];then + runlevel=$( cat /run/openrc/softlevel 2>/dev/null ) + elif [[ -e /var/run/openrc/softlevel ]];then + runlevel=$( cat /var/run/openrc/softlevel 2>/dev/null ) + elif type -p rc-status &>/dev/null;then + runlevel=$( rc-status -r 2>/dev/null ) + 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 @@ -6420,7 +6478,6 @@ get_init_data() # rc_version=$init_version fi fi - IFS=$'\n' A_INIT_DATA=( @@ -9292,6 +9349,7 @@ get_repo_data() local bsd_pkg_dir='/usr/local/etc/pkg/repos/' slackpkg_file='/etc/slackpkg/mirrors' local netbsd_file='/usr/pkg/etc/pkgin/repositories.conf' freebsd_file='/etc/freebsd-update.conf' local freebsd_pkg_file='/etc/pkg/FreeBSD.conf' slackpkg_plus_file='/etc/slackpkg/slackpkgplus.conf' + local portage_repo_dir='/etc/portage/repos.conf/' # apt - debian, buntus, also sometimes some yum/rpm repos may create apt repos here as well if [[ -f $apt_file || -d $apt_file.d ]];then @@ -9475,6 +9533,75 @@ get_repo_data() get_repo_builder "$repo_data_working" fi repo_data_working='' + elif [[ -d $portage_repo_dir && -n $( type -p emerge ) ]];then + repo_files=$( ls $portage_repo_dir*.conf 2>/dev/null ) + repo_name='portage' + log_function_data "portage repo files: $repo_files" + if [[ -n $repo_files ]];then + for repo_file in $repo_files + do + if [[ -n $1 ]];then + cat $repo_file &> $1/repo-data_${repo_file//\//-}.txt + fi + repo_data_working="$( gawk -v repoFile="$repo_file" ' + # construct the string for the print function to work with, file name: data + function print_line( fileName, repoId, repoUrl ){ + print "'$repo_name' sources^" fileName "^" repoId repoUrl + } + BEGIN { + FS="\n" + IGNORECASE=1 + enabledStatus="" + repoTitle="" + urlData="" + } + # this is a hack, assuming that each item has these fields listed, we collect the 3 + # items one by one, then when the url/enabled fields are set, we print it out and + # reset the data. Not elegant but it works. Note that if enabled was not present + # we assume it is enabled then, and print the line, reset the variables. This will + # miss the last item, so it is printed if found in END + /^\[.+\]/ { + if ( urlData != "" && repoTitle != "" ){ + print_line( repoFile, repoTitle, urlData ) + enabledStatus="" + urlData="" + repoTitle="" + } + gsub( /\[|\]/, "", $1 ) # strip out the brackets + repoTitle = $1 " ~ " + } + /^(sync-uri)/ { + sub( /sync-uri[[:space:]]*=[[:space:]]*/, "", $1 ) # strip out the field starter + urlData = $1 + } + # note: enabled = 1. enabled = 0 means disabled + /^auto-sync[[:space:]]*=/ { + sub( /auto-sync[[:space:]]*=[[:space:]]*/, "", $1 ) # strip out the field starter + enabledStatus = $1 + } + # print out the line if all 3 values are found, otherwise if a new + # repoTitle is hit above, it will print out the line there instead + { + if ( urlData != "" && enabledStatus != "" && repoTitle != "" ){ + if ( enabledStatus !~ /enabled[[:space:]]*=[[:space:]]*0/ ){ + print_line( repoFile, repoTitle, urlData ) + } + enabledStatus="" + urlData="" + repoTitle="" + } + } + END { + # print the last one if there is data for it + if ( urlData != "" && repoTitle != "" ){ + print_line( repoFile, repoTitle, urlData ) + } + } + ' $repo_file )" + # then load the global for each file as it gets filled + get_repo_builder "$repo_data_working" + done + fi elif [[ -d $pisi_dir && -n $( type -p pisi ) ]];then REPO_DATA="$( pisi list-repo )" if [[ -n $1 ]];then @@ -11941,7 +12068,6 @@ print_info_data() 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 @@ -11950,18 +12076,16 @@ print_info_data() 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" + rc_version="${C1}v$SEP3${C2} $rc_version " fi - runlvl_default=${A_INIT_DATA[5]} 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" + 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 " @@ -13490,7 +13614,12 @@ print_repo_data() fi done <<< "$REPO_DATA" else - repo_full=$( create_print_line "Repos:" "${C1}Error$SEP3${C2} $SCRIPT_NAME does not support this feature for your distro yet." ) + if [[ $BSD_TYPE == 'bsd' ]];then + repo_type='OS type' + else + repo_type="package manager" + fi + repo_full=$( create_print_line "Repos:" "${C1}Error$SEP3${C2} No repo data detected. Does $SCRIPT_NAME support your $repo_type?" ) print_screen_output "$repo_full" fi eval $LOGFE |