Commit 1e517490 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-sh-altlinux-contents-index: improve content_index list informativity

parent d717e2d9
......@@ -98,21 +98,22 @@ __init_contents_index_list()
truncate -s0 $ALT_CONTENTS_INDEX_LIST
}
# "comment" "file"
__add_to_contents_index_list()
{
echo " $1"
echo "$1" >>$ALT_CONTENTS_INDEX_LIST
echo " $1 -> $2"
echo "$2" >>$ALT_CONTENTS_INDEX_LIST
}
# file file2
# "comment" file file2
__add_better_to_contents_index_list()
{
if [ -s "$1" ] && [ -s "$2" ] ; then
[ "$1" -ot "$2" ] && __add_to_contents_index_list "$2" && return
__add_to_contents_index_list "$1" && return
if [ -s "$2" ] && [ -s "$3" ] ; then
[ "$2" -ot "$3" ] && __add_to_contents_index_list "$1" "$3" && return
__add_to_contents_index_list "$1" "$2" && return
fi
[ -s "$1" ] && __add_to_contents_index_list "$1" && return
[ -s "$2" ] && __add_to_contents_index_list "$2" && return
[ -s "$2" ] && __add_to_contents_index_list "$1" "$2" && return
[ -s "$3" ] && __add_to_contents_index_list "$1" "$3" && return
}
......@@ -131,19 +132,19 @@ update_alt_contents_index()
# first check for local mirror
local LOCALPATH="$(echo "$URL/base")"
local LOCALPATHGZIP="$(echo "$LOCALPATH" | sed -e "s|/ALTLinux/|/ALTLinux/contents_index/|")"
__add_better_to_contents_index_list "$LOCALPATHGZIP/contents_index.gz" "$LOCALPATH/contents_index"
__add_better_to_contents_index_list "$URL" "$LOCALPATHGZIP/contents_index.gz" "$LOCALPATH/contents_index"
else
local LOCALPATH="$(get_local_alt_mirror_path "$URL")"
local REMOTEURL="$(get_url_to_etersoft_mirror "$URL")"
if [ -n "$REMOTEURL" ] ; then
rsync_alt_contents_index $REMOTEURL/base/contents_index.gz $LOCALPATH/contents_index.gz && __add_to_contents_index_list "$LOCALPATH/contents_index.gz" && continue
rsync_alt_contents_index $REMOTEURL/base/contents_index.gz $LOCALPATH/contents_index.gz && __add_to_contents_index_list "$REMOTEURL" "$LOCALPATH/contents_index.gz" && continue
[ -n "$verbose" ] && info "Note: Can't retrieve $REMOTEURL/base/contents_index.gz, fallback to $URL/base/contents_index"
fi
# fix rsync URL firstly
local RSYNCURL="$(echo "$URL" | sed -e "s|rsync://\(ftp.basealt.ru\|basealt.org\|altlinux.ru\)/pub/distributions/ALTLinux|rsync://\1/ALTLinux|")" #"
rsync_alt_contents_index $RSYNCURL/base/contents_index $LOCALPATH/contents_index && __add_to_contents_index_list "$LOCALPATH/contents_index" && continue
rsync_alt_contents_index $RSYNCURL/base/contents_index $LOCALPATH/contents_index && __add_to_contents_index_list "$RSYNCURL" "$LOCALPATH/contents_index" && continue
__add_better_to_contents_index_list "$LOCALPATH/contents_index.gz" "$LOCALPATH/contents_index"
__add_better_to_contents_index_list "(cached)" "$LOCALPATH/contents_index.gz" "$LOCALPATH/contents_index"
fi
done
if [ ! -s "$ALT_CONTENTS_INDEX_LIST" ] ; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment