2019-02-19 17:05:47 -01:00
|
|
|
#!/bin/bash
|
2010-11-14 14:13:48 -01:00
|
|
|
#
|
|
|
|
# Helper for image creation
|
|
|
|
#
|
|
|
|
PUBDIRJIG=$1
|
|
|
|
RSYNC_TARGET=$2
|
|
|
|
ARCH=$3
|
2019-02-19 17:05:47 -01:00
|
|
|
FIRMWARE=$4
|
2010-11-14 14:13:48 -01:00
|
|
|
|
2019-02-19 17:05:47 -01:00
|
|
|
LOG=~/build.${CODENAME}/log/$ARCH.iso_run
|
2010-11-14 14:13:48 -01:00
|
|
|
HOSTNAME=`hostname -f`
|
|
|
|
LOCK=~/iso_run.lock
|
|
|
|
START=`date -u +%H:%M:%S`
|
2019-02-19 17:05:47 -01:00
|
|
|
. $TOPDIR/common.sh
|
2010-11-14 14:13:48 -01:00
|
|
|
|
|
|
|
# Check to see if another sync is in progress
|
|
|
|
if lockfile -! -l 43200 -r-1 "$LOCK"; then
|
|
|
|
echo $HOSTNAME is not doing another iso_run, lock file $LOCK exists
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
trap "rm -f $LOCK > /dev/null 2>&1" exit
|
|
|
|
|
2013-04-30 18:54:11 +00:00
|
|
|
COPY_START=`date -u +%H:%M:%S`
|
|
|
|
|
2010-11-14 14:13:48 -01:00
|
|
|
rm -f $LOG
|
|
|
|
|
|
|
|
# Poor man's rsync, but with some local optimisations
|
|
|
|
copy_files() {
|
|
|
|
SRC=$1
|
|
|
|
TARGET=$2
|
|
|
|
ARCHES=$3
|
|
|
|
|
2013-01-20 00:03:24 -01:00
|
|
|
DISKTYPES="cd dvd bd dlbd"
|
|
|
|
DIRTYPES="iso jigdo list"
|
|
|
|
|
|
|
|
# Only make torrent files and dirs for release builds
|
|
|
|
if [ "$RELEASE_BUILD"x != ""x ] ; then
|
|
|
|
DIRTYPES="$DIRTYPES bt"
|
|
|
|
fi
|
|
|
|
|
2010-11-14 14:13:48 -01:00
|
|
|
CURRENT=`pwd`
|
|
|
|
cd $SRC
|
|
|
|
for ARCH in $ARCHES
|
|
|
|
do
|
2013-01-20 00:03:24 -01:00
|
|
|
for DISKTYPE in $DISKTYPES; do
|
|
|
|
for DIRTYPE in $DIRTYPES; do
|
2019-02-19 17:05:47 -01:00
|
|
|
if [ -d $ARCH/$DIRTYPE-$DISKTYPE ]; then
|
|
|
|
mkdir -p -m775 $TARGET/$ARCH.tmp/$DIRTYPE-$DISKTYPE
|
|
|
|
fi
|
2010-11-14 14:13:48 -01:00
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2019-02-19 17:05:47 -01:00
|
|
|
# Copy the specific files across that we want in the
|
|
|
|
# publishing dir
|
2010-11-14 14:13:48 -01:00
|
|
|
cd $ARCH
|
2012-07-06 00:30:17 +00:00
|
|
|
find . -name '*.jigdo' -o -name '*.template' \
|
2019-02-19 17:05:47 -01:00
|
|
|
-o -name '*.iso' \
|
|
|
|
-o -name '*.torrent' \
|
2012-07-06 00:30:17 +00:00
|
|
|
-o -name '*.list.gz' -o -name '*SUMS*' | \
|
|
|
|
xargs tar cf - | (cd $TARGET/$ARCH.tmp/ && tar xvf -) >> $LOG
|
2013-01-20 00:03:24 -01:00
|
|
|
|
|
|
|
if [ "$RELEASE_BUILD"x = ""x ] ; then
|
|
|
|
# Only populate the HEADER.html file for regular weekly
|
|
|
|
# builds; we don't want it for releases
|
2017-06-06 12:10:48 +00:00
|
|
|
HUM_DATE=`date -u`
|
2019-02-19 17:05:47 -01:00
|
|
|
sed "s/ARCH/$ARCH/g;s/DATE/$HUM_DATE/g" ~/build.${CODENAME}/weekly.html \
|
2013-01-20 00:03:24 -01:00
|
|
|
> $TARGET/$ARCH.tmp/HEADER.html
|
|
|
|
fi
|
|
|
|
|
2017-06-06 12:10:48 +00:00
|
|
|
mkdir -p $TARGET/$ARCH.tmp/log/$DATE
|
|
|
|
cp *.log $TARGET/$ARCH.tmp/log/$DATE
|
|
|
|
ln -sf $DATE $TARGET/$ARCH.tmp/log/success
|
|
|
|
|
2013-01-20 00:03:24 -01:00
|
|
|
# Now clean up any directories without any real content
|
|
|
|
# (i.e. empty dir, or just containing checksum files)
|
|
|
|
for dir in $TARGET/$ARCH.tmp/*-* ; do
|
|
|
|
num=`ls -l $dir | grep -v -e SUMS -e total | wc -l`
|
|
|
|
if [ $num = 0 ] ; then
|
|
|
|
rm -rf $dir
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2010-11-14 14:13:48 -01:00
|
|
|
cd ..
|
2013-01-20 00:03:24 -01:00
|
|
|
|
2010-11-14 14:13:48 -01:00
|
|
|
done
|
|
|
|
cd $CURRENT
|
|
|
|
}
|
|
|
|
|
|
|
|
copy_files $PUBDIRJIG $RSYNC_TARGET $ARCH
|
|
|
|
|
|
|
|
echo "$START: Starting $ARCH sync from $PUBDIRJIG to $RSYNC_TARGET" >> $LOG
|
2011-02-02 22:35:52 -01:00
|
|
|
if [ -e $RSYNC_TARGET/$ARCH ] ; then
|
|
|
|
mv -f $RSYNC_TARGET/$ARCH $RSYNC_TARGET/$ARCH.old
|
|
|
|
fi
|
2010-11-14 14:13:48 -01:00
|
|
|
mv $RSYNC_TARGET/$ARCH.tmp $RSYNC_TARGET/$ARCH
|
|
|
|
rm -rf $RSYNC_TARGET/$ARCH.old &
|
|
|
|
|
|
|
|
# Update the trace file now to force a sync on free.hands.com after each arch
|
|
|
|
mkdir -p $RSYNC_TARGET/trace
|
|
|
|
date -u > $RSYNC_TARGET/trace/cdimage.debian.org
|
|
|
|
|
2019-02-19 17:05:47 -01:00
|
|
|
# Generate the HEADER.html files in the subdirectories
|
|
|
|
~/build.${CODENAME}/generate_headers ~/build.${CODENAME}/HEADER.html.in $RSYNC_TARGET/$ARCH $ARCH $FIRMWARE
|
|
|
|
|
2010-11-14 14:13:48 -01:00
|
|
|
END=`date -u +%H:%M:%S`
|
2013-04-30 18:54:11 +00:00
|
|
|
echo "$ARCH synced across to $RSYNC_TARGET; started at $START, copying started at $COPY_START, ended at $END"
|
2019-02-19 17:05:47 -01:00
|
|
|
|
|
|
|
# If we're on casulana, push things to pettersson here
|
|
|
|
if [ $(hostname) = casulana ]; then
|
|
|
|
START=`date -u +%H:%M:%S`
|
|
|
|
PETOUT=${RSYNC_TARGET##${OUT_BASE}/}
|
|
|
|
echo "$START: Starting $ARCH sync from $RSYNC_TARGET/$ARCH to pettersson" >> $LOG
|
|
|
|
(cd $RSYNC_TARGET/$ARCH && find . -name '*.iso' > .iso-wanted)
|
|
|
|
rsync_to_pettersson $RSYNC_TARGET/$ARCH/ ${PETOUT}/$ARCH/ '--exclude *.iso'
|
|
|
|
rsync_to_pettersson $RSYNC_TARGET/trace/ ${PETOUT}/trace/
|
|
|
|
publish_on_pettersson ${PETOUT}/$ARCH ${PETOUT}/trace
|
|
|
|
END=`date -u +%H:%M:%S`
|
|
|
|
echo "$RSYNC_TARGET/$ARCH synced across to pettersson; started at $START, ended at $END"
|
|
|
|
fi
|
|
|
|
|
2010-11-14 14:13:48 -01:00
|
|
|
echo "$END: Finished" >> $LOG
|