]> git.ipfire.org Git - thirdparty/squid.git/blob - mksnapshot-cron.sh
Merged from trunk
[thirdparty/squid.git] / mksnapshot-cron.sh
1 #!/bin/sh -e
2 echo "RUN: $0"
3 # Nightly cron job to generate snapshot releases
4 top=${PWD}
5 versions=/server/httpd/htdocs/squid-cache.org/content/Versions/
6 TMPDIR=/home/squidadm/${LOGNAME}.cron
7 export TMPDIR
8 if [ -d ${TMPDIR} ]; then
9 chmod -R +w ${TMPDIR}
10 rm -rf ${TMPDIR}
11 fi
12 mkdir -p ${TMPDIR}
13 trap "echo FAIL-BUILD_snapshot-cron; cd /; chmod -R +w ${TMPDIR}; rm -rf ${TMPDIR}" 0
14
15 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
16 export PATH
17
18 # Be nice to our friends. This is a batch job
19 renice 10 $$ >/dev/null
20
21 make_snapshot()
22 { {
23 set -e
24 cd ../release
25 mksnap=${1}
26 branch=${2}
27 dir=${3}
28 ver=${4}
29 save=${5:-3}
30 dst=${versions}/${dir}/${ver}
31 out=${6:-`basename $branch`}
32 $mksnap ${branch} ${6} 2>&1 | grep -v "set owner/group"
33 for file in `cat ${out}.out` ; do
34 case ${file} in
35 *-cfgman.tar.gz)
36 type=-cfgman.tar.gz
37 ;;
38 *-langpack.tar.gz)
39 type=-langpack.tar.gz
40 ;;
41 *-manuals.tar.gz)
42 type=-manuals.tar.gz
43 ;;
44 *)
45 type=`echo ${file} | sed -e 's/.*\.tar\.gz/.tar.gz/' -e 's/.*\.tar\.bz2/.tar.bz2/' -e 's/.*\.patch/.patch/' -e 's/.*\.diff/.diff/' -e 's/.*-RELEASENOTES.html/-RELEASENOTES.html/' -e 's/^.*ChangeLog.txt$/-ChangeLog.txt/' -e 's/.*-cfgman/-cfgman/'`
46 esac
47
48 # move tarball
49 rm -f ${dst}/${file}.md5
50 rm -f ${dst}/${file}
51 md5 ${file} >${dst}/${file}.md5
52 cp -p ${file} ${dst}/${file}
53 rm -f ${file}
54
55 # update snapshot symlink
56 rm -f ${dst}/squid-${ver}.snapshot$type
57 ln -s ${file} ${dst}/squid-${ver}.snapshot${type}
58 rm -f ${dst}/squid-${ver}.snapshot${type}.md5
59 ln -s ${file}.md5 ${dst}/squid-${ver}.snapshot${type}.md5
60
61 set +e
62 # cleanup old snapshots
63 ls ${dst}/*-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-r*[0-9]${type} | \
64 # sed -e 's/.*-\([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-r[0-9]+'${type}'\)/\1/' | \
65 sort -r | tail +${save} | \
66 while read f; do
67 rm -f ${f} ${f}.md5
68 done
69 set -e
70
71 # update dynamic index pages Last-Modified info
72 touch ${dst}/index.dyn
73
74 # Special cases
75 case ${file} in
76 *-cfgman.tar.gz)
77 mkdir -p ${dst}/cfgman
78 tar -C ${dst}/cfgman -zxf ${dst}/${file}
79 ;;
80 *-cfgman.html)
81 rm -f ${dst}/cfgman.html
82 ln -s ${dst}/${file} ${dst}/cfgman.html
83 ;;
84 *-cfgman.html.gz)
85 rm -f ${dst}/cfgman.html.gz
86 ln -s ${dst}/${file} ${dst}/cfgman.html.gz
87 ;;
88 *-manuals.tar.gz)
89 mkdir -p ${dst}/manuals
90 tar -C ${dst}/manuals -zxf ${dst}/${file}
91 ;;
92 esac
93 done
94 } }
95
96 set +e
97
98 # autotool derived files not kept in trunk, but still need to bootstrap for make dist
99 ../commit/bootstrap squid-3
100 make_snapshot ../commit/squid-3/mksnapshot.sh trunk v3 3.HEAD 6
101
102 rm -f /server/httpd/htdocs/squid-cache.org/CONTRIBUTORS.new
103 cp ../commit/squid-3/CONTRIBUTORS /server/httpd/htdocs/squid-cache.org/CONTRIBUTORS.new
104 chmod 444 /server/httpd/htdocs/squid-cache.org/CONTRIBUTORS.new
105 mv -f /server/httpd/htdocs/squid-cache.org/CONTRIBUTORS.new /server/httpd/htdocs/squid-cache.org/content/CONTRIBUTORS.txt
106
107 rm -f /server/httpd/htdocs/squid-cache.org/SPONSORS.new
108 cp ../commit/squid-3/SPONSORS /server/httpd/htdocs/squid-cache.org/SPONSORS.new
109 chmod 444 /server/httpd/htdocs/squid-cache.org/SPONSORS.new
110 mv -f /server/httpd/htdocs/squid-cache.org/SPONSORS.new /server/httpd/htdocs/squid-cache.org/content/SPONSORS.txt
111
112 ../commit/bootstrap squid-3.4
113 make_snapshot ../commit/squid-3/mksnapshot.sh 3.4 v3 3.4 30
114
115 ../commit/bootstrap squid-3.3
116 make_snapshot ../commit/squid-3/mksnapshot.sh 3.3 v3 3.3 30
117
118 #../commit/bootstrap squid-3.2
119 #make_snapshot ../commit/squid-3/mksnapshot.sh branches/SQUID_3_2 v3 3.2 30
120
121 #../commit/bootstrap squid-3.1
122 #make_snapshot ../commit/squid-3/mksnapshot.sh branches/SQUID_3_1 v3 3.1 30
123
124 #../commit/bootstrap squid-3.0
125 #make_snapshot ../commit/squid-3/mksnapshot.sh branches/SQUID_3_0 v3 3.0 3
126
127 #../commit/bootstrap squid-2
128 #make_snapshot ../commit/squid-2/mksnapshot.sh HEAD v2 HEAD 3
129
130 #../commit/bootstrap squid-2.7
131 #make_snapshot ../commit/squid-2.7/mksnapshot.sh SQUID_2_7 v2 2.7 3
132
133 #../commit/bootstrap squid-2.6
134 #make_snapshot ../commit/squid-2.6/mksnapshot.sh SQUID_2_6 v2 2.6 3
135
136 #../commit/bootstrap squid-2.5
137 #make_snapshot ../commit/squid-2.5/mksnapshot.sh SQUID_2_5 v2 2.5 3
138
139 #../commit/squid3-SQUID2.sync