#!/bin/sh -e
# Nightly cron job to generate snapshot releases
-top=$PWD
+top=${PWD}
versions=/server/httpd/htdocs/squid-cache.org/content/Versions/
-TMPDIR=/home/squidadm/$LOGNAME.cron
+TMPDIR=/home/squidadm/${LOGNAME}.cron
export TMPDIR
-if [ -d $TMPDIR ]; then
- chmod -R +w $TMPDIR
- rm -rf $TMPDIR
+if [ -d ${TMPDIR} ]; then
+ chmod -R +w ${TMPDIR}
+ rm -rf ${TMPDIR}
fi
-mkdir -p $TMPDIR
-trap "cd /; chmod -R +w $TMPDIR; rm -rf $TMPDIR" 0
+mkdir -p ${TMPDIR}
+trap "echo FAIL-BUILD; cd /; chmod -R +w ${TMPDIR}; rm -rf ${TMPDIR}" 0
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
export PATH
{ {
set -e
cd ../release
- mksnap=$1
- branch=$2
- dir=$3
- ver=$4
+ mksnap=${1}
+ branch=${2}
+ dir=${3}
+ ver=${4}
save=${5:-3}
- dst=$versions/$dir/$ver
+ dst=${versions}/${dir}/${ver}
out=${6:-`basename $branch`}
- $mksnap $branch $6 2>&1 | grep -v "set owner/group"
- for file in `cat $out.out` ; do
- case $file in
+ $mksnap ${branch} ${6} 2>&1 | grep -v "set owner/group"
+ for file in `cat ${out}.out` ; do
+ case ${file} in
*-cfgman.tar.gz)
type=-cfgman.tar.gz
;;
type=-manuals.tar.gz
;;
*)
- 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/'`
+ 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/'`
esac
# move tarball
- rm -f $dst/$file.md5
- rm -f $dst/$file
- md5 $file >$dst/$file.md5
- cp -p $file $dst/$file
- rm -f $file
+ rm -f ${dst}/${file}.md5
+ rm -f ${dst}/${file}
+ md5 ${file} >${dst}/${file}.md5
+ cp -p ${file} ${dst}/${file}
+ rm -f ${file}
# update snapshot symlink
- rm -f $dst/squid-$ver.snapshot$type
- ln -s $file $dst/squid-$ver.snapshot$type
- rm -f $dst/squid-$ver.snapshot$type.md5
- ln -s $file.md5 $dst/squid-$ver.snapshot$type.md5
+ rm -f ${dst}/squid-${ver}.snapshot$type
+ ln -s ${file} ${dst}/squid-${ver}.snapshot${type}
+ rm -f ${dst}/squid-${ver}.snapshot${type}.md5
+ ln -s ${file}.md5 ${dst}/squid-${ver}.snapshot${type}.md5
# cleanup old snapshots
- 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
- rm -f $dst/*-$f $dst/*-$f.md5
+ 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
+ rm -f ${dst}/*-${f} ${dst}/*-${f}.md5
done
# Special cases
- case $file in
+ case ${file} in
*-cfgman.tar.gz)
- mkdir -p $dst/cfgman
- tar -C $dst/cfgman -zxf $dst/$file
+ mkdir -p ${dst}/cfgman
+ tar -C ${dst}/cfgman -zxf ${dst}/${file}
;;
*-cfgman.html)
- rm -f $dst/cfgman.html
- ln -s $dst/$file $dst/cfgman.html
+ rm -f ${dst}/cfgman.html
+ ln -s ${dst}/${file} ${dst}/cfgman.html
;;
*-cfgman.html.gz)
- rm -f $dst/cfgman.html.gz
- ln -s $dst/$file $dst/cfgman.html.gz
+ rm -f ${dst}/cfgman.html.gz
+ ln -s ${dst}/${file} ${dst}/cfgman.html.gz
;;
*-manuals.tar.gz)
- mkdir -p $dst/manuals
- tar -C $dst/manuals -zxf $dst/$file
+ mkdir -p ${dst}/manuals
+ tar -C ${dst}/manuals -zxf ${dst}/${file}
;;
esac
done
# update web page
- if [ -x $dst/make.sh ]; then
- $dst/make.sh
+ if [ -x ${dst}/make.sh ]; then
+ ${dst}/make.sh
fi
} }
# name so we strip that.
branchpath=${1:-trunk}
tag=${2:-`basename $branchpath`}
-startdir=$PWD
+startdir=${PWD}
date=`env TZ=GMT date +%Y%m%d`
tmpdir=${TMPDIR:-${PWD}}/${module}-${tag}-mksnapshot
-rm -rf $tmpdir
-trap "rm -rf $tmpdir" 0
+rm -rf ${tmpdir}
+trap "rm -rf ${tmpdir}" 0
rm -f ${tag}.out
-bzr export $tmpdir $BZRROOT/$module/$branchpath || exit 1
-if [ ! -f $tmpdir/configure ] && [ -f $tmpdir/configure.in ]; then
- sh -c "cd $tmpdir && ./bootstrap.sh"
+bzr export ${tmpdir} ${BZRROOT}/${module}/${branchpath} || exit 1
+if [ ! -f ${tmpdir}/configure ] && [ -f{ $tmpdir}/configure.in ]; then
+ sh -c "cd ${tmpdir} && ./bootstrap.sh"
fi
-if [ ! -f $tmpdir/configure ]; then
- echo "ERROR! Tag $tag not found in $module"
+if [ ! -f ${tmpdir}/configure ]; then
+ echo "ERROR! Tag ${tag} not found in ${module}"
fi
-cd $tmpdir
+cd ${tmpdir}
eval `grep "^ *PACKAGE_VERSION=" configure | sed -e 's/-BZR//' | sed -e 's/PACKAGE_//'`
eval `grep "^ *PACKAGE_TARNAME=" configure | sed -e 's/_TARNAME//'`
ed -s configure.in <<EOS
make -s dist-all
webbase=/server/httpd/htdocs/squid-cache.org/content/
-basetarball=${webbase}/Versions/v`echo $VERSION | cut -d. -f1`/`echo $VERSION | cut -d. -f-2|cut -d- -f1`/${PACKAGE}-${VERSION}.tar.bz2
+basetarball=${webbase}/Versions/v`echo ${VERSION} | cut -d. -f1`/`echo ${VERSION} | cut -d. -f-2|cut -d- -f1`/${PACKAGE}-${VERSION}.tar.bz2
echo "Building Tarball diff (${basetarball}) ..."
-if [ -f $basetarball ]; then
+if [ -f ${basetarball} ]; then
tar jxf ${PACKAGE}-${VERSION}-${date}.tar.bz2
- tar jxf $basetarball
+ tar jxf ${basetarball}
echo "Differences from ${PACKAGE}-${VERSION} to ${PACKAGE}-${VERSION}-${date}" >${PACKAGE}-${VERSION}-${date}.diff
diff -ruN ${PACKAGE}-${VERSION} ${PACKAGE}-${VERSION}-${date} >>${PACKAGE}-${VERSION}-${date}.diff || true
else
echo "Building Tarball diff ... skipped (no tarball exists)."
fi
-cd $startdir
-echo "Preparing to publish: $tmpdir/${PACKAGE}-${VERSION}-${date}.tar.* ..."
+cd ${startdir}
+echo "Preparing to publish: ${tmpdir}/${PACKAGE}-${VERSION}-${date}.tar.* ..."
#echo "LOCAL: " ; pwd
-#echo "BUILT TARS: " ; ls -1 $tmpdir/*.tar.* || true
+#echo "BUILT TARS: " ; ls -1 ${tmpdir}/*.tar.* || true
-cp -p $tmpdir/${PACKAGE}-${VERSION}-${date}.tar.gz .
+cp -p ${tmpdir}/${PACKAGE}-${VERSION}-${date}.tar.gz .
echo ${PACKAGE}-${VERSION}-${date}.tar.gz >>${tag}.out
-cp -p $tmpdir/${PACKAGE}-${VERSION}-${date}.tar.bz2 .
+cp -p ${tmpdir}/${PACKAGE}-${VERSION}-${date}.tar.bz2 .
echo ${PACKAGE}-${VERSION}-${date}.tar.bz2 >>${tag}.out
-if [ -f $tmpdir/${PACKAGE}-${VERSION}-${date}.diff ]; then
- cp -p $tmpdir/${PACKAGE}-${VERSION}-${date}.diff .
+if [ -f ${tmpdir}/${PACKAGE}-${VERSION}-${date}.diff ]; then
+ cp -p ${tmpdir}/${PACKAGE}-${VERSION}-${date}.diff .
echo ${PACKAGE}-${VERSION}-${date}.diff >>${tag}.out
fi
-relnotes=$tmpdir/doc/release-notes/release-`echo $VERSION | cut -d. -f1,2 | cut -d- -f1`.html
-if [ -f $relnotes ]; then
- cp -p $relnotes ${PACKAGE}-${VERSION}-${date}-RELEASENOTES.html
+relnotes=${tmpdir}/doc/release-notes/release-`echo ${VERSION} | cut -d. -f1,2 | cut -d- -f1`.html
+if [ -f ${relnotes} ]; then
+ cp -p ${relnotes} ${PACKAGE}-${VERSION}-${date}-RELEASENOTES.html
echo ${PACKAGE}-${VERSION}-${date}-RELEASENOTES.html >>${tag}.out
ed -s ${PACKAGE}-${VERSION}-${date}-RELEASENOTES.html <<EOF
g/"ChangeLog"/ s//"${PACKAGE}-${VERSION}-${date}-ChangeLog.txt"/g
w
EOF
fi
-cp -p $tmpdir/ChangeLog ${PACKAGE}-${VERSION}-${date}-ChangeLog.txt
+cp -p ${tmpdir}/ChangeLog ${PACKAGE}-${VERSION}-${date}-ChangeLog.txt
echo ${PACKAGE}-${VERSION}-${date}-ChangeLog.txt >>${tag}.out
# Generate Configuration Manual HTML
-if [ -x $tmpdir/scripts/www/build-cfg-help.pl ]; then
- make -C $tmpdir/src cf.data
- mkdir -p $tmpdir/doc/cfgman
- $tmpdir/scripts/www/build-cfg-help.pl --version ${VERSION} -o $tmpdir/doc/cfgman $tmpdir/src/cf.data
- sh -c "cd $tmpdir/doc/cfgman && tar -zcf $PWD/${PACKAGE}-${VERSION}-${date}-cfgman.tar.gz *"
+if [ -x ${tmpdir}/scripts/www/build-cfg-help.pl ]; then
+ make -C ${tmpdir}/src cf.data
+ mkdir -p ${tmpdir}/doc/cfgman
+ ${tmpdir}/scripts/www/build-cfg-help.pl --version ${VERSION} -o ${tmpdir}/doc/cfgman ${tmpdir}/src/cf.data
+ sh -c "cd ${tmpdir}/doc/cfgman && tar -zcf ${PWD}/${PACKAGE}-${VERSION}-${date}-cfgman.tar.gz *"
echo ${PACKAGE}-${VERSION}-${date}-cfgman.tar.gz >>${tag}.out
- $tmpdir/scripts/www/build-cfg-help.pl --version ${VERSION} -o ${PACKAGE}-${VERSION}-${date}-cfgman.html -f singlehtml $tmpdir/src/cf.data
+ ${tmpdir}/scripts/www/build-cfg-help.pl --version ${VERSION} -o ${PACKAGE}-${VERSION}-${date}-cfgman.html -f singlehtml ${tmpdir}/src/cf.data
gzip -f -9 ${PACKAGE}-${VERSION}-${date}-cfgman.html
echo ${PACKAGE}-${VERSION}-${date}-cfgman.html.gz >>${tag}.out
fi
# Generate language-pack tarballs
# NP: Only to be done on trunk.
if test "${tag}" = "trunk" ; then
- sh -c "cd $tmpdir/errors && tar -zcf ${PWD}/${PACKAGE}-${VERSION}-${date}-langpack.tar.gz ./*/* ./alias* ./TRANSLATORS ./COPYRIGHT "
+ sh -c "cd ${tmpdir}/errors && tar -zcf ${PWD}/${PACKAGE}-${VERSION}-${date}-langpack.tar.gz ./*/* ./alias* ./TRANSLATORS ./COPYRIGHT "
echo ${PACKAGE}-${VERSION}-${date}-langpack.tar.gz >>${tag}.out
fi