add emerge gentoo test

This commit is contained in:
inxi-svn 2015-02-16 01:27:23 +00:00
parent 67f1b44ff2
commit 752b98c618

409
inxi
View file

@ -1,11 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# fetch has -q for quiet you can use -o - for stdout and -T for timeout
# openbsd ftp does http
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### Version: 2.2.12 #### Version: 2.2.18
#### Date: 2014-09-24 #### Date: 2015-02-14
#### Patch Number: 02-b1 #### Patch Number: 01-b1
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
######################################################################## ########################################################################
@ -22,7 +20,7 @@
#### Gaim/Pidgin, Weechat, KVIrc and Kopete. #### Gaim/Pidgin, Weechat, KVIrc and Kopete.
#### Original infobash author and copyright holder: #### Original infobash author and copyright holder:
#### Copyright (C) 2005-2007 Michiel de Boer a.k.a. locsmif #### 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> #### Further fixes (listed as known): Horst Tritremmel <hjt at sidux.com>
#### Steven Barrett (aka: damentz) - usb audio patch; swap percent used patch #### Steven Barrett (aka: damentz) - usb audio patch; swap percent used patch
#### Jarett.Stevens - dmidecde -M patch for older systems with the /sys #### Jarett.Stevens - dmidecde -M patch for older systems with the /sys
@ -55,7 +53,7 @@
#### DEPENDENCIES #### DEPENDENCIES
#### * bash >=3.0 (bash); df, readlink, stty, tr, uname, wc (coreutils); #### * bash >=3.0 (bash); df, readlink, stty, tr, uname, wc (coreutils);
#### gawk (gawk); grep (grep); lspci (pciutils); #### gawk (gawk); grep (grep); lspci (pciutils);
#### ps, uptime (procps); find (findutils) #### ps, find (findutils)
#### * Also the proc filesystem should be present and mounted for Linux #### * Also the proc filesystem should be present and mounted for Linux
#### * Some features, like -M and -d will not work, or will work incompletely, #### * Some features, like -M and -d will not work, or will work incompletely,
#### if /sys is missing #### if /sys is missing
@ -76,6 +74,7 @@
#### -G - full graphics output requires: glxinfo (mesa-utils); xdpyinfo (X11-utils); #### -G - full graphics output requires: glxinfo (mesa-utils); xdpyinfo (X11-utils);
#### xrandr (x11-xserver-utils) #### xrandr (x11-xserver-utils)
#### -i - IP information, local/wan - ip (iproute) legacy, not used if ip present: ifconfig (net-tools) #### -i - IP information, local/wan - ip (iproute) legacy, not used if ip present: ifconfig (net-tools)
#### -I - uptime (procps, check Debian if changed)
#### -Ix - view current runlevel while not in X window system (or with -x): runlevel (sysvinit) #### -Ix - view current runlevel while not in X window system (or with -x): runlevel (sysvinit)
#### -m - all systems, dmidecode, unless someone can find a better way. #### -m - all systems, dmidecode, unless someone can find a better way.
#### -M - for older systems whose kernel does not have /sys data for machine, dmidecode (dmidecode) #### -M - for older systems whose kernel does not have /sys data for machine, dmidecode (dmidecode)
@ -966,22 +965,22 @@ parse_version_data()
# note, using ####[[:space:]]+ to avoid having this function also trip the version datas # note, using ####[[:space:]]+ to avoid having this function also trip the version datas
case $1 in case $1 in
date) date)
version_data="$( gawk -F ': ' ' version_data=$( gawk -F ': ' '
/####[[:space:]]+Date:/ { /####[[:space:]]+Date:/ {
print $NF print $NF
}' $SCRIPT_PATH/$SCRIPT_NAME )" }' "$SCRIPT_PATH/$SCRIPT_NAME" )
;; ;;
main) main)
version_data="$( gawk ' version_data=$( gawk '
/####[[:space:]]+Version:/ { /####[[:space:]]+Version:/ {
print $3 print $3
}' $SCRIPT_PATH/$SCRIPT_NAME )" }' "$SCRIPT_PATH/$SCRIPT_NAME" )
;; ;;
patch) patch)
version_data="$( gawk ' version_data=$( gawk '
/####[[:space:]]+Patch Number:/ { /####[[:space:]]+Patch Number:/ {
print $4 print $4
}' $SCRIPT_PATH/$SCRIPT_NAME )" }' "$SCRIPT_PATH/$SCRIPT_NAME" )
;; ;;
esac esac
echo $version_data echo $version_data
@ -994,7 +993,7 @@ initialize_paths()
local extra_paths="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/local/bin" 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. # 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. # 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: # Now, create a difference of $PATH and $extra_paths and add that to $PATH:
@ -1064,7 +1063,7 @@ check_required_apps()
eval $LOGFS eval $LOGFS
local app_name='' local app_name=''
# bc removed from deps for now # bc removed from deps for now
local depends="df gawk grep ps readlink tr uname uptime wc" local depends="df gawk grep ps readlink tr uname wc"
if [[ -z $BSD_TYPE ]];then if [[ -z $BSD_TYPE ]];then
depends="$depends lspci" depends="$depends lspci"
@ -1678,22 +1677,48 @@ debug_data_collector()
echo "Data going into: $SCRIPT_DATA_DIR/$debug_data_dir" echo "Data going into: $SCRIPT_DATA_DIR/$debug_data_dir"
# bsd tools http://cb.vu/unixtoolbox.xhtml # bsd tools http://cb.vu/unixtoolbox.xhtml
# freebsd # freebsd
if type -p pciconf &>/dev/null;then
pciconf -l -cv &> $debug_data_dir/bsd-pciconf-cvl.txt pciconf -l -cv &> $debug_data_dir/bsd-pciconf-cvl.txt
pciconf -vl &> $debug_data_dir/bsd-pciconf-vl.txt pciconf -vl &> $debug_data_dir/bsd-pciconf-vl.txt
pciconf -l &> $debug_data_dir/bsd-pciconf-l.txt pciconf -l &> $debug_data_dir/bsd-pciconf-l.txt
else
touch $debug_data_dir/bsd-pciconf-absent
fi
# openbsd # openbsd
pcidump &> $debug_data_dir/bsd-pcidump.txt if type -p pcidump &>/dev/null;then
pcidump -v &> $debug_data_dir/bsd-pcidump-v.txt 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 # netbsd
pcictl list &> $debug_data_dir/bsd-pcictl-list.txt if type -p pcictl &>/dev/null;then
pcictl list -n &> $debug_data_dir/bsd-pcictl-list-n.txt 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 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 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 kldstat &> $debug_data_dir/bsd-kldstat.txt
else
touch $debug_data_dir/bsd-kldstat-absent
fi
# diskinfo -v <disk> # diskinfo -v <disk>
# fdisk <disk> # fdisk <disk>
dmidecode &> $debug_data_dir/dmidecode.txt dmidecode &> $debug_data_dir/dmidecode.txt
get_repo_data "$SCRIPT_DATA_DIR/$debug_data_dir"
if type -p shopt &>/dev/null;then if type -p shopt &>/dev/null;then
shopt -s nullglob;a_distro_ids=(/etc/*[-_]{release,version});shopt -u nullglob;echo ${a_distro_ids[@]} &> $debug_data_dir/etc-distro-files.txt shopt -s nullglob;a_distro_ids=(/etc/*[-_]{release,version});shopt -u nullglob;echo ${a_distro_ids[@]} &> $debug_data_dir/etc-distro-files.txt
for distro_file in ${a_distro_ids[@]} /etc/issue for distro_file in ${a_distro_ids[@]} /etc/issue
@ -1717,10 +1742,28 @@ debug_data_collector()
lsusb &> $debug_data_dir/lsusb.txt lsusb &> $debug_data_dir/lsusb.txt
ls /sys &> $debug_data_dir/ls-sys.txt ls /sys &> $debug_data_dir/ls-sys.txt
ps aux &> $debug_data_dir/ps-aux.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 runlevel &> $debug_data_dir/runlevel.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 &> $debug_data_dir/systemctl-list-units.txt
systemctl list-units --type=target &> $debug_data_dir/systemctl-list-units-target.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 initctl list &> $debug_data_dir/initctl-list.txt
else
touch $debug_data_dir/initctl-absent
fi
sensors &> $debug_data_dir/sensors.txt sensors &> $debug_data_dir/sensors.txt
if type -p strings &>/dev/null;then if type -p strings &>/dev/null;then
touch $debug_data_dir/strings-present touch $debug_data_dir/strings-present
@ -1739,8 +1782,16 @@ debug_data_collector()
fi fi
head -n 1 /proc/asound/card*/codec* &> $debug_data_dir/proc-asound-card-codec.txt 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 ls /usr/bin/gcc* &> $debug_data_dir/gcc-sys-versions.txt
if type -p gcc &>/dev/null;then
gcc --version &> $debug_data_dir/gcc-version.txt 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 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/src.conf &> $debug_data_dir/bsd-etc-src-conf.txt
cat /etc/make.conf &> $debug_data_dir/bsd-etc-make-conf.txt cat /etc/make.conf &> $debug_data_dir/bsd-etc-make-conf.txt
cat /etc/issue &> $debug_data_dir/etc-issue.txt cat /etc/issue &> $debug_data_dir/etc-issue.txt
@ -2066,7 +2117,6 @@ check_recommends_items()
sed:sed~sed~sed~:string_replace sed:sed~sed~sed~:string_replace
tr:coreutils~coreutils~coreutils~:character_replace tr:coreutils~coreutils~coreutils~:character_replace
uname:uname~coreutils~coreutils~:kernel_data uname:uname~coreutils~coreutils~:kernel_data
uptime:procps~procps~procps~:
wc:coreutils~coreutils~coreutils~:word_character_count wc:coreutils~coreutils~coreutils~:word_character_count
' '
local x_recommends=' local x_recommends='
@ -2087,6 +2137,7 @@ check_recommends_items()
modinfo:module-init-tools~module-init-tools~module-init-tools~:-Ax,-Nx_module_version modinfo:module-init-tools~module-init-tools~module-init-tools~:-Ax,-Nx_module_version
runlevel:sysvinit~sysvinit~systemd~:-I_runlevel runlevel:sysvinit~sysvinit~systemd~:-I_runlevel
sudo:sudo~sudo~sudo~:-Dx_hddtemp-user;-o_file-user sudo:sudo~sudo~sudo~:-Dx_hddtemp-user;-o_file-user
uptime:procps~procps~procps~:-I_uptime_(check_which_package_owns_Debian)
' '
local downloaders=" local downloaders="
@ -3118,7 +3169,12 @@ get_start_client()
case $App_Working_Name in case $App_Working_Name in
# bsd will never use this section # bsd will never use this section
bash|dash|sh|python*|perl*) # We want to know who wrapped it into the shell or perl. bash|dash|sh|python*|perl*) # We want to know who wrapped it into the shell or perl.
pppid="$( ps -p $PPID -o ppid --no-headers | sed 's/[[:space:]]//g' )" if [[ $BSD_TYPE != 'bsd' ]];then
pppid=$( ps -p $PPID -o ppid --no-headers 2>/dev/null | gawk '{print $NF}' )
else
# without --no-headers we need the second line
pppid=$( ps -p $PPID -o ppid 2>/dev/null | gawk '$1 ~ /^[0-9]+/ {print $5}' )
fi
if [[ -n $pppid && -f /proc/$pppid/exe ]];then if [[ -n $pppid && -f /proc/$pppid/exe ]];then
Irc_Client_Path="$( readlink /proc/$pppid/exe )" Irc_Client_Path="$( readlink /proc/$pppid/exe )"
irc_client_path_lower=$( tr '[A-Z]' '[a-z]' <<< $Irc_Client_Path ) irc_client_path_lower=$( tr '[A-Z]' '[a-z]' <<< $Irc_Client_Path )
@ -4850,8 +4906,9 @@ get_de_gtk_data()
get_display_manager() get_display_manager()
{ {
eval $LOGFS eval $LOGFS
# ldm - LTSP display manager # ldm - LTSP display manager. Note that sddm does not appear to have a .pid extension in Arch
local dm_id_list='entranced.pid gdm.pid gdm3.pid kdm.pid ldm.pid lightdm.pid lxdm.pid mdm.pid nodm.pid slim.lock tint2.pid wdm.pid xdm.pid' # note: to avoid positives with directories, test for -f explicitly, not -e
local dm_id_list='entranced.pid gdm.pid gdm3.pid kdm.pid ldm.pid lightdm.pid lxdm.pid mdm.pid nodm.pid sddm.pid sddm slim.lock tint2.pid wdm.pid xdm.pid'
local dm_id='' dm='' separator='' local dm_id='' dm='' separator=''
# note we don't need to filter grep if we do it this way # note we don't need to filter grep if we do it this way
local x_is_running=$( grep '/usr.*/X' <<< "$Ps_aux_Data" | grep -iv '/Xprt' ) local x_is_running=$( grep '/usr.*/X' <<< "$Ps_aux_Data" | grep -iv '/Xprt' )
@ -4859,7 +4916,8 @@ get_display_manager()
for dm_id in $dm_id_list for dm_id in $dm_id_list
do do
# note: ${dm_id%.*}/$dm_id will create a dir name out of the dm id, then test if pid is in that # note: ${dm_id%.*}/$dm_id will create a dir name out of the dm id, then test if pid is in that
if [[ -e /run/$dm_id || -e /run/${dm_id%.*}/$dm_id || -e /var/run/$dm_id ]];then if [[ -f /run/$dm_id || -f /run/${dm_id%.*}/$dm_id || -f /var/run/$dm_id || \
-f /var/run/${dm_id%.*}/$dm_id ]];then
# just on the off chance that two dms are running, good info to have in that case, if possible # just on the off chance that two dms are running, good info to have in that case, if possible
dm=$dm$separator${dm_id%.*} dm=$dm$separator${dm_id%.*}
separator=',' separator=','
@ -6369,10 +6427,18 @@ get_init_data()
init_type='Upstart' init_type='Upstart'
# /sbin/init --version == init (upstart 1.12.1) # /sbin/init --version == init (upstart 1.12.1)
init_version=$( get_program_version 'init' 'upstart' '3' ) 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' init_type='Epoch'
# epoch version == Epoch Init System 1.0.1 "Sage" # epoch version == Epoch Init System 1.0.1 "Sage"
init_version=$( get_program_version 'epoch' '^Epoch' '4' ) 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 elif type -p launchctl &>/dev/null;then
init_type='launchd' init_type='launchd'
# / launchd/ version.plist /etc/launchd.conf # / launchd/ version.plist /etc/launchd.conf
@ -6385,16 +6451,9 @@ get_init_data()
if [[ -n $strings_init_version ]];then if [[ -n $strings_init_version ]];then
init_version=$( gawk '{print $2}' <<< "$strings_init_version" ) init_version=$( gawk '{print $2}' <<< "$strings_init_version" )
fi 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 elif [[ -f /etc/ttys ]];then
init_type='init (bsd)' init_type='init (bsd)'
fi fi
if [[ -n $( grep 'openrc' <<< "$ls_run" ) ]];then if [[ -n $( grep 'openrc' <<< "$ls_run" ) ]];then
rc_type='OpenRC' rc_type='OpenRC'
# /sbin/openrc --version == openrc (OpenRC) 0.13 # /sbin/openrc --version == openrc (OpenRC) 0.13
@ -6404,6 +6463,13 @@ get_init_data()
elif type -p rc &>/dev/null;then elif type -p rc &>/dev/null;then
rc_version=$( get_program_version 'rc' '^rc' '3' ) rc_version=$( get_program_version 'rc' '^rc' '3' )
fi 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 ## assume sysvrc, but this data is too buggy and weird and inconsistent to have meaning
# leaving this off for now # leaving this off for now
# elif [[ -f /etc/inittab ]];then # elif [[ -f /etc/inittab ]];then
@ -6412,7 +6478,6 @@ get_init_data()
# rc_version=$init_version # rc_version=$init_version
fi fi
fi fi
IFS=$'\n' IFS=$'\n'
A_INIT_DATA=( A_INIT_DATA=(
@ -9272,6 +9337,7 @@ get_ram_data()
# neat and readable. Each line of the total number contains the following sections, # neat and readable. Each line of the total number contains the following sections,
# separated by a : for splitting in the print function # separated by a : for splitting in the print function
# part one, repo type/string : part two, file name, if present, of info : part 3, repo data # part one, repo type/string : part two, file name, if present, of info : part 3, repo data
# args: $1 - [file location of debug data file - optional, only for debugging data collection]
get_repo_data() get_repo_data()
{ {
eval $LOGFS eval $LOGFS
@ -9279,25 +9345,26 @@ get_repo_data()
local repo_name='' local repo_name=''
local apt_file='/etc/apt/sources.list' yum_repo_dir='/etc/yum.repos.d/' yum_conf='/etc/yum.conf' local apt_file='/etc/apt/sources.list' yum_repo_dir='/etc/yum.repos.d/' yum_conf='/etc/yum.conf'
local pacman_conf='/etc/pacman.conf' pacman_repo_dir='/etc/pacman.d/' pisi_dir='/etc/pisi/' local pacman_conf='/etc/pacman.conf' pacman_repo_dir='/etc/pacman.d/' pisi_dir='/etc/pisi/'
local zypp_repo_dir='/etc/zypp/repos.d/' freebsd_conf='/etc/portsnap.conf' openbsd_conf='/etc/pkg.conf' local zypp_repo_dir='/etc/zypp/repos.d/' ports_conf='/etc/portsnap.conf' openbsd_conf='/etc/pkg.conf'
local ports_dir='/usr/local/etc/pkg/repos/' slackpkg_file='/etc/slackpkg/mirrors' 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 # 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 if [[ -f $apt_file || -d $apt_file.d ]];then
for repo_file in $apt_file $( ls $apt_file.d/*.list 2>/dev/null) repo_files=$(ls /etc/apt/sources.list /etc/apt/sources.list.d/*.list 2>/dev/null)
log_function_data "apt repo files: $repo_files"
for repo_file in $repo_files
do do
if [[ -n $1 ]];then
cat $repo_file &> $1/repo-data_${repo_file//\//-}.txt
fi
repo_data_working="$( gawk -v repoFile="$repo_file" ' repo_data_working="$( gawk -v repoFile="$repo_file" '
!/^[[:space:]]*$|^[[:space:]]*#/ { !/^[[:space:]]*$|^[[:space:]]*#/ {
print "apt sources^" repoFile "^" $0 print "apt sources^" repoFile "^" $0
}' $repo_file )" }' $repo_file )"
if [[ -n $repo_data_working ]];then get_repo_builder "$repo_data_working"
if [[ -z $REPO_DATA ]];then
REPO_DATA="$repo_data_working"
else
REPO_DATA="$REPO_DATA
$repo_data_working"
fi
fi
done done
repo_data_working='' repo_data_working=''
fi fi
@ -9317,11 +9384,13 @@ get_repo_data()
repo_name='zypp' repo_name='zypp'
log_function_data "zypp repo files: $repo_files" log_function_data "zypp repo files: $repo_files"
fi fi
log_function_data 'cat' "$repo_files"
if [[ -n $repo_files ]];then if [[ -n $repo_files ]];then
for repo_file in $repo_files for repo_file in $repo_files
do do
repo_data_working="$( gawk -v repoFile=$repo_file ' 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 # construct the string for the print function to work with, file name: data
function print_line( fileName, repoId, repoUrl ){ function print_line( fileName, repoId, repoUrl ){
print "'$repo_name' sources^" fileName "^" repoId repoUrl print "'$repo_name' sources^" fileName "^" repoId repoUrl
@ -9375,16 +9444,8 @@ get_repo_data()
} }
} }
' $repo_file )" ' $repo_file )"
# then load the global for each file as it gets filled # then load the global for each file as it gets filled
if [[ -n $repo_data_working ]];then get_repo_builder "$repo_data_working"
if [[ -z $REPO_DATA ]];then
REPO_DATA="$repo_data_working"
else
REPO_DATA="$REPO_DATA
$repo_data_working"
fi
fi
done done
fi fi
repo_data_working='' repo_data_working=''
@ -9406,6 +9467,9 @@ $repo_data_working"
repo_data_working="$repo_data_working $pacman_conf" repo_data_working="$repo_data_working $pacman_conf"
for repo_file in $repo_data_working for repo_file in $repo_data_working
do do
if [[ -n $1 ]];then
cat $repo_file &> $1/repo-data_${repo_file//\//-}.txt
fi
if [[ -f $repo_file ]];then if [[ -f $repo_file ]];then
# inserting a new line after each found / processed match # inserting a new line after each found / processed match
repo_data_working2="$repo_data_working2$( gawk -v repoFile=$repo_file ' repo_data_working2="$repo_data_working2$( gawk -v repoFile=$repo_file '
@ -9426,26 +9490,123 @@ $repo_data_working"
REPO_DATA="$( echo -e $repo_data_working2 )" REPO_DATA="$( echo -e $repo_data_working2 )"
repo_data_working='' repo_data_working=''
# pisi - pardus # pisi - pardus
elif [[ -f $slackpkg_file ]];then elif [[ -f $slackpkg_file || -f $slackpkg_plus_file ]];then
# note, only one file, but loop it in case more are added in future # note, only one file, but loop it in case more are added in future
for repo_file in $slackpkg_file if [[ -f $slackpkg_file ]];then
do if [[ -n $1 ]];then
repo_data_working="$( gawk -v repoFile="$repo_file" ' cat $slackpkg_file &> $1/repo-data_${slackpkg_file//\//-}.txt
fi
repo_data_working="$( gawk -v repoFile="$slackpkg_file" '
!/^[[:space:]]*$|^[[:space:]]*#/ { !/^[[:space:]]*$|^[[:space:]]*#/ {
print "slackpkg sources^" repoFile "^" $0 print "slackpkg sources^" repoFile "^" $0
}' $repo_file )" }' $slackpkg_file )"
if [[ -n $repo_data_working ]];then get_repo_builder "$repo_data_working"
if [[ -z $REPO_DATA ]];then
REPO_DATA="$repo_data_working"
else
REPO_DATA="$REPO_DATA
$repo_data_working"
fi fi
if [[ -f $slackpkg_plus_file ]];then
if [[ -n $1 ]];then
cat $slackpkg_plus_file &> $1/repo-data_${slackpkg_plus_file//\//-}.txt
fi
# see sample for syntax
repo_data_working="$( gawk -F '=' -v repoFile="$slackpkg_plus_file" '
BEGIN {
activeRepos=""
}
# stop if set to off
/^SLACKPKGPLUS/ {
if ( $2 == "off" ){
exit
}
}
# get list of current active repos
/^REPOPLUS/ {
activeRepos=$2
}
# print out repo line if found
/^MIRRORPLUS/ {
if ( activeRepos != "" ) {
gsub(/MIRRORPLUS\['\''|'\''\]/,"",$1)
if ( match( activeRepos, $1 ) ){
print "slackpkg+ sources^" repoFile "^" $1 " ~ " $2
}
}
}' $slackpkg_plus_file )"
get_repo_builder "$repo_data_working"
fi fi
done
repo_data_working='' repo_data_working=''
elif [[ -d $portage_repo_dir && -n $( type -p emerge ) ]];then
repo_files=$( ls $portage_repo_dir*.repo 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 elif [[ -d $pisi_dir && -n $( type -p pisi ) ]];then
REPO_DATA="$( pisi list-repo )" REPO_DATA="$( pisi list-repo )"
if [[ -n $1 ]];then
echo "$REPO_DATA" &> $1/repo-data_pisi-list-repo.txt
fi
log_function_data "pisi-list-repo: $REPO_DATA" log_function_data "pisi-list-repo: $REPO_DATA"
# now we need to create the structure: repo info: repo path # now we need to create the structure: repo info: repo path
# we do that by looping through the lines of the output and then # we do that by looping through the lines of the output and then
@ -9478,7 +9639,9 @@ $repo_data_working"
# Mandriva/Mageia using: urpmq # Mandriva/Mageia using: urpmq
elif type -p urpmq &>/dev/null;then elif type -p urpmq &>/dev/null;then
REPO_DATA="$( urpmq --list-media active --list-url )" REPO_DATA="$( urpmq --list-media active --list-url )"
log_function_data "urpmq: $REPO_DATA" if [[ -n $1 ]];then
echo "$REPO_DATA" &> $1/repo-data_urpmq-list-media-active.txt
fi
# now we need to create the structure: repo info: repo path # now we need to create the structure: repo info: repo path
# we do that by looping through the lines of the output and then # we do that by looping through the lines of the output and then
# putting it back into the <data>:<url> format print repos expects to see # putting it back into the <data>:<url> format print repos expects to see
@ -9511,22 +9674,61 @@ $repo_data_working"
done <<< "$REPO_DATA" done <<< "$REPO_DATA"
# echo and execute the line breaks inserted # echo and execute the line breaks inserted
REPO_DATA="$( echo -e $repo_data_working )" REPO_DATA="$( echo -e $repo_data_working )"
elif [[ -f $freebsd_conf || -d $ports_dir ]];then elif [[ -f $ports_conf || -f $freebsd_file || -d $bsd_pkg_dir ]];then
if [[ -f $freebsd_conf ]];then if [[ -f $ports_conf ]];then
REPO_DATA="$( gawk -F '=' -v repoFile=$freebsd_conf ' if [[ -n $1 ]];then
cat $ports_conf &> $1/repo-data_${ports_conf//\//-}.txt
fi
repo_data_working="$( gawk -F '=' -v repoFile=$ports_conf '
BEGIN { BEGIN {
IGNORECASE=1 IGNORECASE=1
} }
/^SERVERNAME/ { /^SERVERNAME/ {
print "BSD ports servers^" repoFile "^" $2 print "BSD ports server^" repoFile "^" $2
exit
} }
' $freebsd_conf )" ' $ports_conf )"
get_repo_builder "$repo_data_working"
fi fi
if [[ -d $ports_dir ]];then if [[ -f $freebsd_file ]];then
repo_files=$(ls ${ports_dir}*.conf 2>/dev/null ) if [[ -n $1 ]];then
log_function_data 'cat' "$repo_files" cat $freebsd_file &> $1/repo-data_${freebsd_file//\//-}.txt
fi
repo_data_working="$( gawk -v repoFile=$freebsd_file '
BEGIN {
IGNORECASE=1
}
/^ServerName/ {
print "FreeBSD update server^" repoFile "^" $2
exit
}
' $freebsd_file )"
get_repo_builder "$repo_data_working"
fi
if [[ -f $freebsd_pkg_file ]];then
if [[ -n $1 ]];then
cat $freebsd_pkg_file &> $1/repo-data_${freebsd_pkg_file//\//-}.txt
fi
repo_data_working="$( gawk -F ': ' -v repoFile=$freebsd_pkg_file '
BEGIN {
IGNORECASE=1
}
$1 ~ /^[[:space:]]*url/ {
gsub(/\"|pkg\+|,/,"",$2)
print "FreeBSD default pkg server^" repoFile "^" $2
exit
}
' $freebsd_pkg_file )"
get_repo_builder "$repo_data_working"
fi
if [[ -d $bsd_pkg_dir ]];then
repo_files=$(ls ${bsd_pkg_dir}*.conf 2>/dev/null )
for repo_file in $repo_files for repo_file in $repo_files
do do
if [[ -n $1 ]];then
cat $repo_file &> $1/repo-data_${repo_file//\//-}.txt
fi
repo_data_working="$( gawk -v repoFile=$repo_file ' repo_data_working="$( gawk -v repoFile=$repo_file '
BEGIN { BEGIN {
FS=":" FS=":"
@ -9551,33 +9753,58 @@ $repo_data_working"
} }
if ( $1 == "enabled" ) { if ( $1 == "enabled" ) {
if ( $2 == "yes" ) { if ( $2 == "yes" ) {
print "BSD ports server^" repoFile "^" repoName " " repoUrl print "BSD pkg server^" repoFile "^" repoName " ~ " repoUrl
} }
} }
} }
} }
' $repo_file )" ' $repo_file )"
if [[ -z $REPO_DATA ]];then get_repo_builder "$repo_data_working"
REPO_DATA="$repo_data_working"
elif [[ -n $repo_data_working ]];then
REPO_DATA="$REPO_DATA
$repo_data_working"
fi
done done
fi fi
repo_data_working='' repo_data_working=''
elif [[ -f $openbsd_conf ]];then elif [[ -f $openbsd_conf ]];then
if [[ -n $1 ]];then
cat $openbsd_conf &> $1/repo-data_${openbsd_conf//\//-}.txt
fi
REPO_DATA="$( gawk -F '=' -v repoFile=$openbsd_conf ' REPO_DATA="$( gawk -F '=' -v repoFile=$openbsd_conf '
BEGIN { BEGIN {
IGNORECASE=1 IGNORECASE=1
} }
/^installpath/ { /^installpath/ {
print "BSD ports servers^" repoFile "^" $2 print "OpenBSD pkg mirror^" repoFile "^" $2
} }
' $openbsd_conf )" ' $openbsd_conf )"
elif [[ -f $netbsd_file ]];then
# note, only one file, but loop it in case more are added in future
for repo_file in $netbsd_file
do
if [[ -n $1 ]];then
cat $repo_file &> $1/repo-data_${repo_file//\//-}.txt
fi
repo_data_working="$( gawk -v repoFile="$repo_file" '
!/^[[:space:]]*$|^[[:space:]]*#/ {
print "NetBSD pkg servers^" repoFile "^" $0
}' $repo_file )"
get_repo_builder "$repo_data_working"
done
repo_data_working=''
fi fi
eval $LOGFE eval $LOGFE
} }
# build the total REPO_DATA global here
# args: $1 - the repo line/s
get_repo_builder()
{
if [[ -n $1 ]];then
if [[ -z $REPO_DATA ]];then
REPO_DATA="$1"
else
REPO_DATA="$REPO_DATA
$1"
fi
fi
}
get_runlevel_data() get_runlevel_data()
{ {
@ -10283,11 +10510,14 @@ get_unmounted_partition_filesystem()
get_uptime() get_uptime()
{ {
eval $LOGFS eval $LOGFS
local uptime_value=''
## note: removing gsub(/ /,"",a); to get get space back in there, goes right before print a ## note: removing gsub(/ /,"",a); to get get space back in there, goes right before print a
local uptime_value="$( uptime | gawk '{ if type -p uptime &>/dev/null;then
uptime_value="$( uptime | gawk '{
a = gensub(/^.*up *([^,]*).*$/,"\\1","g",$0) a = gensub(/^.*up *([^,]*).*$/,"\\1","g",$0)
print a print a
}' )" }' )"
fi
echo "$uptime_value" echo "$uptime_value"
log_function_data "uptime_value: $uptime_value" log_function_data "uptime_value: $uptime_value"
eval $LOGFE eval $LOGFE
@ -10815,6 +11045,9 @@ print_short_data()
local short_data='' i='' b_background_black='false' local short_data='' i='' b_background_black='false'
local memory=$( get_memory_data ) local memory=$( get_memory_data )
local up_time="$( get_uptime )" local up_time="$( get_uptime )"
if [[ -z $up_time ]];then
up_time='N/A - missing uptime?'
fi
# set A_CPU_CORE_DATA # set A_CPU_CORE_DATA
get_cpu_core_count get_cpu_core_count
@ -11775,6 +12008,9 @@ print_info_data()
local memory="$( get_memory_data )" local memory="$( get_memory_data )"
local processes=$(( $( wc -l <<< "$Ps_aux_Data" ) - 1 )) local processes=$(( $( wc -l <<< "$Ps_aux_Data" ) - 1 ))
local up_time="$( get_uptime )" local up_time="$( get_uptime )"
if [[ -z $up_time ]];then
up_time='N/A - missing uptime?'
fi
local patch_version_number=$( get_patch_version_string ) local patch_version_number=$( get_patch_version_string )
local gcc_installed='' gcc_others='' closing_data='' local gcc_installed='' gcc_others='' closing_data=''
@ -11832,7 +12068,6 @@ print_info_data()
if [[ -z $init_type ]];then if [[ -z $init_type ]];then
init_type='N/A' init_type='N/A'
fi fi
if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then
init_version=${A_INIT_DATA[1]} init_version=${A_INIT_DATA[1]}
if [[ -z $init_version ]];then if [[ -z $init_version ]];then
@ -11843,7 +12078,6 @@ print_info_data()
if [[ -n $rc_version ]];then if [[ -n $rc_version ]];then
rc_version="${C1}v$SEP3${C2} $rc_version " rc_version="${C1}v$SEP3${C2} $rc_version "
fi fi
runlvl_default=${A_INIT_DATA[5]} runlvl_default=${A_INIT_DATA[5]}
fi fi
# currently only using openrc here, otherwise show nothing # currently only using openrc here, otherwise show nothing
@ -11852,7 +12086,6 @@ print_info_data()
rc_type="${C1}rc$SEP3${C2} $rc_type $rc_version" rc_type="${C1}rc$SEP3${C2} $rc_type $rc_version"
fi fi
init_type="${C1}Init$SEP3${C2} $init_type$init_version " init_type="${C1}Init$SEP3${C2} $init_type$init_version "
runlvl=${A_INIT_DATA[4]} runlvl=${A_INIT_DATA[4]}
if [[ -n $runlvl ]];then if [[ -n $runlvl ]];then
runlvl="${C1}$runlvl_title$SEP3${C2} $runlvl " runlvl="${C1}$runlvl_title$SEP3${C2} $runlvl "