Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-admin-essentials
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
etersoft-admin-essentials
Commits
e3141ed2
Commit
e3141ed2
authored
Aug 14, 2016
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
full rewrite rsync script
parent
2b11307f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
112 additions
and
164 deletions
+112
-164
rsync_all.sh
etersoft-cron/rsync_all.sh
+112
-15
rsync_all.sh
etersoft/rsync_all.sh
+0
-149
No files found.
etersoft-cron/rsync_all.sh
100644 → 100755
View file @
e3141ed2
#!/bin/sh
#!/bin/
ba
sh
# 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
...
...
@@ -9,20 +9,49 @@
# Подключаем конфигурационные параметры
#. ./scripts/config.sh
LOGFILE
=
$(
realpath
-e
$0
)
.log
date
>
$LOGFILE
exec
>>
$LOGFILE
# output stdout to file
# print stderr to screen and to file
#exec >> $LOGFILE
#exec 2> >(tee -a $LOGFILE >&2)
get_rsync_path
()
{
local
RSYNCPATH
if
[
"
$1
"
=
"c6/branch"
]
;
then
RSYNCPATH
=
rsync.altlinux.ru::ALTLinux
#elif echo "$1" | grep -q "p8/" ; then
elif
false
;
then
#RSYNCPATH=rsync://ftp.basealt.ru/pub/distributions/ALTLinux
RSYNCPATH
=
rsync://ftp.basealt.ru/ALTLinux
else
RSYNCPATH
=
rsync://mirror.yandex.ru/altlinux
fi
echo
"
$RSYNCPATH
"
}
RPMS
=
/var/ftp/pub/ALTLinux
TIMEOUT
=
5000
LISTARCH
=
"i586 x86_64 x86_64-i586 noarch"
DELETE
=
"--delete-after --delete-excluded"
DELETE
=
"--delete-after --delete-excluded
--max-delete=1000
"
func
()
{
RES
=
"1"
echo
"Start sync from
ALTLinux
/
$1
to
$RPMS
/
$1
"
echo
"Start sync from
$RSYNCPATH
/
$1
to
$RPMS
/
$1
"
#until [ $RES = "20" -o $RES = "0" ]
#do
rsync
$DELETE
--fuzzy
--partial
--timeout
=
200
--progress
--stats
-vbrlt
--copy-links
\
--exclude
"*SRPMS*"
\
rsync.altlinux.ru::ALTLinux/
$1
/
$RPMS
/
$1
/
# sync only if main dir is exist
test
-d
"
$RPMS
/
${
1
/\/*/
}
"
||
return
0
mkdir
-p
$RPMS
/
$1
/
rsync
$DELETE
--fuzzy
--partial
--inplace
--timeout
=
$TIMEOUT
--progress
--stats
-vrlt
--copy-links
\
--exclude
"*SRPMS*"
$2
\
$RSYNCPATH
/
$1
/
$RPMS
/
$1
/
RES
=
$?
echo
"rsync exit:
$RES
"
#done
...
...
@@ -31,24 +60,92 @@ return $RES
cd
$RPMS
/
||
exit
1
sync_file
()
{
RSYNCPATH
=
$(
get_rsync_path
$1
)
echo
echo
"Start sync from
$RSYNCPATH
/
$1
to
$RPMS
/
$1
"
rsync
$DELETE
--fuzzy
--partial
--timeout
=
$TIMEOUT
--progress
--stats
-vrlt
--copy-links
\
--exclude
"*SRPMS*"
\
$RSYNCPATH
/
$1
$RPMS
/
$1
}
sync_branches
()
{
RSYNCPATH
=
$(
get_rsync_path
$1
)
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
}
sync_other
()
{
RES
=
"1"
RSYNCPATH
=
$(
get_rsync_path
$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
\
--exclude
"*SRPMS*"
$2
\
$RSYNCPATH
/
$1
/
$RPMS
/
$1
/
RES
=
$?
echo
"rsync exit:
$RES
"
#done
return
$RES
}
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
echo
"
$1
"
|
grep
-q
branch
;
then
sync_branches
$1
exit
elif
[
-n
"
$1
"
]
;
then
sync_other
$1
exit
fi
# we do not update 5.0
for
i
in
4.0 4.1 5.1 p5 p6 t6
;
do
#for i in 4.0 4.1 p5 p6 c6 t6 p7 t7; do
for
i
in
p5 p6 p7 p8
;
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
func
$i
/branch/i586
func
$i
/branch/x86_64
#func Sisyphus/x86_32
func
$i
/branch/noarch
sync_branches
$i
/branch
done
sync_other p8/images
for
i
in
Sisyphus
;
do
# FIXME: cert6/x86_32?
sync_branches
$i
done
func Sisyphus/i586
func Sisyphus/x86_64
#func Sisyphus/x86_32
func Sisyphus/noarch
date
>
$LOGFILE
# for update x86_32
#$RPMS/arepo.sh > $RPMS/arepo.log
etersoft/rsync_all.sh
deleted
100755 → 0
View file @
2b11307f
#!/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)
get_rsync_path
()
{
local
RSYNCPATH
if
[
"
$1
"
=
"c6/branch"
]
;
then
RSYNCPATH
=
rsync.altlinux.ru::ALTLinux
#elif echo "$1" | grep -q "p8/" ; then
elif
false
;
then
#RSYNCPATH=rsync://ftp.basealt.ru/pub/distributions/ALTLinux
RSYNCPATH
=
rsync://ftp.basealt.ru/ALTLinux
else
RSYNCPATH
=
rsync://mirror.yandex.ru/altlinux
fi
echo
"
$RSYNCPATH
"
}
RPMS
=
/var/ftp/pub/ALTLinux
TIMEOUT
=
5000
LISTARCH
=
"i586 x86_64 x86_64-i586 noarch"
DELETE
=
"--delete-after --delete-excluded --max-delete=1000"
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
--inplace
--timeout
=
$TIMEOUT
--progress
--stats
-vrlt
--copy-links
\
--exclude
"*SRPMS*"
$2
\
$RSYNCPATH
/
$1
/
$RPMS
/
$1
/
RES
=
$?
echo
"rsync exit:
$RES
"
#done
return
$RES
}
cd
$RPMS
/
||
exit
1
sync_file
()
{
RSYNCPATH
=
$(
get_rsync_path
$1
)
echo
echo
"Start sync from
$RSYNCPATH
/
$1
to
$RPMS
/
$1
"
rsync
$DELETE
--fuzzy
--partial
--timeout
=
$TIMEOUT
--progress
--stats
-vrlt
--copy-links
\
--exclude
"*SRPMS*"
\
$RSYNCPATH
/
$1
$RPMS
/
$1
}
sync_branches
()
{
RSYNCPATH
=
$(
get_rsync_path
$1
)
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
}
sync_other
()
{
RES
=
"1"
RSYNCPATH
=
$(
get_rsync_path
$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
\
--exclude
"*SRPMS*"
$2
\
$RSYNCPATH
/
$1
/
$RPMS
/
$1
/
RES
=
$?
echo
"rsync exit:
$RES
"
#done
return
$RES
}
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
echo
"
$1
"
|
grep
-q
branch
;
then
sync_branches
$1
exit
elif
[
-n
"
$1
"
]
;
then
sync_other
$1
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 p8
;
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
sync_other p8/images
for
i
in
Sisyphus
;
do
# FIXME: cert6/x86_32?
sync_branches
$i
done
# for update x86_32
#$RPMS/arepo.sh > $RPMS/arepo.log
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment