mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
(change version)
yum made more robust, added /etc/yum.conf support, added support for older syntaxes in redhat, added missing data support. And that's it I hope for yum.
This commit is contained in:
parent
aa1fd80f5c
commit
7332f3b6de
32
inxi
32
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 1.2.3
|
||||
#### version: 1.2.4
|
||||
#### Date: October 13 2009
|
||||
########################################################################
|
||||
#### SPECIAL THANKS
|
||||
|
@ -3103,9 +3103,14 @@ get_repo_data()
|
|||
REPO_DATA="$( grep -Esv '(^[[:space:]]*$|^[[:space:]]*#)' $apt_file $apt_file.d/*.list )"
|
||||
REPO_FILE_ID='apt sources'
|
||||
elif [[ -d $yum_repo_dir ]];then
|
||||
for repo_file in $( ls $yum_repo_dir*.repo 2>/dev/null )
|
||||
# older redhats put their yum data in /etc/yum.conf
|
||||
for repo_file in $( ls $yum_repo_dir*.repo /etc/yum.conf 2>/dev/null )
|
||||
do
|
||||
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 fileName ":" repoId repoUrl
|
||||
}
|
||||
BEGIN {
|
||||
FS="\n"
|
||||
IGNORECASE=1
|
||||
|
@ -3115,8 +3120,16 @@ get_repo_data()
|
|||
}
|
||||
# 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.
|
||||
# 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 " ~ "
|
||||
}
|
||||
|
@ -3127,19 +3140,24 @@ get_repo_data()
|
|||
/^enabled=/ {
|
||||
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 != "" ){
|
||||
# construct the string for the print function to work with, file name: data
|
||||
# do not print if enabled=0 since it is not active then
|
||||
if ( enabledStatus !~ /enabled=0/ ){
|
||||
print repoFile ":" repoTitle urlData
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue