]> git.ipfire.org Git - thirdparty/squid.git/blob - mksnapshot-cron.sh
Adjust snapshot paths to be consistent
[thirdparty/squid.git] / mksnapshot-cron.sh
1 #!/bin/sh -e
2 # Nightly cron job to generate snapshot releases
3 top=$PWD
4 versions=/server/httpd/htdocs/squid-cache.org/Versions/
5 TMPDIR=/tmp/hno.cron
6 export TMPDIR
7 if [ -d $TMPDIR ]; then
8 chmod -R +w $TMPDIR
9 rm -rf $TMPDIR
10 fi
11 mkdir -p $TMPDIR
12 trap "cd /; chmod -R +w $TMPDIR; rm -rf $TMPDIR" 0
13
14 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
15 export PATH
16
17 # Be nice to our friends. This is a batch job
18 renice 10 $$ >/dev/null
19
20 make_snapshot()
21 { {
22 set -e
23 cd ../release
24 mksnap=$1
25 tag=$2
26 dir=$3
27 ver=$4
28 save=${5:-3}
29 dst=$versions/$dir/$ver
30 $mksnap $tag 2>&1 | grep -v "set owner/group"
31 for file in `cat $tag.out` ; do
32 case $file in
33 *-cfgman.tar.gz)
34 type=-cfgman.tar.gz
35 ;;
36 *)
37 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/'`
38 esac
39
40 # move tarball
41 rm -f $dst/$file.md5
42 rm -f $dst/$file
43 md5 $file >$dst/$file.md5
44 cp -p $file $dst/$file
45 rm -f $file
46
47 # update snapshot symlink
48 rm -f $dst/squid-$ver.snapshot$type
49 ln -s $file $dst/squid-$ver.snapshot$type
50 rm -f $dst/squid-$ver.snapshot$type.md5
51 ln -s $file $dst/squid-$ver.snapshot$type.md5
52
53 # cleanup old snapshots
54 ls $dst/*-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$type | sed -e 's/.*-\([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'$type'\)/\1/' | sort -r | tail +$save | while read f; do
55 rm -f $dst/*-$f $dst/*-$f.md5
56 done
57
58 # Special cases
59 case $file in
60 *-cfgman.tar.gz)
61 mkdir -p $dst/cfgman
62 tar -C $dst/cfgman -zxf $dst/$file
63 ;;
64 *-cfgman.html)
65 rm -f $dst/cfgman.html
66 ln -s $dst/$file $dst/cfgman.html
67 ;;
68 *-cfgman.html.gz)
69 rm -f $dst/cfgman.html.gz
70 ln -s $dst/$file $dst/cfgman.html.gz
71 ;;
72 esac
73 done
74
75 # update web page
76 if [ -x $dst/make.sh ]; then
77 $dst/make.sh
78 fi
79
80 } }
81
82 set +e
83
84 ../commit/bootstrap squid
85 make_snapshot ../commit/squid-3/mksnapshot.sh HEAD v3 HEAD 6
86
87 rm -f /server/httpd/htdocs/squid-cache.org/CONTRIBUTORS.new
88 cp ../commit/squid-3/CONTRIBUTORS /server/httpd/htdocs/squid-cache.org/CONTRIBUTORS.new
89 chmod 444 /server/httpd/htdocs/squid-cache.org/CONTRIBUTORS.new
90 mv -f /server/httpd/htdocs/squid-cache.org/CONTRIBUTORS.new /server/httpd/htdocs/squid-cache.org/CONTRIBUTORS.txt
91
92 rm -f /server/httpd/htdocs/squid-cache.org/SPONSORS.new
93 cp ../commit/squid-3/SPONSORS /server/httpd/htdocs/squid-cache.org/SPONSORS.new
94 chmod 444 /server/httpd/htdocs/squid-cache.org/SPONSORS.new
95 mv -f /server/httpd/htdocs/squid-cache.org/SPONSORS.new /server/httpd/htdocs/squid-cache.org/SPONSORS.txt
96
97 ../commit/bootstrap squid-3.0
98 make_snapshot ../commit/squid-3.0/mksnapshot.sh SQUID_3_0 v3 3.0 3
99
100 ../commit/bootstrap squid-2
101 make_snapshot ../commit/squid-2/mksnapshot.sh HEAD v2 HEAD 3
102
103 ../commit/bootstrap squid-2.7
104 make_snapshot ../commit/squid-2.7/mksnapshot.sh SQUID_2_7 v2 2.7 3
105
106 ../commit/bootstrap squid-2.6
107 make_snapshot ../commit/squid-2.6/mksnapshot.sh SQUID_2_6 v2 2.6 3
108
109 #../commit/bootstrap squid-2.5
110 #make_snapshot ../commit/squid-2.5/mksnapshot.sh SQUID_2_5 v2 2.5 3
111
112 #../commit/squid3-SQUID2.sync