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
This commit is contained in:
inxi-svn 2010-02-01 02:52:30 +00:00
parent 53bbf03cea
commit e253aa3028

37
inxi
View file

@ -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 <data>:<url> 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
@ -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