From 3715909bd5fae435170b9f53019e635d5dac1c31 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sat, 24 Jan 2015 18:51:56 +0000 Subject: [PATCH] New version, new tarball. Two great bug report, issues. 1. Tightened runit init detection to use proc, note that if runit works on BSDs inxi will require more data to properly detect it on BSDs.. 2. Use openrc runlevel tests natively if openrc detected. 3. Fixed subtle issue with alias to inxi file and paths. 4. Added rc-status data collection for debugger, improved debugger data collector handling of bsd and other tests to note absent if not there in file names. --- inxi | 117 ++++++++++++++++++++++++++++++++++++------------- inxi.changelog | 19 ++++++++ 2 files changed, 105 insertions(+), 31 deletions(-) diff --git a/inxi b/inxi index 15ae775..cb29ebc 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/usr/bin/env bash ######################################################################## #### Script Name: inxi -#### Version: 2.2.17 -#### Date: 2015-01-14 +#### Version: 2.2.18 +#### Date: 2015-01-24 #### Patch Number: 00 ######################################################################## #### SPECIAL THANKS @@ -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 # fdisk dmidecode &> $debug_data_dir/dmidecode.txt @@ -1722,9 +1746,24 @@ debug_data_collector() 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 @@ -1743,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 @@ -6384,6 +6431,14 @@ get_init_data() 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 @@ -6396,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 @@ -6415,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 diff --git a/inxi.changelog b/inxi.changelog index 943c545..5ae590b 100755 --- a/inxi.changelog +++ b/inxi.changelog @@ -1,3 +1,22 @@ +===================================================================================== +Version: 2.2.18 +Patch Version: 00 +Script Date: 2015-01-24 +----------------------------------- +Changes: +----------------------------------- +New version, new tarball. Two great bug report, issues. + +1. Tightened runit init detection to use proc, note that if runit works on BSDs inxi will + require more data to properly detect it on BSDs.. +2. Use openrc runlevel tests natively if openrc detected. +3. Fixed subtle issue with alias to inxi file and paths. +4. Added rc-status data collection for debugger, improved debugger data collector handling + of bsd and other tests to note absent if not there in file names. + +----------------------------------- +-- Harald Hope - Sat, 24 Jan 2015 10:25:43 -0800 + ===================================================================================== Version: 2.2.17 Patch Version: 00