makedist/bin/makedist-newrelease

85 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
echo "makedist media release script"
echo "Copyright (c) 2008-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>"
echo
function usage()
{
echo "Usage:"
echo "makedist-newrelease release [distversion] [-f] [--only platform[/subplatform]]"
echo
echo "-f: force full rebuild"
echo "--only: only build the specified platform and subplatform"
echo "-h: show this help and exit"
echo
echo "Example:"
echo "makedist-newrelease 2.0.10 milestone2 --only livecd/livecd-root"
echo
}
[ "$1" ] || {
echo "Error: release must be specified; aborting"
usage
exit 1
}
while [ "$1" ]; do
case $1 in
-f) FORCE_ADD="FORCE=1" ;;
--only) ONLY_PLATFORM=$2
[ "$ONLY_PLATFORM" ] || {
echo "Error: platform must be specified after --only; aborting."
}
shift ;;
-h) usage; exit 0 ;;
-*) echo "Error: uknown option $1; aborting."
exit 1
;;
*) if [ ! "$RELEASE" ]; then
RELEASE=$1
elif [ ! "$DISTVERSION" ]; then
DISTVERSION=$2
else
echo "Error: exceeding option $1; aborting."
exit 1
fi
;;
esac
shift
done
[ "$RELEASE" ] || { usage; exit 1; }
[ "$2" ] || DISTVERSION="milestone2"
. /etc/sysconfig/makedist
echo "Releasing media for openmamba $DISTVERSION $RELEASE"
ALLMEDIALAST=`expr ${#MEDIA_NAME[*]} - 1`
for i in `seq 0 $ALLMEDIALAST`; do
PLATFORM=${MEDIA_PLATFORM[i]/\/*/}
SUBPLATFORM=${MEDIA_SUBPLATFORM[i]/*\//}
[ "$SUBPLATFORM" = "$PLATFORM" ] && SUBPLATFORM=
[ "${ONLY_PLATFORM/\//}" = "${ONLY_PLATFORM}" ] && ONLY_PLATFORM="$ONLY_PLATFORM/"
[ ! "$ONLY_PLATFORM" -o "$ONLY_PLATFORM" = "$PLATFORM/$SUBPLATFORM" ] || continue
for lang in ${MEDIA_LANGUAGES[i]}; do
for arch in ${MEDIA_ARCHS[i]}; do
sudo makedist openmamba-$DISTVERSION PLATFORM=$PLATFORM SUBPLATFORM=$SUBPLATFORM LANGUAGE=$lang RELEASE=$DISTVERSION ARCH=$arch $FORCE_ADD || {
echo "Error: fatal error running 'makedist openmamba-$DISTVERSION PLATFORM=$PLATFORM SUBPLATFORM=$SUBPLATFORM LANGUAGE=$lang RELEASE=$DISTVERSION ARCH=$arch $FORCE_ADD'; aborting."
exit 1
}
done
done
FORCE_OVERWRITE=1 \
RELEASE=$RELEASE \
RELEASEPLATFORM=$PLATFORM \
RELEASESUBPLATFORM=$SUBPLATFORM \
DISTVERSION=$DISTVERSION /etc/cron.daily/20-openmamba-autobuild-makedist
done
# Workaround: updates home page HTML which always show previous version after first run
RELEASE=$RELEASE \
DISTVERSION=$DISTVERSION \
/etc/cron.daily/20-openmamba-autobuild-makedist
exit 0