makedist/bin/makedist-announcement

89 lines
2.7 KiB
Plaintext
Raw Normal View History

#!/bin/bash
# makedist-announcement
# Copyright (c) 2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
VERSION=0.1
outputlangs="en it"
distribution="openmamba"
TEXTDOMAIN="makedist"; export TEXTDOMAIN
function usage() {
echo $"Usage"": makedist-announcement distversion [mediumname] [--rebuild-announcement] [--rebuild-catalog]
[--send-email] [--send-test-email] [-h|--help]
"$"Example"":
makedist-announcement milestone2 livecd --send-test-email
"
exit 1
}
while [ "$1" ]; do
case $1 in
--rebuild-announcement) SCRIPT_ENV_ADD="$SCRIPT_ENV_ADD REBUILDANNOUNCEMENT=1" ;;
--rebuild-catalog) SCRIPT_ENV_ADD="$SCRIPT_ENV_ADD REBUILDCATALOG=1" ;;
--send-email) SCRIPT_ENV_ADD="$SCRIPT_ENV_ADD SENDEMAIL=1" ;;
--send-test-email) SCRIPT_ENV_ADD="$SCRIPT_ENV_ADD SENDTESTEMAIL=1" ;;
-h|--help) usage; exit 0 ;;
-*) echo "Error: uknown option $1; aborting."
exit 1
;;
*) if [ ! "$distversion" ]; then
distversion=$1
elif [ ! "$mediumname" ]; then
mediumname=$1
else
echo "Error: exceeding option $1; aborting."
exit 1
fi
;;
esac
shift
done
[ "$distversion" ] || usage
if [ "$distversion" != "devel" ]; then
RELEASE=1
DISTVERSION=$distversion
else
RELEASE=
fi
. /etc/sysconfig/makedist
echo "makedist-announcement $VERSION"
echo "========================="
if [ "$mediumname" ]; then
for outputlang in $outputlangs; do
case $outputlang in
en) export LC_ALL=en_US.UTF8 ;;
it) export LC_ALL=it_IT.UTF8 ;;
*) echo "Error: unsupported language $outputlang; aborting."; exit 1 ;;
esac
[ "$SCRIPT_ENV_ADD" ] && export $SCRIPT_ENV_ADD
/usr/share/makedist/makedist-announcement.sh $distversion $mediumname $outputlang || exit 1
done
fi
#if [ ! "$SENDEMAIL" -a ! "$SENDTESTEMAIL" ]; then
echo $"Generating $distversion announcements index"
for outputlang in $outputlangs; do
indexfile=/var/ftp/pub/$distribution/media/$distversion/release-announcement-index.$outputlang.html.inc
> $indexfile
for i in `seq 0 ${#MEDIA_NAME[*]}`; do
mediumdir=/var/ftp/pub/$distribution/media/$distversion/${MEDIA_NAME[i]}
echo -n "${MEDIA_NAME[i]} " >> $indexfile
for f in $mediumdir/info/release-announcement-*.$outputlang.html; do
[ -r $f ] || continue
version=`echo $f | sed "s|.*/release-announcement-\(.*\)\.$outputlang.html|\1|"`
echo "<a href='?distrelease=${distversion}&medium=${MEDIA_NAME[i]}&version=${version}&lang=${outputlang}'>${version}</a>" >> $indexfile
done
[ $i -lt ${#MEDIA_NAME[*]} ] && echo -n "<br>" >> $indexfile
done
done
#fi