(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 #!/bin/bash
######################################################################## ########################################################################
#### Script Name: inxi #### Script Name: inxi
#### version: 1.3.6 #### version: 1.3.7
#### Date: January 31 2010 #### Date: February 1 2010
######################################################################## ########################################################################
#### SPECIAL THANKS #### SPECIAL THANKS
######################################################################## ########################################################################
@ -3263,14 +3263,32 @@ $repo_data_working"
# pacman - archlinux # pacman - archlinux
elif [[ -f $pacman_conf ]];then elif [[ -f $pacman_conf ]];then
# get list of mirror include files, trim white space off ends # 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 # 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=$( sort -bu <<< "$repo_data_working" | uniq )
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
# inserting a new line after each found / processed match # 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 done
# execute line breaks # execute line breaks
REPO_DATA="$( echo -e $repo_data_working2 )" REPO_DATA="$( echo -e $repo_data_working2 )"