You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
115 lines
2.5 KiB
115 lines
2.5 KiB
#!/bin/sh -e
|
|
|
|
# Overridable environment variables for uploading.
|
|
RESTRICTED_SSH=
|
|
|
|
if [ -z "$HOST" ]; then
|
|
HOST=people.debian.org
|
|
fi
|
|
if [ -z "$BASEDIR" ]; then
|
|
# Please don't change this. If you need it to be something else,
|
|
# override the variable.
|
|
BASEDIR=public_html/d-i/images
|
|
fi
|
|
if [ -z "$DIR" ]; then
|
|
DIR=`date +%Y-%m-%d`
|
|
fi
|
|
if [ "$HOST" = "local" ]; then
|
|
SYNC="rsync"
|
|
SYNC_BASEDIR="$BASEDIR"
|
|
HELPER=d-i-unpack-helper
|
|
else
|
|
CALL="ssh $HOST"
|
|
SYNC="rsync -e ssh"
|
|
SYNC_BASEDIR="$HOST:$BASEDIR"
|
|
# trade performance (using rsync) for security (restricted ssh keys)
|
|
HELPER="ssh -i ~/.ssh/gluck_d-i $HOST d-i-unpack-helper"
|
|
fi
|
|
# Overridable environment variables for building.
|
|
if [ -z "$ROOTCMD" ]; then
|
|
ROOTCMD="fakeroot"
|
|
fi
|
|
|
|
overview () {
|
|
LANG=C echo "$(dpkg --print-architecture) ($(date)) $(whoami)@$(hostname | cut -d . -f 1) $1" >> dest/overview.log
|
|
}
|
|
|
|
header () {
|
|
echo
|
|
echo $@
|
|
echo
|
|
}
|
|
|
|
build () {
|
|
unset LANG LC_ALL LANGUAGE || true
|
|
(cd ../debian && svn up || true)
|
|
svn up || true
|
|
|
|
# Override $TARGETS with custom makefile targets.
|
|
if [ -z "$TARGETS" ]; then
|
|
TARGETS="$($ROOTCMD make all_list |grep '^build')"
|
|
fi
|
|
|
|
$ROOTCMD make reallyclean
|
|
mkdir dest
|
|
touch dest/overview.log
|
|
for t in $TARGETS; do
|
|
(
|
|
header BUILDING IMAGE FOR $t
|
|
if $ROOTCMD make $t; then
|
|
overview "$t success"
|
|
else
|
|
overview "$t failed"
|
|
fi
|
|
) 2>&1 | tee dest/$t.log # This is allowed to fail
|
|
done
|
|
$ROOTCMD make $(echo $TARGETS | sed 's/build_/stats_/g') | 2>&1 tee dest/stats.txt # This is allowed to fail
|
|
}
|
|
|
|
upload () {
|
|
header UPLOADING FILES
|
|
if [ -n "$RESTRICTED_SSH" ]; then
|
|
tar zcvf - -C dest/ . | $HELPER
|
|
else
|
|
$CALL mkdir -p $BASEDIR/${DIR}_RSYNC_IN_PROGRESS
|
|
$CALL test ! -d $BASEDIR/daily || $CALL cp -a $BASEDIR/daily/* $BASEDIR/${DIR}_RSYNC_IN_PROGRESS/
|
|
$SYNC --stats -rvl --safe-links --delete -e ssh dest/ $SYNC_BASEDIR/${DIR}_RSYNC_IN_PROGRESS/
|
|
$CALL rm -rf $BASEDIR/$DIR
|
|
$CALL mv $BASEDIR/${DIR}_RSYNC_IN_PROGRESS $BASEDIR/$DIR
|
|
$CALL rm -rf $BASEDIR/daily
|
|
$CALL ln -sf $DIR $BASEDIR/daily
|
|
fi
|
|
}
|
|
|
|
usage () {
|
|
echo These subcommands are available:
|
|
awk -F\) '/subcommand$/ { print " ", $1 }' $0
|
|
echo
|
|
}
|
|
|
|
if [ ! -d pkg-lists ]; then
|
|
echo "You must run this from the build directory"
|
|
exit 1
|
|
fi
|
|
|
|
case $1 in
|
|
build) # subcommand
|
|
build
|
|
;;
|
|
upload) # subcommand
|
|
upload
|
|
;;
|
|
'') # no subcommand, for backwards compatability
|
|
build
|
|
upload
|
|
;;
|
|
both) # subcommand
|
|
build
|
|
upload
|
|
;;
|
|
*)
|
|
echo $1 is not a valid subcommand.
|
|
usage
|
|
exit 1
|
|
;;
|
|
esac
|
|
|