2012-07-21 22:01:04 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# makedist-announcement
|
2023-08-07 13:17:27 +02:00
|
|
|
# Copyright (c) 2012-2023 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
2012-07-21 22:01:04 +02:00
|
|
|
#
|
|
|
|
|
2012-11-29 12:20:48 +01:00
|
|
|
. /usr/share/makedist/VERSION
|
|
|
|
VERSION=$makedist_version
|
2012-07-21 22:01:04 +02:00
|
|
|
outputlangs="en it"
|
|
|
|
distribution="openmamba"
|
|
|
|
|
|
|
|
TEXTDOMAIN="makedist"; export TEXTDOMAIN
|
|
|
|
|
|
|
|
function usage() {
|
2012-08-02 12:29:10 +02:00
|
|
|
echo $"Usage"": makedist-announcement distversion [mediumname] [--rebuild-announcement] [--rebuild-catalog]
|
2014-05-13 11:28:49 +02:00
|
|
|
[--send-email] [--send-test-email] [-h|--help] [-y|--yes]
|
2012-08-02 12:29:10 +02:00
|
|
|
|
|
|
|
"$"Example"":
|
|
|
|
makedist-announcement milestone2 livecd --send-test-email
|
2012-07-21 22:01:04 +02:00
|
|
|
"
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-07-27 15:14:54 +02:00
|
|
|
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 ;;
|
2014-05-13 11:28:49 +02:00
|
|
|
-y|--yes) EXTRA_OPTS="-y" ;;
|
2012-07-27 15:14:54 +02:00
|
|
|
-*) 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
|
2012-07-21 22:01:04 +02:00
|
|
|
|
2012-07-27 15:14:54 +02:00
|
|
|
[ "$distversion" ] || usage
|
2012-07-21 22:01:04 +02:00
|
|
|
|
2023-08-07 13:17:27 +02:00
|
|
|
if [ "$distversion" != "rolling" ]; then
|
2012-07-21 22:01:04 +02:00
|
|
|
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
|
2012-08-02 12:29:10 +02:00
|
|
|
[ "$SCRIPT_ENV_ADD" ] && export $SCRIPT_ENV_ADD
|
2014-05-13 11:28:49 +02:00
|
|
|
/usr/share/makedist/makedist-announcement.sh $EXTRA_OPTS $distversion $mediumname $outputlang || exit 1
|
2012-07-21 22:01:04 +02:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2012-07-27 15:14:54 +02:00
|
|
|
#if [ ! "$SENDEMAIL" -a ! "$SENDTESTEMAIL" ]; then
|
2014-05-13 11:28:49 +02:00
|
|
|
echo $"Generating $distversion announcements indexes"
|
2012-07-23 13:12:24 +02:00
|
|
|
for outputlang in $outputlangs; do
|
2014-05-13 11:28:49 +02:00
|
|
|
tmpfile=`mktemp -q -t makedist-announcement.XXXXXXXX`
|
2012-07-23 13:12:24 +02:00
|
|
|
indexfile=/var/ftp/pub/$distribution/media/$distversion/release-announcement-index.$outputlang.html.inc
|
2014-05-13 11:28:49 +02:00
|
|
|
dateindexfile=/var/ftp/pub/$distribution/media/$distversion/release-announcement-dateindex.$outputlang.html.inc
|
|
|
|
> $dateindexfile
|
2012-11-29 12:20:48 +01:00
|
|
|
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=
|
2012-07-23 13:12:24 +02:00
|
|
|
for f in $mediumdir/info/release-announcement-*.$outputlang.html; do
|
|
|
|
[ -r $f ] || continue
|
|
|
|
version=`echo $f | sed "s|.*/release-announcement-\(.*\)\.$outputlang.html|\1|"`
|
2014-05-13 11:28:49 +02:00
|
|
|
announcedate=`stat --format=%X $f`
|
|
|
|
echo "$announcedate `date -d @$announcedate +%d/%m/%Y` ${MEDIA_NAME[i-1]} $version" >> $tmpfile
|
2012-07-23 13:12:24 +02:00
|
|
|
done
|
2012-11-29 12:20:48 +01:00
|
|
|
[ "$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
|
2012-07-21 22:01:04 +02:00
|
|
|
done
|
2012-11-29 12:20:48 +01:00
|
|
|
[ $column -eq 0 ] && echo -n "<td></td></tr>" >> $indexfile
|
|
|
|
echo "</table>" >> $indexfile
|
2014-05-13 11:28:49 +02:00
|
|
|
sort -r $tmpfile | \
|
|
|
|
while read line; do
|
|
|
|
set -- $line
|
|
|
|
echo "<br>$2 <a href=\"/distribution/announcements.html?distrelease=${distversion}&medium=$3&version=$4\">"$"Release: ""$distribution $distversion $3 $4</a>" >> $dateindexfile
|
|
|
|
done
|
|
|
|
rm -f $tmpfile
|
2012-07-21 22:01:04 +02:00
|
|
|
done
|
2012-07-27 15:14:54 +02:00
|
|
|
#fi
|