-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcronjob.sh
executable file
·133 lines (112 loc) · 2.82 KB
/
cronjob.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/sh -e
WWW=/var/www
SRC=/var/www/wingrass
DST=/osgeo/download/osgeo4w
rsync_grass() {
# for p in x86 x86_64; do
for p in x86_64; do
rsync -avg --delete --delete-excluded \
${SRC}/grass${1}/${p}/osgeo4w/ \
martinl@upload.osgeo.org:$DST/${p}/release/grass/grass$2
done
}
rm_7() {
for p in x86_64; do
for f in `find $SRC/grass$1/${p}/WinGRASS* -mtime +7`; do
rm -rfv $f
done
for f in `find $SRC/grass$1/${p}/osgeo4w/grass*.tar.bz2 -mtime +7`; do
rm -rfv $f
done
done
}
update_setup() {
for p in x86_64; do
(cd ${HOME}/src/grass$1 && git pull && cd mswindows/osgeo4w && make)
file=${HOME}/src/grass$1/mswindows/osgeo4w/setup_${p}.hint
pattern=${SRC}/grass$1/${p}/osgeo4w/*[0-9].tar.bz2
curr=`ls -t -w1 $pattern | head -n1 | cut -d'-' -f4,5 | cut -d'.' -f1`
prev=`ls -t -w1 $pattern | head -n2 | tail -n1 | cut -d'-' -f4,5 | cut -d'.' -f1`
version=`grep curr $file | cut -d':' -f2 | cut -d'-' -f1 | tr -d ' '`
echo $curr $prev $version
sed -e "s/curr:.*/curr: ${version}-$curr/" \
-e "s/prev:.*/prev: ${version}-$prev/" $file > \
${SRC}/grass$1/${p}/osgeo4w/setup.hint
done
}
addons_index() {
cd ${SRC}/grass$1
for p in x86_64; do
cd ${p}/addons
for d in $(find . -mindepth 1 -maxdepth 1 -type d) ; do
cd $d/logs
if [ -f "summary.html" ] ; then
ln -sf summary.html index.html
fi
cd ../..
done
if [ "$1" = "70" ] || [ "$1" = "72" ] || [ "$1" = "74" ] || [ "$1" = "76" ] || [ "$1" = "78" ]; then
# create symlink to latest version
cd ${SRC}/grass$1/${p}/addons
rm -f latest
# remove RC builds when release is available
for rc in `ls -d grass-*RC[0-9] 2>/dev/null`; do
file=`echo $rc | sed 's/RC[0-9]//g'`
if [ -d $file ] ; then
echo "Removing $rc..."
rm -rf $rc
fi
done
latest_version=`ls -w1 | sort -r | head -n2 | tail -n1`
echo "Latest version (grass-${1}/${p}): $latest_version"
ln -sf $latest_version latest
fi
cd ../..
done
}
report() {
VERSION=$1
cd ${SRC}/grass${VERSION}
for p in x86_64; do
cd ${p}/logs
last_log=`ls -t -w1 . | head -n1`
if [ -d $last_log ] ; then
cat $last_log/error.log 1>&2
fi
cd ../..
done
}
download_unzip() {
wget -q http://147.32.131.147/wingrass/wingrass.zip
unzip -o -q wingrass.zip
rm wingrass.zip
}
# geo103 (win) -> geo101
cd $WWW/wingrass
download_unzip
# summary.html -> index.html
### addons_index 64
# addons_index 70
# addons_index 72
# addons_index 74
addons_index 76
addons_index 78
addons_index 80
addons_index 82
# remove old packages (daily builds only)
rm_7 76
rm_7 78
rm_7 80
rm_7 82
# update setup.ini
update_setup 82
# geo101 -> upload.osgeo.org
rsync_grass 82 -daily
# promote changes
~/wingrass-maintenance-scripts/osgeo4w-promote.sh
# report 74
report 76
report 78
report 80
report 82
exit 0