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
|
|
|
|
|
2010-11-14 14:17:33 -01:00
|
|
|
if [ "$CONF"x = ""x ] ; then
|
2013-01-20 00:03:24 -01:00
|
|
|
CONF=~/build.wheezy/CONF.sh
|
2010-11-14 14:17:33 -01:00
|
|
|
fi
|
2008-11-13 22:19:38 -01:00
|
|
|
export CF=$CONF
|
2012-07-06 00:30:17 +00:00
|
|
|
if [ "$DCD_DIR"x = ""x ] ; then
|
2013-01-20 00:03:24 -01:00
|
|
|
DCD_DIR=~/build.wheezy/debian-cd
|
2012-07-06 00:30:17 +00:00
|
|
|
fi
|
|
|
|
export CF=$CONF
|
2006-11-20 22:50:45 -01:00
|
|
|
|
2010-07-02 23:24:56 +00:00
|
|
|
now () {
|
|
|
|
date -u +%F:%H:%M:%S
|
|
|
|
}
|
|
|
|
|
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`
|
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"
|
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
|
2010-11-14 14:17:33 -01:00
|
|
|
export OUTARCH="multi-arch"
|
2008-11-13 22:19:38 -01:00
|
|
|
fi
|
|
|
|
export RUN="$INSTALLER_CD$DI$OUTARCH$LOGAPPEND"
|
|
|
|
export LOGFILE="$LOG/$RUN"
|
|
|
|
|
|
|
|
case "$INSTALLER_CD" in
|
|
|
|
1)
|
|
|
|
export DISKTYPE=BC;;
|
2010-07-02 23:24:56 +00:00
|
|
|
2|7|8|C)
|
2008-11-13 22:19:38 -01:00
|
|
|
export DISKTYPE=NETINST;;
|
|
|
|
3|6)
|
|
|
|
export OUT_TYPE=dvd
|
|
|
|
export DISKTYPE=DVD;;
|
|
|
|
4)
|
|
|
|
export DISKTYPE=kde-CD;;
|
|
|
|
5)
|
|
|
|
export DISKTYPE=xfce-CD;;
|
2008-12-05 13:12:17 -01:00
|
|
|
A)
|
|
|
|
export DISKTYPE=lxde-CD;;
|
2008-12-05 13:12:21 -01:00
|
|
|
B)
|
|
|
|
export DISKTYPE=xfce+lxde-CD;;
|
2008-11-13 22:19:38 -01:00
|
|
|
9)
|
|
|
|
export OUT_TYPE=bd
|
|
|
|
export DISKTYPE=BD;;
|
2012-07-06 00:30:17 +00:00
|
|
|
D)
|
|
|
|
export OUT_TYPE=dlbd
|
|
|
|
export DISKTYPE=DLBD;;
|
2008-12-05 13:12:17 -01:00
|
|
|
*) export DISKTYPE=CD;;
|
2008-11-13 22:19:38 -01:00
|
|
|
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
|
2012-07-06 00:30:17 +00:00
|
|
|
cd $DCD_DIR && . $CONF
|
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
|
|
|
|
2010-11-14 14:17:33 -01:00
|
|
|
if [ "$BUILDNAME"x = ""x ] ; then
|
|
|
|
TRACEFILE="$OUT_TYPE-trace"
|
|
|
|
echo " Making $ARCH ${DISKTYPE} in $OUT"
|
|
|
|
else
|
|
|
|
TRACEFILE="$BUILDNAME-trace"
|
|
|
|
echo " Making $ARCH ${DISKTYPE} (${BUILDNAME}) in $OUT"
|
|
|
|
fi
|
|
|
|
|
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"
|
2008-12-05 13:12:17 -01:00
|
|
|
elif [ "$INSTALLER_CD" = "A" ]; then
|
|
|
|
export OFFICIAL="Official LXDE CD Snapshot"
|
2008-12-05 13:12:21 -01:00
|
|
|
elif [ "$INSTALLER_CD" = "B" ]; then
|
|
|
|
export OFFICIAL="Official Xfce/LXDE CD Snapshot"
|
2008-11-13 22:19:38 -01:00
|
|
|
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"
|
2010-07-02 23:24:56 +00:00
|
|
|
elif [ "$INSTALLER_CD" = "C" ]; then
|
|
|
|
export OFFICIAL="Unofficial Netinst including firmware"
|
2008-11-13 22:19:38 -01:00
|
|
|
fi
|
2006-11-20 22:50:45 -01:00
|
|
|
|
|
|
|
rm -rf "$OUT"
|
|
|
|
mkdir -p "$OUT"
|
2010-11-14 14:17:33 -01:00
|
|
|
rm -f "$PUBDIRJIG"/$OUTARCH/$TRACEFILE
|
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
|
2010-11-14 14:17:33 -01:00
|
|
|
START=`now`
|
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
|
2013-01-20 00:03:24 -01:00
|
|
|
if [ "$INSTALLER_CD" = "1" ] || \
|
|
|
|
[ "$INSTALLER_CD" = "2" ] || \
|
|
|
|
[ "$INSTALLER_CD" = "C" ] ; then
|
2008-11-13 22:19:38 -01:00
|
|
|
|
|
|
|
##################################
|
2009-08-22 22:44:44 +00:00
|
|
|
# NETINST STUFF
|
2008-11-13 22:19:38 -01:00
|
|
|
##################################
|
|
|
|
|
2013-01-20 00:03:24 -01:00
|
|
|
if [ "$INSTALLER_CD" = "C" ] ; then
|
|
|
|
if [ "${DI}" = "sid" ] ; then
|
|
|
|
ARCHDIR=$OUT_FW_SID/$OUTARCH
|
|
|
|
else
|
|
|
|
ARCHDIR=$OUT_FW_TST/$OUTARCH
|
|
|
|
fi
|
|
|
|
else # non-FW build
|
|
|
|
if [ "${DI}" = "sid" ] ; then
|
|
|
|
ARCHDIR=$OUT_FREE_SID/$OUTARCH
|
|
|
|
else
|
|
|
|
ARCHDIR=$OUT_FREE_TST/$OUTARCH
|
|
|
|
fi
|
|
|
|
fi
|
2008-11-13 22:19:38 -01:00
|
|
|
|
2013-04-30 18:54:11 +00:00
|
|
|
mkdir -p $ARCHDIR/list-cd $ARCHDIR/jigdo-cd $ARCHDIR/iso-cd
|
2008-11-13 22:19:38 -01:00
|
|
|
# put the isos and jigdos in their place
|
2013-04-30 18:54:11 +00:00
|
|
|
|
|
|
|
$TOPDIR/debian-cd/tools/imagesums $OUT $SUMS_EXTENSION >> "$LOGFILE"
|
|
|
|
sed -i 's/-BC-1/-businesscard/g;s/-NETINST-1/-netinst/g' $OUT/*SUMS*
|
|
|
|
cp $OUT/*SUMS* $ARCHDIR/iso-cd
|
|
|
|
cp $OUT/*SUMS* $ARCHDIR/jigdo-cd
|
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
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'`
|
2010-11-14 14:17:33 -01:00
|
|
|
mv $OUT/$BASE.iso $ARCHDIR/iso-cd/$NETINSTNAME.iso
|
2008-11-13 22:19:38 -01:00
|
|
|
cat $OUT/$BASE.jigdo | \
|
|
|
|
sed 's/-BC-1/-businesscard/g;s/-NETINST-1/-netinst/g' | \
|
2010-11-14 14:17:33 -01:00
|
|
|
gzip --best --no-name > $ARCHDIR/jigdo-cd/$NETINSTNAME.jigdo
|
2008-11-13 22:19:38 -01:00
|
|
|
rm $OUT/$BASE.jigdo
|
2010-11-14 14:17:33 -01:00
|
|
|
mv $OUT/$BASE.template $ARCHDIR/jigdo-cd/$NETINSTNAME.template
|
2010-07-02 23:24:56 +00:00
|
|
|
# Make sure that the ISO is as new/newer than the jigdo file; #587774
|
2010-11-14 14:17:33 -01:00
|
|
|
touch $ARCHDIR/iso-cd/$NETINSTNAME.iso
|
2012-07-06 00:30:17 +00:00
|
|
|
mv $OUT/$BASE.list.gz $ARCHDIR/list-cd/$NETINSTNAME.list.gz
|
2008-11-13 22:19:38 -01:00
|
|
|
done
|
|
|
|
rm -f "$OUT"/*
|
2010-11-14 14:17:33 -01:00
|
|
|
END=`now`
|
|
|
|
mkdir -p "$PUBDIRJIG"/$OUTARCH
|
2012-07-06 00:30:17 +00:00
|
|
|
echo -e "start=$START\nend=$END\nerror=0\nlogfile=$RUN\n" > "$PUBDIRJIG"/$OUTARCH/$TRACEFILE
|
2010-11-14 14:17:33 -01:00
|
|
|
|
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
|
|
|
|
2010-07-02 23:24:56 +00:00
|
|
|
# Make sure that the ISOs are as new/newer than the jigdo files; #587774
|
2010-11-14 14:17:33 -01:00
|
|
|
for file in "$OUT"/*.iso; do
|
|
|
|
if [ -e $file ] ; then
|
|
|
|
touch $file
|
|
|
|
fi
|
|
|
|
done
|
2010-07-02 23:24:56 +00:00
|
|
|
|
2008-11-13 22:19:38 -01:00
|
|
|
mkdir -p "$PUBDIRJIG"/$OUTARCH/jigdo-${OUT_TYPE}
|
2010-07-02 23:24:56 +00:00
|
|
|
for file in "$OUT"/*SUMS${SUMS_EXTENSION}; do
|
|
|
|
outfile="$PUBDIRJIG"/$OUTARCH/jigdo-${OUT_TYPE}/`basename $file`
|
|
|
|
cat $file >> $outfile
|
|
|
|
done
|
2008-11-13 22:19:38 -01:00
|
|
|
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}
|
2010-07-02 23:24:56 +00:00
|
|
|
for file in "$OUT"/*SUMS${SUMS_EXTENSION}; do
|
|
|
|
outfile="$PUBDIRJIG"/$OUTARCH/iso-${OUT_TYPE}/`basename $file`
|
|
|
|
cat $file >> $outfile
|
|
|
|
done
|
2013-04-30 18:54:11 +00:00
|
|
|
for file in "$OUT"/*.iso; do
|
|
|
|
if [ -e $file ] ; then
|
|
|
|
mv $file "$PUBDIRJIG"/$OUTARCH/iso-${OUT_TYPE}
|
|
|
|
fi
|
|
|
|
done
|
2006-11-20 22:50:45 -01:00
|
|
|
|
2012-07-06 00:30:17 +00:00
|
|
|
mkdir -p "$PUBDIRJIG"/$OUTARCH/list-${OUT_TYPE}
|
|
|
|
mv "$OUT"/*list*gz "$PUBDIRJIG"/$OUTARCH/list-${OUT_TYPE}
|
|
|
|
|
2010-11-14 14:17:33 -01:00
|
|
|
END=`now`
|
2012-07-06 00:30:17 +00:00
|
|
|
echo -e "start=$START\nend=$END\nerror=0\nlogfile=$RUN\n" > "$PUBDIRJIG"/$OUTARCH/$TRACEFILE
|
2008-11-13 22:19:38 -01:00
|
|
|
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
|
2008-11-24 22:10:36 -01:00
|
|
|
cp -a $MIRROR/$file $EXTRACTED_SOURCES
|
2008-11-23 17:57:25 -01:00
|
|
|
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
|
2013-01-20 00:03:24 -01:00
|
|
|
grep -e "extents written" -e "Written to medi." "$LOGFILE"|mail -s "$RELEASE_BUILD testingcds $RUN ($OUTARCH $DISKTYPE) went ok" "$i"
|
2008-11-13 22:19:38 -01:00
|
|
|
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
|
2010-11-14 14:17:33 -01:00
|
|
|
END=`now`
|
2010-07-02 23:24:56 +00:00
|
|
|
mkdir -p "$PUBDIRJIG"/$OUTARCH
|
2012-07-06 00:30:17 +00:00
|
|
|
echo -e "start=$START\nend=$END\nerror=1\nlogfile=$RUN\n" > "$PUBDIRJIG"/$OUTARCH/$TRACEFILE
|
2010-07-02 23:24:56 +00:00
|
|
|
exit 1
|
2006-11-20 22:50:45 -01:00
|
|
|
fi
|