makedist/bin/makedist-announcement

99 lines
3.2 KiB
Plaintext
Raw Normal View History

#!/bin/bash
# makedist-announcement
# Copyright (c) 2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /usr/share/makedist/VERSION
VERSION=$makedist_version
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
echo "<table>" > $indexfile
column=0
for i in `seq 1 ${#MEDIA_NAME[*]}`; do
mediumdir=/var/ftp/pub/$distribution/media/$distversion/${MEDIA_NAME[i-1]}
version=
for f in $mediumdir/info/release-announcement-*.$outputlang.html; do
[ -r $f ] || continue
version=`echo $f | sed "s|.*/release-announcement-\(.*\)\.$outputlang.html|\1|"`
done
[ "$version" ] || continue
[ $column -eq 0 ] && echo -n "<tr>" >> $indexfile
echo -n "<td>${MEDIA_NAME[i-1]}</td>" >> $indexfile
echo -n "<td><a href='?distrelease=${distversion}&medium=${MEDIA_NAME[i-1]}&version=${version}&lang=${outputlang}'>${version}</a></td>" >> $indexfile
[ $column -eq 1 ] && echo "</tr>" >> $indexfile
# [ $i -lt ${#MEDIA_NAME[*]} ] && echo -n "<br>" >> $indexfile
column=`expr $column + 1`
[ $column -gt 1 ] && column=0
done
[ $column -eq 0 ] && echo -n "<td></td></tr>" >> $indexfile
echo "</table>" >> $indexfile
done
#fi