From e4f8bacf3154ec13efbb4129dd4c4426322f0600 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Mon, 1 Feb 2010 17:31:46 +0000 Subject: [PATCH] (change version) Refactored to gawk the arch repo processing in get_repo.. --- inxi | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/inxi b/inxi index 3633e13..42cce38 100755 --- a/inxi +++ b/inxi @@ -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 )"