2012-07-14 14:10:18 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2022-07-09 21:05:11 +02:00
|
|
|
# Makedist automatic media build script
|
|
|
|
# Copyright (c) 2007-2022 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
2012-07-14 14:10:18 +02:00
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
#
|
|
|
|
# To overwrite already existing images
|
2022-07-09 21:05:11 +02:00
|
|
|
# FORCE_OVERWRITE=1 ./20-makedist-autobuild
|
2012-07-14 14:10:18 +02:00
|
|
|
#
|
|
|
|
# To commit a new release (relies on snapshot images):
|
2022-07-09 21:05:11 +02:00
|
|
|
# RELEASE=1.0pre3 ./20-makedist-autobuild
|
2012-07-14 14:10:18 +02:00
|
|
|
#
|
|
|
|
. /etc/sysconfig/makedist
|
|
|
|
. /usr/share/makedist/functions.inc.sh
|
|
|
|
|
2015-03-15 00:24:14 +01:00
|
|
|
# DO_RECORDVM=1
|
|
|
|
ALLMEDIASLAST=`expr ${#MEDIA_NAME[*]} - 1`
|
|
|
|
|
2022-07-09 21:05:11 +02:00
|
|
|
[ "$MAKEDIST_CRON_ENABLE" = "1" -o "$FORCE" ] || exit 0
|
2012-07-14 14:10:18 +02:00
|
|
|
|
|
|
|
ME=`basename $0`
|
|
|
|
[ "$$" == "`pidof -x $ME`" ] || {
|
2013-01-27 16:06:08 +01:00
|
|
|
echo "Warning: makedist-autobuild script already running; exiting."
|
2012-07-14 14:10:18 +02:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
|
|
|
|
|
|
|
|
SOURCEDIR=/var/makedist
|
|
|
|
|
|
|
|
[ "$MAKEDIST_FORCE" ] || MAKEDIST_FORCE=1
|
|
|
|
[ "$TODAYDATE" ] || TODAYDATE=`date +%Y%m%d`
|
|
|
|
[ "$WEEKDAY" ] || WEEKDAY=`date +%u`
|
2015-03-15 00:24:14 +01:00
|
|
|
[ "$MONTHDAY" ] || MONTHDAY=`date +%-d`
|
2012-07-14 14:10:18 +02:00
|
|
|
|
|
|
|
[ "$DISTVERSION" ] || {
|
|
|
|
echo "Error: DISTVERSION is not set, check configuration file; aborting."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# do_makedist()
|
|
|
|
#
|
|
|
|
# Parameters;
|
|
|
|
#
|
|
|
|
# $1: dist filename
|
|
|
|
# $2: dest filename
|
|
|
|
# $3: language
|
|
|
|
# $4: platform
|
|
|
|
# $5: subplatform
|
|
|
|
# $6: product_name
|
|
|
|
# $7: architecture
|
|
|
|
function do_makedist() {
|
|
|
|
local DIST_CREATED=0 SOURCEIMG DESTFILENAME DESTNAME DESTLANGUAGE DESTPLATFORM DESTSUBPLATFORM DESTARCH \
|
2022-07-09 21:05:11 +02:00
|
|
|
DESTVARIANT DESTPRODUCTNAME DESTDIR DESTIMG DESTMD5 DESTTORRENT DESTMILESTONE DESTTARGET
|
2012-07-14 14:10:18 +02:00
|
|
|
DESTFILENAME=$1
|
|
|
|
DESTNAME=$2
|
|
|
|
DESTLANGUAGE=$3
|
|
|
|
DESTPLATFORM=$4
|
|
|
|
DESTSUBPLATFORM=$5
|
2015-03-15 00:24:14 +01:00
|
|
|
DESTVARIANT=$6
|
|
|
|
DESTPRODUCTNAME=$7
|
|
|
|
DESTARCH=$8
|
|
|
|
DESTMILESTONE=$9
|
2022-07-09 21:05:11 +02:00
|
|
|
DESTTARGET=${10}
|
2012-07-14 14:10:18 +02:00
|
|
|
SOURCEIMG=$SOURCEDIR/${DESTFILENAME}
|
|
|
|
DESTDIR=$DESTBASEDIR/${DESTPRODUCTNAME}/${DESTLANGUAGE}
|
|
|
|
DESTIMG=$DESTDIR/$DESTNAME
|
|
|
|
DESTMD5=$DESTDIR/$DESTNAME.MD5.txt
|
|
|
|
DESTTORRENT=$DESTDIR/$DESTNAME.torrent
|
|
|
|
[ "$DESTARCH" ] || {
|
|
|
|
echo "Error: do_makedist: invalid number of parameters; aborting."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
if [ "$RELEASE" ]; then
|
|
|
|
[ "$RELEASEPLATFORM" = "$MEDIUMPLATFORM" -a \
|
|
|
|
"$RELEASESUBPLATFORM" = "$MEDIUMSUBPLATFORM" ] || return 0
|
|
|
|
fi
|
|
|
|
[ "$RELEASE" ] && \
|
|
|
|
DESTLATEST=$DESTDIR/latest-is-$RELEASETAG.txt || \
|
|
|
|
DESTLATEST=$DESTDIR/latest-is-$SNAPDATE.txt
|
|
|
|
|
|
|
|
if [ ! -f $DESTIMG -o "$FORCE_OVERWRITE" = "1" ]; then
|
|
|
|
if [ ! "$SIMULATE" ]; then
|
|
|
|
if [ "$HOST_IS_X86_64" -a "${DESTARCH}" != "x86_64" ]; then
|
|
|
|
CMD_PREFIX=linux32
|
|
|
|
else
|
|
|
|
CMD_PREFIX=
|
|
|
|
fi
|
2022-07-09 21:05:11 +02:00
|
|
|
if [ "${DESTMILESTONE}" = "devel" -o "${DESTMILESTONE}" = "main" ]; then
|
|
|
|
MAKEDIST_TARGET=${DESTTARGET}
|
2015-03-15 00:24:14 +01:00
|
|
|
else
|
2022-07-09 21:05:11 +02:00
|
|
|
MAKEDIST_TARGET=${DESTTARGET}-${DESTMILESTONE}
|
2015-03-15 00:24:14 +01:00
|
|
|
fi
|
2012-07-14 14:10:18 +02:00
|
|
|
[ "$CRON_DEBUG" = "1" ] && \
|
2015-03-15 00:24:14 +01:00
|
|
|
echo "-> makedist $MAKEDIST_TARGET PLATFORM=${DESTPLATFORM} SUBPLATFORM=${DESTSUBPLATFORM} \
|
|
|
|
VARIANT=${DESTVARIANT} LANGUAGE=${DESTLANGUAGE} ARCH=${DESTARCH} FORCE=${MAKEDIST_FORCE}"
|
|
|
|
makedist $MAKEDIST_TARGET PLATFORM=${DESTPLATFORM} SUBPLATFORM=${DESTSUBPLATFORM} \
|
|
|
|
VARIANT=${DESTVARIANT} LANGUAGE=${DESTLANGUAGE} ARCH=${DESTARCH} FORCE=${MAKEDIST_FORCE} || {
|
2022-07-09 21:05:11 +02:00
|
|
|
echo "Error building ${DESTPRODUCTNAME} medium; skipping."
|
2012-11-29 12:54:30 +01:00
|
|
|
return 255
|
2012-07-14 14:10:18 +02:00
|
|
|
}
|
2022-07-09 21:05:11 +02:00
|
|
|
DIST_CREATED=1
|
2012-07-14 14:10:18 +02:00
|
|
|
fi
|
|
|
|
if [ "$RELEASE" ]; then
|
|
|
|
[ -e $DESTDIR ] || mkdir -p $DESTDIR
|
|
|
|
cp $SOURCEIMG $DESTIMG
|
2022-07-09 21:05:11 +02:00
|
|
|
cp ${SOURCEDIR}/.${DESTFILENAME}.inc.html $DESTDIR/buildinfo-$RELEASE.inc.html
|
|
|
|
[ "$RELEASE/pre" != "$RELEASE" ] && ln -sf buildinfo-$RELEASE.inc.html $DESTDIR/buildinfo-pre.inc.html
|
2012-07-14 14:10:18 +02:00
|
|
|
cd $DESTDIR
|
|
|
|
md5sum $DESTNAME > $DESTMD5
|
2012-08-02 12:29:10 +02:00
|
|
|
rm -f $DESTDIR/latest-is-*.txt
|
|
|
|
> $DESTLATEST
|
2015-03-15 00:24:14 +01:00
|
|
|
if [ "${DO_RECORDVM}" -a "${DESTIMG/.iso}" != "$DESTIMG" ]; then
|
2012-07-14 14:10:18 +02:00
|
|
|
# ISO image, create video preview
|
|
|
|
[ ! -e $DESTDIR/preview/$DESTNAME.ogv -o $SOURCEIMG -nt $DESTDIR/preview/$DESTNAME.ogv ] && makedist-recordvm $DESTIMG
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
[ -e $DESTDIR ] || mkdir -p $DESTDIR
|
|
|
|
cp $SOURCEIMG $DESTIMG
|
2022-07-09 21:05:11 +02:00
|
|
|
cp ${SOURCEDIR}/.${DESTFILENAME}.inc.html $DESTDIR/buildinfo.inc.html
|
2012-07-14 14:10:18 +02:00
|
|
|
cd $DESTDIR
|
|
|
|
md5sum $DESTNAME > $DESTMD5
|
2022-07-09 21:05:11 +02:00
|
|
|
rm -f $DESTDIR/latest-is-*.txt
|
2012-08-02 12:29:10 +02:00
|
|
|
> $DESTLATEST
|
2015-03-15 00:24:14 +01:00
|
|
|
if [ "${DO_RECORDVM}" -a "${DESTIMG/.iso}" != "$DESTIMG" ]; then
|
2012-07-14 14:10:18 +02:00
|
|
|
# ISO image, create video preview
|
|
|
|
[ ! -e $DESTDIR/preview/$DESTNAME.ogv -o $SOURCEIMG -nt $DESTDIR/preview/$DESTNAME.ogv ] && makedist-recordvm $DESTIMG
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
2022-07-09 21:05:11 +02:00
|
|
|
if [ "${TORRENTURL}" ]; then
|
|
|
|
if [ "$DIST_CREATED" = "1" -o $DESTIMG -nt $DESTTORRENT -o \
|
|
|
|
"$FORCE_OVERWRITE" = "1" -o "$FORCE_OVERWRITE_TORRENT" = "1" ]; then
|
|
|
|
# Generate TORRENT
|
|
|
|
if [ "$RELEASE" ]; then
|
|
|
|
cd $DESTDIR
|
|
|
|
maketorrent-console \
|
|
|
|
--comment "${DESTTARGET} $RELEASE ${DESTPRODUCTNAME} ${DESTLANGUAGE}-${DESTARCH} from ${PROJECT_URL}" \
|
|
|
|
--tracker_name "${DESTTARGET} BitTorrent tracker" \
|
|
|
|
--language ${DESTLANGUAGE} \
|
|
|
|
$TORRENTURL \
|
|
|
|
$DESTNAME --target $DESTTORRENT >/dev/null
|
|
|
|
else
|
|
|
|
cd $DESTDIR
|
|
|
|
maketorrent-console \
|
|
|
|
--comment "${DESTTARGET} snapshot $SNAPDATE ${DESTPRODUCTNAME} ${DESTLANGUAGE}-${DESTARCH} from ${PROJECT_URL}" \
|
|
|
|
--tracker_name "${DESTTARGET} BitTorrent tracker" \
|
|
|
|
--language ${DESTLANGUAGE} \
|
|
|
|
$TORRENTURL \
|
|
|
|
$DESTNAME --target $DESTTORRENT >/dev/null
|
|
|
|
fi
|
2012-07-14 14:10:18 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
return $DIST_CREATED
|
|
|
|
}
|
|
|
|
|
|
|
|
# do_all_langs_makedist()
|
|
|
|
#
|
|
|
|
# Parameters;
|
|
|
|
#
|
|
|
|
# $1: medium suffix
|
|
|
|
# $2: medium release tag
|
|
|
|
# $3: platform
|
|
|
|
# $4: subplatform
|
|
|
|
# $5: html language
|
|
|
|
# $6: product name
|
|
|
|
# $7: medium idx
|
|
|
|
function do_makedist_and_html() {
|
|
|
|
|
|
|
|
local DIST_LINE DIST_CREATED DIST_DWD HTMLLANG MEDIA_ARCH PRODNAME \
|
2015-03-15 00:24:14 +01:00
|
|
|
MEDIUMFILENAME MEDIUMNAME MEDIUMPLATFORM MEDIUMSUBPLATFORM MEDIUMVARIANT \
|
2022-07-09 21:05:11 +02:00
|
|
|
m l MEDIUMMILESTONE MEDIUMTARGET
|
2012-07-14 14:10:18 +02:00
|
|
|
|
2022-07-09 21:05:11 +02:00
|
|
|
local tempfile2=`mktemp 2>/dev/null` || tempfile2=/tmp/makedist_tmpfile2
|
2012-07-14 14:10:18 +02:00
|
|
|
|
|
|
|
MEDIUMSUFFIX=$1
|
|
|
|
MEDIUMTAG=$2
|
|
|
|
MEDIUMPLATFORM=$3
|
|
|
|
MEDIUMSUBPLATFORM=$4
|
2015-03-15 00:24:14 +01:00
|
|
|
MEDIUMVARIANT=$5
|
|
|
|
HTMLLANG=$6
|
|
|
|
PRODNAME=$7
|
|
|
|
m=$8
|
|
|
|
MEDIUMMILESTONE=${MEDIA_MILESTONE[$m]}
|
2022-07-09 21:05:11 +02:00
|
|
|
MEDIUMTARGET=${MEDIA_TARGET[$m]}
|
|
|
|
|
2015-03-15 00:24:14 +01:00
|
|
|
[ "${MEDIUMMILESTONE}" ] || {
|
2012-07-14 14:10:18 +02:00
|
|
|
echo "Error: do_makedist_and_html: invalid number of parameters; aborting."
|
|
|
|
exit 1
|
|
|
|
}
|
2022-07-09 21:05:11 +02:00
|
|
|
if [ "${MEDIUMMILESTONE}" != "devel" -a "${MEDIUMMILESTONE}" != "main" ]; then
|
|
|
|
SOURCEIMGFILEPREFIX="${MEDIUMTARGET}-${MEDIUMMILESTONE}"
|
|
|
|
DESTIMGFILEPREFIX="${MEDIUMTARGET}-${MEDIUMMILESTONE}"
|
2015-03-15 00:24:14 +01:00
|
|
|
else
|
2022-07-09 21:05:11 +02:00
|
|
|
SOURCEIMGFILEPREFIX="${MEDIUMTARGET}"
|
|
|
|
DESTIMGFILEPREFIX="${MEDIUMTARGET}"
|
2015-03-15 00:24:14 +01:00
|
|
|
fi
|
2012-07-14 14:10:18 +02:00
|
|
|
|
|
|
|
cat > $tempfile2 << _EOF
|
|
|
|
<div class="downloadbox"><table width="760"><tr><td width=400>
|
|
|
|
<form name="$PRODNAME-$RELEASETAG-form" id="$PRODNAME-$RELEASETAG-form">
|
|
|
|
_EOF
|
|
|
|
|
|
|
|
case ${HTMLLANG} in
|
|
|
|
it) echo -n "Lingua: " >> $tempfile2; selecttext="Scarica..."; fortext="per" ;;
|
|
|
|
*) echo -n "Language: " >> $tempfile2; selecttext="Download..."; fortext="for" ;;
|
|
|
|
esac
|
|
|
|
for l in ${MEDIA_LANGUAGES[$m]}; do
|
2022-07-09 21:05:11 +02:00
|
|
|
checked=""
|
|
|
|
if [ "${l}" = "${HTMLLANG}" ]; then
|
2012-07-14 14:10:18 +02:00
|
|
|
checked="checked"
|
2022-07-09 21:05:11 +02:00
|
|
|
fi
|
2012-07-14 14:10:18 +02:00
|
|
|
case $l in
|
|
|
|
it) langname="italiano" ;;
|
|
|
|
es) langname="español" ;;
|
|
|
|
en) langname="english" ;;
|
|
|
|
*) langname="unknown" ;;
|
|
|
|
esac
|
2022-07-09 21:05:11 +02:00
|
|
|
echo "<input type=radio id=\"language\" name=\"language\" value=\"${l}\" onclick=\"javascript:selectlang('$PRODNAME-${RELEASETAG}');\" $checked />$langname" >> $tempfile2
|
2012-07-14 14:10:18 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
case ${HTMLLANG} in
|
|
|
|
it) echo -n "<br>Architettura: " >> $tempfile2;;
|
|
|
|
*) echo -n "<br>Architecture: " >> $tempfile2;;
|
|
|
|
esac
|
|
|
|
checked="checked"
|
|
|
|
for a in ${MEDIA_ARCHS[$m]}; do
|
|
|
|
echo "<input type=radio id=\"arch\" name=\"arch\" value=\"$a\" onclick=\"javascript:selectlang('$PRODNAME-${RELEASETAG}');\" $checked />$a" >> $tempfile2
|
|
|
|
checked=""
|
|
|
|
done
|
|
|
|
|
|
|
|
cat >> $tempfile2 << _EOF
|
|
|
|
<br><span name="$PRODNAME-${RELEASETAG}-spanl" id="$PRODNAME-${RELEASETAG}-spanl"></span><script>
|
|
|
|
_EOF
|
|
|
|
echo "<tr><td width=25%>" >> $releasetempfile.${HTMLLANG}
|
|
|
|
#>> $tempfile.$5
|
|
|
|
|
|
|
|
DIST_DWD="<select style=\"float:right;width:150px;align:right;\" onchange=\"window.location=this.value;\"><option value="/">$selecttext</option>"
|
2012-11-29 12:54:30 +01:00
|
|
|
DIST_CREATED=
|
|
|
|
|
2012-07-14 14:10:18 +02:00
|
|
|
for l in ${MEDIA_LANGUAGES[$m]}; do
|
2012-11-29 12:54:30 +01:00
|
|
|
if [ "$RELEASE" ]; then
|
2022-07-09 21:05:11 +02:00
|
|
|
latest=`ls $DESTBASEDIR/$PRODNAME/$l/latest-is-${MEDIA_MILESTONE[$m]}-*.txt 2>/dev/null| sed "s/.*latest-is-${MEDIA_MILESTONE[$m]}-\(.*\)\.txt/\1/"`
|
2012-11-29 12:54:30 +01:00
|
|
|
DESTLATESTFILENAME=latest-$latest.inc.js
|
|
|
|
else
|
|
|
|
DESTLATESTFILENAME=latest.inc.js
|
|
|
|
fi
|
2015-03-15 00:24:14 +01:00
|
|
|
DESTLATESTFILENAME2=latest.inc.php
|
|
|
|
> $DESTBASEDIR/$PRODNAME/$l/$DESTLATESTFILENAME.new
|
|
|
|
> $DESTBASEDIR/$PRODNAME/$l/$DESTLATESTFILENAME2.new
|
2012-07-14 14:10:18 +02:00
|
|
|
case $l in
|
|
|
|
it) mediumlang="italiano" ;;
|
|
|
|
es) mediumlang="español" ;;
|
|
|
|
en) mediumlang="english" ;;
|
|
|
|
*) mediumlang="unknown" ;;
|
|
|
|
esac
|
|
|
|
for a in ${MEDIA_ARCHS[$m]}; do
|
|
|
|
case $a in
|
2013-01-27 16:06:08 +01:00
|
|
|
i586) archtext="x86" ;;
|
|
|
|
*) archtext="$a" ;;
|
2012-07-14 14:10:18 +02:00
|
|
|
esac
|
|
|
|
DESTNAME=$DESTIMGFILEPREFIX-$PRODNAME-$l-${MEDIUMTAG}.${a}.${MEDIUMSUFFIX}
|
2012-11-29 12:54:30 +01:00
|
|
|
if [ "$DIST_CREATED" != "255" ]; then
|
|
|
|
# in case of previous build error (255) skipping building target for other langs and archs
|
|
|
|
[ "$CRON_DEBUG" = "1" ] && \
|
2022-07-09 21:05:11 +02:00
|
|
|
echo "do_makedist_and_html: calling do_makedist \"$SOURCEIMGFILEPREFIX-$PRODNAME-$l.${a}.${MEDIUMSUFFIX}\" \"$DESTNAME\" \"${l}\" \"${MEDIUMPLATFORM}\" \"${MEDIUMSUBPLATFORM}\" \"$PRODNAME\" \"${a}\"" \"${MEDIUMMILESTONE}\" \"${MEDIUMTARGET}\"
|
|
|
|
do_makedist "$SOURCEIMGFILEPREFIX-$PRODNAME-$l.${a}.${MEDIUMSUFFIX}" "$DESTNAME" "${l}" "${MEDIUMPLATFORM}" "${MEDIUMSUBPLATFORM}" "${MEDIUMVARIANT}" "$PRODNAME" "${a}" "${MEDIUMMILESTONE}" "${MEDIUMTARGET}"
|
2012-11-29 12:54:30 +01:00
|
|
|
DIST_CREATED=$?
|
2014-05-13 11:28:49 +02:00
|
|
|
[ "$DIST_CREATED" = "255" ] && return 255
|
2013-01-27 16:06:08 +01:00
|
|
|
|
|
|
|
DESTDIR=$DESTBASEDIR/${PRODNAME}/${l}
|
|
|
|
DESTIMG=$DESTDIR/$DESTNAME
|
|
|
|
DESTMD5=$DESTDIR/$DESTNAME.MD5.txt
|
|
|
|
DESTTORRENT=$DESTDIR/$DESTNAME.torrent
|
|
|
|
DESTSIZE=`du $DESTIMG -h | gawk '{ print $1 }'`
|
|
|
|
DESTMD5=`cat $DESTMD5 | gawk '{ print $1 }'`
|
|
|
|
DESTBUILDDATE=`stat -c %y $DESTIMG`
|
2015-03-15 00:24:14 +01:00
|
|
|
cat >> $DESTDIR/$DESTLATESTFILENAME.new << _EOF
|
2013-01-27 16:06:08 +01:00
|
|
|
nameArray['$PRODNAME-$RELEASETAG-${l}-${a}']='$DESTNAME';
|
|
|
|
pathArray['$PRODNAME-$RELEASETAG-${l}-${a}']='/download.html?file=$DESTBASEURL/$PRODNAME/${l}/';
|
|
|
|
sizeArray['$PRODNAME-$RELEASETAG-${l}-${a}']='$DESTSIZE';
|
|
|
|
md5Array['$PRODNAME-$RELEASETAG-${l}-${a}']='$DESTMD5';
|
|
|
|
builddateArray['$PRODNAME-$RELEASETAG-${l}-${a}']='$DESTBUILDDATE';
|
2015-03-15 00:24:14 +01:00
|
|
|
_EOF
|
|
|
|
cat >> $DESTDIR/$DESTLATESTFILENAME2.new << _EOF
|
|
|
|
\$releaseTag['$PRODNAME-$MEDIUMMILESTONE-${l}-${a}']='$RELEASETAG';
|
|
|
|
\$versionMedium['$PRODNAME-$RELEASETAG-${l}-${a}']='$MEDIUMMILESTONE';
|
|
|
|
\$nameMedium['$PRODNAME-$RELEASETAG-${l}-${a}']='$DESTNAME';
|
|
|
|
\$pathMedium['$PRODNAME-$RELEASETAG-${l}-${a}']='/download.html?file=$DESTBASEURL/$PRODNAME/${l}/';
|
|
|
|
\$sizeMedium['$PRODNAME-$RELEASETAG-${l}-${a}']='$DESTSIZE';
|
|
|
|
\$md5Medium['$PRODNAME-$RELEASETAG-${l}-${a}']='$DESTMD5';
|
|
|
|
\$builddateMedium['$PRODNAME-$RELEASETAG-${l}-${a}']='$DESTBUILDDATE';
|
2013-01-27 16:06:08 +01:00
|
|
|
_EOF
|
2013-03-07 17:30:29 +01:00
|
|
|
# create short links used e.g. by unetbootin
|
|
|
|
if [ -e $DESTDIR/$DESTNAME ]; then
|
2015-03-15 00:24:14 +01:00
|
|
|
# DISTVERSION is snapshot or e.g. milestone3
|
|
|
|
ln -sf $DESTNAME $DESTDIR/$DESTIMGFILEPREFIX-$PRODNAME-$l-$DISTVERSION.${a}.${MEDIUMSUFFIX}
|
2013-03-07 17:30:29 +01:00
|
|
|
rm -f $DESTDIR/$DESTIMGFILEPREFIX-$PRODNAME-$l.${a}.${MEDIUMSUFFIX}
|
|
|
|
fi
|
2012-07-14 14:10:18 +02:00
|
|
|
fi
|
|
|
|
DIST_DWD="$DIST_DWD<option value=\"/download.html?file=$DESTBASEURL/$PRODNAME/$l/$DESTNAME\">${mediumlang} $fortext $archtext</option>"
|
|
|
|
# DIST_DWD="$DIST_DWD <a href=\"/download.html?file=$DESTBASEURL/$PRODNAME/$l/$DESTNAME\">${l}-${a}</a>"
|
|
|
|
done
|
2015-03-15 00:24:14 +01:00
|
|
|
mv $DESTBASEDIR/$PRODNAME/$l/$DESTLATESTFILENAME.new $DESTBASEDIR/$PRODNAME/$l/$DESTLATESTFILENAME
|
|
|
|
mv $DESTBASEDIR/$PRODNAME/$l/$DESTLATESTFILENAME2.new $DESTBASEDIR/$PRODNAME/$l/$DESTLATESTFILENAME2
|
2012-11-29 12:54:30 +01:00
|
|
|
cat $DESTBASEDIR/$PRODNAME/$l/$DESTLATESTFILENAME >> $tempfile2
|
2012-07-14 14:10:18 +02:00
|
|
|
done
|
|
|
|
DIST_DWD="$DIST_DWD</select>"
|
|
|
|
DIST_LINE="<a href=\"/distribution/media/${MEDIA_NAME[$m]}.html?lang=${HTMLLANG}\">${MEDIA_NAME[$m]}</a>"
|
2012-08-02 12:29:10 +02:00
|
|
|
[ "$DIST_CREATED" = "1" ] && DIST_LINE="<b>$DIST_LINE</b>"
|
2012-07-14 14:10:18 +02:00
|
|
|
echo "${DIST_LINE}</td><td width=30%>$SNAPDATE</td><td width=40%>${DIST_DWD}</td></tr>" >>$releasetempfile.${HTMLLANG}
|
|
|
|
|
|
|
|
cat >> $tempfile2 << _EOF
|
|
|
|
</script></form></td><td><span name="${6}-${RELEASETAG}-spanr" id="${PRODNAME}-${RELEASETAG}-spanr"></span></td></tr>
|
|
|
|
<tr><td colspan=2><span id="details-data-$PRODNAME-${RELEASETAG/./_}"></span></td></tr></table></div>
|
|
|
|
<script>javascript:selectlang('$PRODNAME-${RELEASETAG}');</script>
|
|
|
|
_EOF
|
|
|
|
|
|
|
|
if [ "$RELEASE" ]; then
|
|
|
|
DESTHTML=$DESTBASEDIR/$PRODNAME/index.inc.${HTMLLANG}.$latest.html
|
|
|
|
ln -sf index.inc.${HTMLLANG}.$latest.html $DESTBASEDIR/$PRODNAME/index.inc.${HTMLLANG}.html
|
|
|
|
ln -sf index.inc.${HTMLLANG}.html $DESTBASEDIR/$PRODNAME/index.inc.${HTMLLANG}.pre.html
|
|
|
|
else
|
|
|
|
DESTHTML=$DESTBASEDIR/$PRODNAME/index.inc.${HTMLLANG}.html
|
|
|
|
fi
|
|
|
|
mv $tempfile2 $DESTHTML
|
|
|
|
chmod +r $DESTHTML
|
2012-08-02 12:29:10 +02:00
|
|
|
if [ "$DIST_CREATED" = "1" ]; then
|
|
|
|
# snapshots
|
2022-07-09 21:05:11 +02:00
|
|
|
if [ "$MEDIUMMILESTONE" != "devel" -a "$MEDIUMMILESTONE" != "main" ]; then
|
2015-03-15 00:24:14 +01:00
|
|
|
#temporary
|
|
|
|
makedist-announcement --rebuild-announcement --send-test-email -y ${MEDIUMMILESTONE} $PRODNAME
|
|
|
|
else
|
|
|
|
makedist-announcement --rebuild-announcement --send-email -y ${MEDIUMMILESTONE} $PRODNAME
|
|
|
|
fi
|
2012-08-02 12:29:10 +02:00
|
|
|
elif [ "$RELEASEPLATFORM" = "$MEDIUMPLATFORM" -a \
|
2014-05-13 11:28:49 +02:00
|
|
|
"$RELEASESUBPLATFORM" = "$MEDIUMSUBPLATFORM" -a "$HTMLLANG" = "en" ]; then
|
2012-08-02 12:29:10 +02:00
|
|
|
# stable
|
2015-03-15 00:24:14 +01:00
|
|
|
makedist-announcement --rebuild-announcement --send-test-email -y ${MEDIUMMILESTONE} $PRODNAME
|
2012-08-02 12:29:10 +02:00
|
|
|
fi
|
2012-11-29 12:54:30 +01:00
|
|
|
return $DIST_CREATED
|
2012-07-14 14:10:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
releasetempfile=`tempfile 2>/dev/null` || releasetempfile=/tmp/makedist_tmpfile
|
|
|
|
|
|
|
|
for l in ${HTML_LANGS}; do
|
|
|
|
echo "<table width=100% cellpadding=0 cellspacing=0>" > $releasetempfile.$l
|
|
|
|
done
|
|
|
|
|
|
|
|
for i in `seq 0 $ALLMEDIASLAST`; do
|
|
|
|
|
|
|
|
PLATFORM=${MEDIA_PLATFORM[i]}
|
|
|
|
SUBPLATFORM=${MEDIA_SUBPLATFORM[i]}
|
2015-03-15 00:24:14 +01:00
|
|
|
VARIANT=${MEDIA_VARIANT[i]}
|
2022-07-09 21:05:11 +02:00
|
|
|
DESTBASEDIR=${REPODIR_LOCAL}/${MEDIA_MILESTONE[i]}/media
|
|
|
|
DESTBASEURL=${REPODIR_URL}/${MEDIA_MILESTONE[i]}/media
|
2015-03-15 00:24:14 +01:00
|
|
|
|
2012-07-14 14:10:18 +02:00
|
|
|
unset PRODUCT_NAME
|
|
|
|
unset PRODUCT_NAME_OVERRIDE
|
|
|
|
|
2022-07-09 21:05:11 +02:00
|
|
|
[ $SUBPLATFORM ] && . ${SOURCEDIR}/targets/${MEDIA_TARGET[i]}/platforms/$SUBPLATFORM/settings.inc
|
|
|
|
. ${SOURCEDIR}/targets/${MEDIA_TARGET[i]}/platforms/$PLATFORM/settings.inc
|
2012-07-14 14:10:18 +02:00
|
|
|
[ "$SUBPLATFORM" ] && \
|
2015-03-15 00:24:14 +01:00
|
|
|
medium_name=`arch=_SPLIT_ VARIANT=$VARIANT PLATFORM=$SUBPLATFORM media_name` ||
|
|
|
|
medium_name=`arch=_SPLIT_ VARIANT=$VARIANT media_name`
|
2012-07-14 14:10:18 +02:00
|
|
|
medium_suffix=${medium_name/*_SPLIT_\./}
|
2012-08-02 12:29:10 +02:00
|
|
|
[ $PRODUCT_NAME ] || PRODUCT_NAME=${MEDIA_NAME[i]}
|
2012-07-14 14:10:18 +02:00
|
|
|
[ "$PRODUCT_NAME_OVERRIDE" ] && PRODUCT_NAME=$PRODUCT_NAME_OVERRIDE
|
|
|
|
|
|
|
|
unset latest
|
|
|
|
|
2022-07-09 21:05:11 +02:00
|
|
|
[ "${CRON_DEBUG}" ] && echo "PLATFORM=$PLATFORM SUBPLATFORM=$SUBPLATFORM MEDIA_SUFFIX=$media_suffix MEDIA_WEEKDAY=${MEDIA_WEEKDAY[i]}"
|
2012-07-14 14:10:18 +02:00
|
|
|
if [ "$RELEASE" ]; then
|
|
|
|
echo "Releasing $PRODUCT_NAME media (${PLATFORM}/${SUBPLATFORM} $RELEASETAG)"
|
|
|
|
SIMULATE=1
|
2015-03-15 00:24:14 +01:00
|
|
|
elif [ "$WEEKDAY" = "${MEDIA_WEEKDAY[i]}" -o \
|
2022-09-08 14:35:16 +02:00
|
|
|
"${MEDIA_WEEKDAY[i]}" = "ANY" -o \
|
2015-03-15 00:24:14 +01:00
|
|
|
"$FORCEBUILD" = "$PRODUCT_NAME" ]; then
|
|
|
|
echo "Building $PRODUCT_NAME media"
|
|
|
|
unset SIMULATE
|
|
|
|
elif [ "$MONTHDAY" = "${MEDIA_MONTHDAY[i]}" -o \
|
2012-07-14 14:10:18 +02:00
|
|
|
"$FORCEBUILD" = "$PRODUCT_NAME" ]; then
|
|
|
|
echo "Building $PRODUCT_NAME media"
|
|
|
|
unset SIMULATE
|
|
|
|
else
|
|
|
|
SIMULATE=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$RELEASE" ]; then
|
2015-03-15 00:24:14 +01:00
|
|
|
latest=`ls $DESTBASEDIR/$PRODUCT_NAME/en/latest-is-${MEDIA_MILESTONE[i]}-*.txt 2>/dev/null| sed "s/.*latest-is-${MEDIA_MILESTONE[i]}-\(.*\)\.txt/\1/"`
|
2012-07-14 14:10:18 +02:00
|
|
|
if [ "$RELEASEPLATFORM" = "$PLATFORM" -a \
|
|
|
|
"$RELEASESUBPLATFORM" = "$SUBPLATFORM" ]; then
|
2015-03-15 00:24:14 +01:00
|
|
|
RELEASETAG=${MEDIA_MILESTONE[i]}-$RELEASE
|
2012-07-14 14:10:18 +02:00
|
|
|
else
|
2015-03-15 00:24:14 +01:00
|
|
|
RELEASETAG=${MEDIA_MILESTONE[i]}-$latest
|
2012-07-14 14:10:18 +02:00
|
|
|
fi
|
|
|
|
SNAPDATE=$RELEASETAG
|
|
|
|
else
|
|
|
|
latest=`ls $DESTBASEDIR/$PRODUCT_NAME/en/latest-is-*.txt 2>/dev/null| sed "s/.*latest-is-\(.*\)\.txt/\1/"`
|
|
|
|
[ "$latest" -a "$SIMULATE" ] && SNAPDATE=$latest || SNAPDATE=$TODAYDATE
|
|
|
|
RELEASETAG=snapshot-$SNAPDATE
|
|
|
|
fi
|
|
|
|
|
|
|
|
for l in ${HTML_LANGS}; do
|
|
|
|
for ml in ${MEDIA_LANGUAGES[i]}; do
|
|
|
|
if [ ! -e $DESTBASEDIR/$PRODUCT_NAME/$ml ]; then
|
|
|
|
mkdir -p $DESTBASEDIR/$PRODUCT_NAME/$ml || {
|
|
|
|
echo "Error: cannot create directory $DESTBASEDIR/$PRODUCT_NAME/$ml; aborting"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# build all media and create html page of language ${l}
|
2012-11-29 12:54:30 +01:00
|
|
|
[ "$latest" -o ! "$SIMULATE" -o "$RELEASE" ] && {
|
2012-07-14 14:10:18 +02:00
|
|
|
do_makedist_and_html \
|
|
|
|
$medium_suffix $RELEASETAG \
|
2015-03-15 00:24:14 +01:00
|
|
|
$PLATFORM "$SUBPLATFORM" "$VARIANT" ${l} $PRODUCT_NAME ${i}
|
2012-11-29 12:54:30 +01:00
|
|
|
[ $? -eq 255 ] && break
|
|
|
|
}
|
2012-07-14 14:10:18 +02:00
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
for l in ${HTML_LANGS}; do
|
|
|
|
echo "</table>" >> $releasetempfile.$l
|
|
|
|
# if [ "$RELEASE" ]; then
|
|
|
|
# cat $releasetempfile.$l > $DESTBASEDIR/downloads-$RELEASE.inc.$l
|
|
|
|
# [ "${RELEASE/pre}" != "$RELEASE" ] && ln -sf downloads-$RELEASE.inc.$l $DESTBASEDIR/downloads-pre.inc.$l
|
|
|
|
# else
|
|
|
|
rm -f $DESTBASEDIR/downloads.inc.$l
|
|
|
|
cat $releasetempfile.$l > $DESTBASEDIR/downloads.inc.$l
|
|
|
|
# fi
|
|
|
|
rm -f $releasetempfile.$l
|
|
|
|
done
|
|
|
|
|
|
|
|
exit 0
|