2006-11-20 22:50:45 -01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# testingcds (c) 2005 Santiago Garcia Mantinan <manty@manty.net>
|
|
|
|
#
|
2008-11-23 16:59:53 -01:00
|
|
|
# Updates since then by:
|
|
|
|
# Joey Hess <joey@kitenet.net>
|
|
|
|
# Steve McIntyre <steve@einval.com>
|
2006-11-20 22:50:45 -01:00
|
|
|
#
|
2008-11-23 16:59:53 -01:00
|
|
|
# GPL v2
|
2006-11-20 22:50:45 -01:00
|
|
|
#
|
2008-11-23 16:59:53 -01:00
|
|
|
# See cronjob.weekly and cronjob.daily for examples of how to call this script
|
2006-11-20 22:50:45 -01:00
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
#set -x
|
|
|
|
|
|
|
|
CONF=~/build/CONF.sh
|
|
|
|
export CF=$CONF
|
2006-11-20 22:50:45 -01:00
|
|
|
|
|
|
|
# Set up and cleaning
|
2008-11-13 22:19:38 -01:00
|
|
|
if [ $# -lt 1 ] ; then
|
|
|
|
echo $0 \$ARCH
|
|
|
|
echo "variables: PUBDIR[ISO|JIG]"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! "$DATE_BUILD" ] ; then
|
|
|
|
DATE_BUILD=`/bin/date -u +%Y%m%d`
|
2006-11-20 22:50:45 -01:00
|
|
|
fi
|
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
export ARCH="$1"
|
|
|
|
NUM_ARCHES=`echo $ARCH | wc -w`
|
|
|
|
FIRSTARCH=`echo $ARCH | awk '{print $1}'`
|
2006-11-20 22:50:45 -01:00
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
if [ ! "$JIGDOFALLBACKURLS" ] ; then
|
|
|
|
export JIGDOFALLBACKURLS="Debian=http://us.cdimage.debian.org/cdimage/snapshot/Debian/"
|
2006-11-20 22:50:45 -01:00
|
|
|
fi
|
2008-11-13 22:19:38 -01:00
|
|
|
|
2006-11-20 22:50:45 -01:00
|
|
|
# $DI is used to set DI_CODENAME and also to specify the directory for images
|
2008-11-13 22:19:38 -01:00
|
|
|
if [ "$DI" ] ; then
|
|
|
|
export DI_CODENAME="$DI"
|
|
|
|
if [ "$INSTALLER_CD" = "1" -o "$INSTALLER_CD" = "2" ] ; then
|
|
|
|
PUBDIRJIG="$PUBDIRJIG"/"$DI"_d-i
|
|
|
|
PUBDIRISO="$PUBDIRISO"/"$DI"_d-i
|
|
|
|
fi
|
2006-11-20 22:50:45 -01:00
|
|
|
fi
|
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
export LOG="`pwd`/log/"
|
|
|
|
if [ "$NUM_ARCHES"x = "1"x ] ; then
|
|
|
|
export OUTARCH=$ARCH
|
2006-11-20 22:50:45 -01:00
|
|
|
else
|
2008-11-13 22:19:38 -01:00
|
|
|
export OUTARCH="multiarch"
|
|
|
|
fi
|
|
|
|
export RUN="$INSTALLER_CD$DI$OUTARCH$LOGAPPEND"
|
|
|
|
export LOGFILE="$LOG/$RUN"
|
|
|
|
|
|
|
|
case "$INSTALLER_CD" in
|
|
|
|
1)
|
|
|
|
export DISKTYPE=BC;;
|
|
|
|
2|7|8)
|
|
|
|
export DISKTYPE=NETINST;;
|
|
|
|
3|6)
|
|
|
|
export OUT_TYPE=dvd
|
|
|
|
export DISKTYPE=DVD;;
|
|
|
|
4)
|
|
|
|
export DISKTYPE=kde-CD;;
|
|
|
|
5)
|
|
|
|
export DISKTYPE=xfce-CD;;
|
|
|
|
9)
|
|
|
|
export OUT_TYPE=bd
|
|
|
|
export DISKTYPE=BD;;
|
|
|
|
*) export DISKTYPE=CD;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ "$OUT_TYPE"x = ""x ] ; then
|
|
|
|
OUT_TYPE=cd
|
2006-11-20 22:50:45 -01:00
|
|
|
fi
|
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
export IMAGETARGET=official_images
|
|
|
|
cd debian-cd && . $CONF
|
|
|
|
echo Making $ARCH "$DISKTYPE" in $OUT
|
2006-11-20 22:50:45 -01:00
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
if [ "$OUT"x = ""x ] ; then
|
|
|
|
echo Config error
|
|
|
|
exit 1
|
|
|
|
fi
|
2006-11-20 22:50:45 -01:00
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
if [ "$INSTALLER_CD" = "1" ] ; then
|
|
|
|
export OFFICIAL="Official BusinessCard Snapshot"
|
|
|
|
elif [ "$INSTALLER_CD" = "2" ] ; then
|
|
|
|
export OFFICIAL="Official NetInst Snapshot"
|
|
|
|
elif [ "$INSTALLER_CD" = "4" ]; then
|
|
|
|
export OFFICIAL="Official KDE CD Snapshot"
|
|
|
|
elif [ "$INSTALLER_CD" = "5" ]; then
|
|
|
|
export OFFICIAL="Official Xfce CD Snapshot"
|
|
|
|
elif [ "$INSTALLER_CD" = "6" ]; then
|
|
|
|
export OFFICIAL="Official Multi-Arch DVD"
|
|
|
|
elif [ "$INSTALLER_CD" = "7" ]; then
|
|
|
|
export OFFICIAL="Official Multi-Arch Netinst"
|
|
|
|
elif [ "$INSTALLER_CD" = "8" ]; then
|
|
|
|
export OFFICIAL="Official Multi-Arch Netinst"
|
|
|
|
fi
|
2006-11-20 22:50:45 -01:00
|
|
|
|
|
|
|
rm -rf "$OUT"
|
|
|
|
mkdir -p "$OUT"
|
2008-11-13 22:19:38 -01:00
|
|
|
#mkdir -p "$LOG"
|
2006-11-20 22:50:45 -01:00
|
|
|
|
|
|
|
overview_log="$LOG/overview"
|
|
|
|
overview () {
|
|
|
|
if [ -e $overview_log ]; then
|
|
|
|
grep -v " $1 " $overview_log > $overview_log.new
|
|
|
|
mv $overview_log.new $overview_log
|
|
|
|
fi
|
|
|
|
LANG=C echo "$(dpkg --print-architecture) ($(date)) $(whoami)@$(hostname | cut -d . -f 1) $1 $2" >> $overview_log
|
|
|
|
}
|
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
> $LOGFILE
|
2006-11-20 22:50:45 -01:00
|
|
|
|
|
|
|
# Do the actual building
|
2008-11-13 22:19:38 -01:00
|
|
|
if ./build.sh "$ARCH" >>"$LOGFILE" 2>&1 ; then
|
|
|
|
# if it went ok get things ready for publishing
|
|
|
|
# we treat the daily netinst images in a different way
|
|
|
|
if [ "$INSTALLER_CD" = "1" -o "$INSTALLER_CD" = "2" ] ; then
|
|
|
|
|
|
|
|
##################################
|
|
|
|
# NETINST STUFF (ISO ONLY for now)
|
|
|
|
##################################
|
|
|
|
|
|
|
|
# make the dirs we'll use to publish things
|
|
|
|
TOPDIR="$PUBDIRISO"/$DATE_BUILD/$OUTARCH
|
|
|
|
mkdir -p $TOPDIR/iso-cd $TOPDIR/jigdo-cd
|
|
|
|
|
|
|
|
# put the isos and jigdos in their place
|
|
|
|
for i in "$OUT"/*-1.iso; do
|
|
|
|
BASE=`basename $i .iso`
|
|
|
|
NETINSTNAME=`echo $BASE | sed 's/-BC-1/-businesscard/g;s/-NETINST-1/-netinst/g'`
|
|
|
|
mv $OUT/$BASE.iso $TOPDIR/iso-cd/$NETINSTNAME.iso
|
|
|
|
cat $OUT/$BASE.jigdo | \
|
|
|
|
sed 's/-BC-1/-businesscard/g;s/-NETINST-1/-netinst/g' | \
|
|
|
|
gzip --best --no-name > $TOPDIR/jigdo-cd/$NETINSTNAME.jigdo
|
|
|
|
rm $OUT/$BASE.jigdo
|
|
|
|
mv $OUT/$BASE.template $TOPDIR/jigdo-cd/$NETINSTNAME.template
|
|
|
|
done
|
|
|
|
cat $OUT/MD5SUMS >> $TOPDIR/iso-cd/MD5SUMS
|
|
|
|
cat $OUT/MD5SUMS >> $TOPDIR/jigdo-cd/MD5SUMS
|
|
|
|
cat $OUT/SHA1SUMS >> $TOPDIR/iso-cd/SHA1SUMS
|
|
|
|
cat $OUT/SHA1SUMS >> $TOPDIR/jigdo-cd/SHA1SUMS
|
|
|
|
rm -f "$OUT"/*
|
2006-11-20 22:50:45 -01:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
#######################################
|
|
|
|
# NORMAL STUFF - full builds (weekly)
|
|
|
|
#######################################
|
2006-11-20 22:50:45 -01:00
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
# finish up the jigdos (compress & move them)
|
|
|
|
gzip --best --no-name "$OUT"/*.jigdo
|
|
|
|
for i in "$OUT"/*.jigdo.gz; do
|
|
|
|
mv $i ${i%.gz}
|
|
|
|
done
|
2006-11-20 22:50:45 -01:00
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
mkdir -p "$PUBDIRJIG"/$OUTARCH/jigdo-${OUT_TYPE}
|
|
|
|
cat "$OUT"/MD5SUMS >> "$PUBDIRJIG"/$OUTARCH/jigdo-${OUT_TYPE}/MD5SUMS
|
|
|
|
cat "$OUT"/SHA1SUMS >> "$PUBDIRJIG"/$OUTARCH/jigdo-${OUT_TYPE}/SHA1SUMS
|
|
|
|
mv "$OUT"/*.template "$PUBDIRJIG"/$OUTARCH/jigdo-${OUT_TYPE}
|
|
|
|
mv "$OUT"/*.jigdo "$PUBDIRJIG"/$OUTARCH/jigdo-${OUT_TYPE}
|
2006-11-20 22:50:45 -01:00
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
mkdir -p "$PUBDIRJIG"/$OUTARCH/iso-${OUT_TYPE}
|
|
|
|
cat "$OUT"/MD5SUMS >> "$PUBDIRJIG"/$OUTARCH/iso-${OUT_TYPE}/MD5SUMS
|
|
|
|
cat "$OUT"/SHA1SUMS >> "$PUBDIRJIG"/$OUTARCH/iso-${OUT_TYPE}/SHA1SUMS
|
|
|
|
mv "$OUT"/*.iso "$PUBDIRJIG"/$OUTARCH/iso-${OUT_TYPE}
|
2006-11-20 22:50:45 -01:00
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
date > "$PUBDIRJIG"/$OUTARCH/"$OUT_TYPE"-trace
|
|
|
|
fi
|
2006-11-20 22:50:45 -01:00
|
|
|
|
2008-11-23 17:57:25 -01:00
|
|
|
touch $TDIR/$CODENAME/1.pkgs_extracted # so we don't get errors below
|
|
|
|
for file in `cat $TDIR/$CODENAME/*.pkgs_extracted | sort | uniq`; do
|
|
|
|
basefile=`basename $file`
|
|
|
|
if [ ! -e $EXTRACTED_SOURCES/$file ] ; then
|
|
|
|
cp $MIRROR/$file $EXTRACTED_SOURCES
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
# Mail the sizes of the images
|
|
|
|
if [ -e "../.debian-cd.mail" ] ; then
|
|
|
|
MYEMAIL=`grep -v "^#" "../.debian-cd.mail"`
|
|
|
|
else
|
|
|
|
MYEMAIL=`whoami`
|
|
|
|
fi
|
2006-11-20 22:50:45 -01:00
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
for i in $MYEMAIL
|
|
|
|
do
|
|
|
|
grep "extents written" "$LOGFILE"|mail -s "testingcds $RUN went ok" "$i"
|
|
|
|
done
|
|
|
|
overview "$RUN" success
|
2006-11-20 22:50:45 -01:00
|
|
|
|
|
|
|
else
|
2008-11-13 22:19:38 -01:00
|
|
|
# Run failed
|
|
|
|
if [ -e "../.debian-cd.mail" ] ; then
|
|
|
|
MYEMAIL=`grep -v "^#" "../.debian-cd.mail"`
|
|
|
|
else
|
|
|
|
MYEMAIL=`whoami`
|
|
|
|
fi
|
|
|
|
for i in $MYEMAIL
|
|
|
|
do
|
|
|
|
(echo Error when trying to create cds for $RUN ; cat $LOGFILE) | \
|
|
|
|
mail -s "testingcds $RUN has failed; log included" "$i"
|
|
|
|
done
|
|
|
|
overview "$RUN" failed
|
2006-11-20 22:50:45 -01:00
|
|
|
fi
|