From e7e2a381a9bd43b65ca0c656f3f09640d5125961 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Mon, 1 Feb 2010 18:02:37 +0000 Subject: [PATCH] bug fix for pardus pisi line output, added file missing detection for arch repos --- inxi | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/inxi b/inxi index 42cce38..8357a48 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.3.7 +#### version: 1.3.8 #### Date: February 1 2010 ######################################################################## #### SPECIAL THANKS @@ -3249,8 +3249,14 @@ $repo_data_working" # putting it back into the : format print repos expects to see while read repo_line do - # dump empty lines... - repo_line=$( sed 's|^[[:space:]]$||g' <<< $repo_line ) + repo_line=$( gawk ' + { + # need to dump leading/trailing spaces and change [,] to (, ) for irc output + sub(/^[[:space:]]+|[[:space:]]+$/,"",$0) + gsub(/\[/,"(",$0) + gsub(/\]/,")",$0) + print $0 + }' <<< $repo_line ) if [[ -n $( grep '://' <<< $repo_line ) ]];then repo_data_working="$repo_data_working:$repo_line\n" else @@ -3278,17 +3284,21 @@ $repo_data_working" 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$( gawk -v repoFile=$repo_file ' - BEGIN { - FS="=" - IGNORECASE=1 - } - /^[[:space:]]*Server/ { - sub(/^[[:space:]]+|[[:space:]]+$/,"",$2) - print repoFile ":" $2 "\\n" - } - ' $repo_file )" + if [[ -f $repo_file ]];then + # inserting a new line after each found / processed match + 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 )" + else + echo "Error: file listed in $pacman_conf does not exist - $repo_file" + fi done # execute line breaks REPO_DATA="$( echo -e $repo_data_working2 )"