New version, tarball. Added urpmq for -r.

Other distros than Mandriva, Mageia, no other changes so no need to update unless you want to.

This adds support for Mandriva, Mageia. urpmq parsing is similar but not identical to pisi.
This commit is contained in:
inxi-svn 2013-10-05 01:40:00 +00:00
parent 7b67885e42
commit 088a7812a1
3 changed files with 91 additions and 38 deletions

109
inxi
View file

@ -1,8 +1,8 @@
#!/usr/bin/env bash
########################################################################
#### Script Name: inxi
#### Version: 1.9.14
#### Date: September 10 2013
#### Version: 1.9.15
#### Date: October 4 2013
#### Patch Number: 00
########################################################################
#### SPECIAL THANKS
@ -2471,7 +2471,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."
@ -7413,37 +7413,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 <data>:<url> 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 '
@ -7479,6 +7449,70 @@ $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 <data>:<url> 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 <data>:<url> 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
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://
if [[ -n $( grep '://' <<< $repo_line ) ]];then
# cut out the repo first
repo_data_working2=$( grep -Eo '[^[: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 {
@ -10495,12 +10529,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'

4
inxi.1
View file

@ -1,4 +1,4 @@
.TH INXI 1 "2013\-06\-19" inxi "inxi manual"
.TH INXI 1 "2013\-10\-04" inxi "inxi manual"
.SH NAME
inxi \- Command line system information script for console and IRC
@ -163,6 +163,8 @@ PACMAN (Arch Linux + derived versions)
PISI (Pardus + derived versions)
URPMQ (Mandriva, Mageia + derived versions)
YUM. (Fedora, Redhat, maybe Suse + derived versions)
(as distro data is collected more will be added. If your's is missing please show us how to get this

View file

@ -1,3 +1,19 @@
=====================================================================================
Version: 1.9.15
Patch Version: 00
Script Date: October 4 2013
-----------------------------------
Changes:
-----------------------------------
New version, tarball. Added urpmq for -r.
Other distros than Mandriva, Mageia, no other changes so no need to update unless you want to.
This adds support for Mandriva, Mageia. urpmq parsing is similar but not identical to pisi.
-----------------------------------
-- Harald Hope - Fri, 04 Oct 2013 18:24:55 -0700
=====================================================================================
Version: 1.9.14
Patch Version: 00