(change version)

Refactored to gawk the arch repo processing in get_repo..
This commit is contained in:
inxi-svn 2010-02-01 17:31:46 +00:00
parent 77763f7386
commit e4f8bacf31

26
inxi
View file

@ -1,8 +1,8 @@
#!/bin/bash
########################################################################
#### Script Name: inxi
#### version: 1.3.6
#### Date: January 31 2010
#### version: 1.3.7
#### Date: February 1 2010
########################################################################
#### SPECIAL THANKS
########################################################################
@ -3263,14 +3263,32 @@ $repo_data_working"
# pacman - archlinux
elif [[ -f $pacman_conf ]];then
# get list of mirror include files, trim white space off ends
repo_data_working="$( grep -i '^Include' $pacman_conf | grep -vi 'IncludePath' | cut -d '=' -f 2 | sed 's|^[[:space:]]$||g' )"
repo_data_working="$( gawk '
BEGIN {
FS="="
IGNORECASE=1
}
/^[[:space:]]*Include/ {
sub(/^[[:space:]]+|[[:space:]]+$/,"",$2)
print $2
}
' $pacman_conf )"
# sort into unique paths only, to be used to search for server = data
repo_data_working=$( sort -bu <<< "$repo_data_working" | uniq )
repo_data_working="$repo_data_working $pacman_conf"
for repo_file in $repo_data_working
do
# inserting a new line after each found / processed match
repo_data_working2="$repo_data_working2$( grep -i '^Server' $repo_file | cut -d '=' -f 2 | sed 's|^[[:space:]]$||g' | sed -r 's|(.*)|'$repo_file':\1\\n|' )"
repo_data_working2="$repo_data_working2$( gawk -v repoFile=$repo_file '
BEGIN {
FS="="
IGNORECASE=1
}
/^[[:space:]]*Server/ {
sub(/^[[:space:]]+|[[:space:]]+$/,"",$2)
print repoFile ":" $2 "\\n"
}
' $repo_file )"
done
# execute line breaks
REPO_DATA="$( echo -e $repo_data_working2 )"