#!/bin/bash # makedist-announcement # Copyright (c) 2012-2020 by Silvan Calarco # . /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] [-y|--yes] "$"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 ;; -y|--yes) EXTRA_OPTS="-y" ;; -*) 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 $EXTRA_OPTS $distversion $mediumname $outputlang || exit 1 done fi #if [ ! "$SENDEMAIL" -a ! "$SENDTESTEMAIL" ]; then echo $"Generating $distversion announcements indexes" for outputlang in $outputlangs; do tmpfile=`mktemp -q -t makedist-announcement.XXXXXXXX` indexfile=/var/ftp/pub/$distribution/media/$distversion/release-announcement-index.$outputlang.html.inc dateindexfile=/var/ftp/pub/$distribution/media/$distversion/release-announcement-dateindex.$outputlang.html.inc > $dateindexfile echo "" > $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|"` announcedate=`stat --format=%X $f` echo "$announcedate `date -d @$announcedate +%d/%m/%Y` ${MEDIA_NAME[i-1]} $version" >> $tmpfile done [ "$version" ] || continue [ $column -eq 0 ] && echo -n "" >> $indexfile echo -n "" >> $indexfile echo -n "" >> $indexfile [ $column -eq 1 ] && echo "" >> $indexfile # [ $i -lt ${#MEDIA_NAME[*]} ] && echo -n "
" >> $indexfile column=`expr $column + 1` [ $column -gt 1 ] && column=0 done [ $column -eq 0 ] && echo -n "" >> $indexfile echo "
${MEDIA_NAME[i-1]}${version}
" >> $indexfile sort -r $tmpfile | \ while read line; do set -- $line echo "
$2 "$"Release: ""$distribution $distversion $3 $4" >> $dateindexfile done rm -f $tmpfile done #fi