Commit 7b629165 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add rsync_all

parent c9cd16b7
#!/bin/bash
# Written by Lav (c) 2001, 2002, 2003, 2004, 2008
# Vitaly Lipatov <lav@etersoft.ru>
# 24.12.01, 16.11.03, 30.12.03, 17.12.04
# Обновление Сизифа
# Анализировать код возврата rsync, и если вышел не по ошибке, а все закачал, то запускать с
# Углубленным списком.
# Подключаем конфигурационные параметры
#. ./scripts/config.sh
LOGFILE=$(realpath -e $0).log
date > $LOGFILE
#exec > >(tee -a $LOGFILE)
# output stdout to file
# print stderr to screen and to file
exec >> $LOGFILE
exec 2> >(tee -a $LOGFILE >&2)
if [ "$1" = "c6" ] ; then
RSYNCPATH=rsync.altlinux.ru::ALTLinux
else
RSYNCPATH=rsync://mirror.yandex.ru/altlinux
fi
RPMS=/var/ftp/pub/ALTLinux
TIMEOUT=5000
LISTARCH="i586 x86_64 x86_64-i586 noarch"
DELETE="--delete-after --delete-excluded"
func()
{
RES="1"
echo "Start sync from $RSYNCPATH/$1 to $RPMS/$1"
#until [ $RES = "20" -o $RES = "0" ]
#do
# sync only if main dir is exist
test -d "$RPMS/${1/\/*/}" || return 0
mkdir -p $RPMS/$1/
rsync $DELETE --fuzzy --partial --timeout=$TIMEOUT --progress --stats -vbrlt --copy-links \
--exclude "*SRPMS*" $2 \
$RSYNCPATH/$1/ $RPMS/$1/
RES=$?
echo "rsync exit: $RES"
#done
return $RES
}
cd $RPMS/ || exit 1
sync_file()
{
echo
echo "Start sync from $RSYNCPATH/$1 to $RPMS/$1"
rsync $DELETE --fuzzy --partial --timeout=$TIMEOUT --progress --stats -vbrlt --copy-links \
--exclude "*SRPMS*" \
$RSYNCPATH/$1 $RPMS/$1
}
sync_branches()
{
local i
if [ -n "$BASEONLY" ] ; then
for i in $LISTARCH; do
func $1/$i/base --checksum
done
return
fi
for i in $LISTARCH; do
func $1/$i
done
}
if [ "$1" = "base" ] ; then
BASEONLY=1
shift
fi
if [ "$1" = "Sisyphus" ] ; then
sync_branches $1
exit
elif [ "$1" = "--file" ] ; then
shift
sync_file $1
exit
elif [ -n "$1" ] ; then
sync_branches $1/branch
exit
fi
# we do not update 5.0
#for i in 4.0 4.1 p5 p6 c6 t6 p7 t7; do
for i in p5 p6 t6 p7 t7; do
# move branches
#mkdir $i/branch/ || continue
#for a in i586 x86_64 x86_32 noarch ; do
# mv $i/$a $i/branch/ || exit
# ln -s branch/$a $i/$a || exit
#done
sync_branches $i/branch
done
for i in Sisyphus ; do
# FIXME: cert6/x86_32?
sync_branches $i
done
# for update x86_32
#$RPMS/arepo.sh > $RPMS/arepo.log
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