Project

General

Profile

Sites mirrors » History » Version 1

sacha, 12/10/2018 11:21 AM

1 1 sacha
# Sites mirrors
2
3
## OpenBSD
4
5
Scripts Irisa:
6
7
pandore|11:04:27|:~/Downloads/mirror$cat cvs-update-src.sh
8
9
~~~
10
#!/bin/bash
11
set -o nounset   # Treat unset variables as an error when performing parameter expansion and exits with a non-zero status.
12
13
rm -f ~/log.cvsup
14
touch ~/log.cvsup
15
echo "started at" `date +%H:%M:%S` >> ~/log.cvsup
16
17
# Pour plus de clarte/simplicite remplacement du "cd ftp/src"
18
# Le "ftp" etant un lien symbolique vers le "bon" espace
19
# cd ftp/src
20
REP="/home/ftp/pub/mirrors/OpenBSD/src"
21
if [ ! -d "${REP}" ] ;then echo "Erreur - Repertoire ""${REP}"" inexistant" >> ~/log.rsync; exit 1; fi
22
cd ${REP}
23
24
25
#
26
#
27
#
28
#export CVSROOT=anoncvs@anoncvs.ca.openbsd.org:/cvs
29
export CVSROOT=anoncvs@anoncvs.eu.openbsd.org:/cvs
30
#export CVSROOT=anoncvs@anoncvs.comstyle.com:/cvs
31
CVS_RSH="/usr/bin/ssh" cvs -d ${CVSROOT} -q update -AdP >> ~/log.cvsup 2>&1
32
chmod -R o+rX ${REP}
33
echo "ended at" `date +%H:%M:%S` >> ~/log.cvsup
34
35
cat ~/log.cvsup | mail -s "[ftp] cvs-update" your.email@domain.ext your.other.email@domain.ext
36
~~~
37
38
pandore|11:05:46|:~/Downloads/mirror$cat mirror.sh
39
40
~~~                             
41
#!/bin/bash
42
set -o nounset   # Treat unset variables as an error when performing parameter expansion and exits with a non-zero status.
43
 
44
# 
45
# Il y a deja un rsync qui "tourne" on n'en lance pas un nouveau
46
#
47
pgrep -u `id -u` rsync > /dev/null 2>&1
48
if [ $? = 0 ] ; then exit 0; fi
49
50
rm -f ~/log.rsync
51
touch ~/log.rsync
52
echo "started at" `date +%H:%M:%S` >> ~/log.rsync
53
54
# Pour plus de clarte/simplicite remplacement du "cd ftp"
55
# Ce "ftp" etant un lien symbolique vers le "bon" espace
56
# En plus c'est un peu plus "sure" dans le contexte d'un "rsync ... --delete ...." 
57
REP="/home/ftp/pub/mirrors/OpenBSD"
58
if [ ! -d "${REP}" ] ;then echo "Erreur - Repertoire ""${REP}"" inexistant" >> ~/log.rsync; exit 1; fi
59
60
#MIRROR=rsync://ftp.belnet.be/packages/openbsd/
61
#MIRROR=rsync://anga.funkfeuer.at/OpenBSD/
62
#MIRROR=rsync://rsync.it.su.se/OpenBSD/
63
#MIRROR=rsync://ftp.openbsd.dk/OpenBSD/
64
#MIRROR=rsync://rsync.de.openbsd.org/OpenBSD
65
MIRROR=rsync://ftp.eu.openbsd.org/OpenBSD/
66
#MIRROR=rsync://ftp.fr.openbsd.org/OpenBSD/
67
68
####################################
69
# identify last version available
70
####################################
71
echo "check for OpenBSD versions availables" >> ~/log.rsync 2>&1
72
major=5
73
minor=1
74
current_version=5.0
75
old_version=4.9
76
version_to_remove=4.8
77
wget --spider --quiet ftp://ftp.eu.openbsd.org/pub/OpenBSD/$major.$minor/
78
result=$?
79
while [ $result -eq 0 ]
80
do
81
  echo "version $major.$minor exits " >> ~/log.rsync 2>&1
82
  version_to_remove=$old_version
83
  old_version=$current_version
84
  current_version=$major.$minor
85
  minor=$(( $minor + 1 ))
86
  if [ $minor -eq 10 ]; then
87
        major=$(( $major + 1 ))
88
        minor=0
89
  fi
90
  wget --spider --quiet ftp://ftp.eu.openbsd.org/pub/OpenBSD/$major.$minor/
91
  result=$?
92
done
93
echo "current version to rsync = $current_version" >> ~/log.rsync 2>&1
94
echo "old version to rsync = $old_version" >> ~/log.rsync 2>&1
95
echo "version to remove if exist= $version_to_remove" >> ~/log.rsync 2>&1
96
97
cd ${REP}
98
99
100
rm -rfv $version_to_remove >> ~/log.rsync 2>&1
101
102
rsync -azv --delete ${MIRROR}/$current_version .       >> ~/log.rsync 2>&1
103
104
rsync -azv --delete ${MIRROR}/OpenBGPD .  >> ~/log.rsync 2>&1
105
rsync -azv --delete ${MIRROR}/OpenNTPD .  >> ~/log.rsync 2>&1
106
rsync -azv --delete ${MIRROR}/OpenSSH .   >> ~/log.rsync 2>&1
107
rsync -azv --delete ${MIRROR}/doc .       >> ~/log.rsync 2>&1
108
rsync -azv --delete ${MIRROR}/patches .   >> ~/log.rsync 2>&1
109
rsync -azv --delete ${MIRROR}/snapshots . >> ~/log.rsync 2>&1
110
rsync -azv --delete ${MIRROR}/timestamp . >> ~/log.rsync 2>&1
111
rsync -azv --delete ${MIRROR}/tools .     >> ~/log.rsync 2>&1
112
rsync -azv --delete ${MIRROR}/$old_version .       >> ~/log.rsync 2>&1
113
114
chmod -R o+rX ${REP}
115
echo "ended" `date +%H:%M:%S` >> ~/log.rsync
116
117
cat ~/log.rsync | mail -s "[ftp] rsync-mirror" your.email@domain.ext your.other.email@domain.ext
118
~~~