From e253aa30282c32c513b65c986ba4afb158c150e6 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Mon, 1 Feb 2010 02:52:30 +0000 Subject: [PATCH] after getting user data, added pardus pisi repo listing support for the -r repo list option. This method will probably work for arch too I'd guess if pacman lists repos in the same way --- inxi | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/inxi b/inxi index 08d83a4..c2798d8 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.3.4 -#### Date: January 29 2010 +#### version: 1.3.5 +#### Date: January 31 2010 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -3164,7 +3164,7 @@ get_repo_data() eval $LOGFS local repo_file='' repo_data_working='' local apt_file='/etc/apt/sources.list' yum_repo_dir='/etc/yum.repos.d/' yum_conf='/etc/yum.conf' - local pacman_conf='/etc/pacman.conf' pacman_repo_dir='/etc/pacman.d/' + local pacman_conf='/etc/pacman.conf' pacman_repo_dir='/etc/pacman.d/' pisi_dir='/etc/pisi/' if [[ -f $apt_file || -d $apt_file.d ]];then REPO_DATA="$( grep -Esv '(^[[:space:]]*$|^[[:space:]]*#)' $apt_file $apt_file.d/*.list )" @@ -3239,14 +3239,33 @@ $repo_data_working" fi done REPO_FILE_ID='yum repos' - # note that pacman/arch mirrorlist file has all the mirrors on it, so it - # won't work for this feature, the output would be largely meaningless, and far too long + elif [[ -d $pisi_dir && -n $( type -p pisi ) ]];then + REPO_DATA="$( pisi list-repo )" + REPO_FILE_ID='pisi repo' + # now we need to create the structure: repo info: repo path + # we do that by looping through the lines of the output and then + # putting it back into the : format print repos expects to see + while read line + do + # dump empty lines... + line=$( sed 's|^[[:space:]]$||g' <<< $line ) + if [[ -n $( grep '://' <<< $line ) ]];then + repo_data_working="$repo_data_working:$line\n" + else + repo_data_working="$repo_data_working$line" + fi + done <<< "$REPO_DATA" + # echo and execute the line breaks inserted + REPO_DATA="$( echo -e $repo_data_working )" + # note that pacman/arch mirrorlist file has all the mirrors on it, so it + # won't work for this feature, the output would be largely meaningless, and far too long # elif [[ -f $pacman_file || -d $pacman_repo_dir ]];then -# REPO_FILE_ID='yum repos' +# REPO_FILE_ID='arch repos' fi eval $LOGFE } + get_runlevel_data() { eval $LOGFS @@ -4588,7 +4607,7 @@ print_partition_data() print_repo_data() { local repo_count=0 repo_line='' file_name='' file_content='' file_name_holder='' - local repo_full='' b_print_next_line='false' + local repo_full='' b_print_next_line='false' get_repo_data @@ -4609,7 +4628,11 @@ print_repo_data() fi # check file name, if different, update the holder for print out if [[ $file_name != $file_name_holder ]];then - repo_full="${C1}Active $REPO_FILE_ID in file:${C2} $file_name" + if [[ $REPO_FILE_ID != 'pisi repo' ]];then + repo_full="${C1}Active $REPO_FILE_ID in file:${C2} $file_name" + else + repo_full="${C1}$REPO_FILE_ID:${C2} $file_name" + fi file_name_holder=$file_name b_print_next_line='true' else