found at 
https://code.launchpad.net/~mythbuntu/mythbuntu/mythbuntu-metalink-creator

#!/bin/bash

#####################
#
# License:
#
# Copyright (c) 2008  Thomas Mashos
#
# This script is based on nothing really.  I needed to generate a
metalink file that
# looked like the metalink files Ubuntu provides.  I couldn't get any
of the metalink
# generators to work, so this was born.  I know it's hacky and sucks,
but it's all that
# works for me so deal with it.
#
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 3 of the License, or
# * (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
#
# On Ubuntu systems, a copy of the GPLv3 is available in
/usr/share/common-licenses/GPL-3
#
#####################

echo "test 1"
echo "test 2" >> /mnt/storage/media/Mythbuntu-dailies/test.log
echo "test 3" >> /mnt/storage/media/Mythbuntu-dailies/test.log 2>&1
sudo echo "test 4" >> /mnt/storage/media/Mythbuntu-dailies/test.log
sudo echo "test 5" >> /mnt/storage/media/Mythbuntu-dailies/test.log 2>&1


DATE=`date -R`
DATEDIR=`date '+%Y%m%d'`

if [ -z "$VERSION" ] ; then
    VERSION='8.10'
fi

if [ -z "$ARCH" ] ; then
    ARCH='i386'
fi

if [ -z "$WORKDIR" ] ; then
    WORKDIR=/mnt/storage/media/Mythbuntu-dailies/$DATEDIR
fi



METALINKFILENAME=mythbuntu-$VERSION-desktop-$ARCH.metalink
METALINKFILE=$WORKDIR/$METALINKFILENAME

ISONAME=$WORKDIR/mythbuntu-$VERSION-desktop-$ARCH.iso

ISOSIZE=`ls -s $ISONAME | cut -f1 -d' '`

ISOMD5=`cat $ISONAME.md5sum | cut -f1 -d' '`

if [ $ARCH = "i386" ] ; then
  OS="linux-x86"
elif [ $ARCH = "amd64" ] ; then
  OS="linux-x64"
fi

echo '<?xml version="1.0" encoding="utf-8"?>' > $METALINKFILE
echo '<?xml-stylesheet type="text/xsl"
href="http://download.eclipse.org/eclipse/metalink.xsl";?>' >>
$METALINKFILE
echo '' >> $METALINKFILE
echo '<metalink version="3.0" pubdate="'$DATE'"
xmlns="http://www.metalinker.org/";>' >> $METALINKFILE
echo '  <publisher>' >> $METALINKFILE
echo '    <name>Mythbuntu</name>' >> $METALINKFILE
echo '    <url>http://www.mythbuntu.org/</url>' >> $METALINKFILE
echo '  </publisher>' >> $METALINKFILE
echo '  <version>'$VERSION'</version>' >> $METALINKFILE
echo '  <description>Mythbuntu CD Image</description>' >> $METALINKFILE
echo '  <logo>http://www.mythbuntu.org/files/mythbuntu_logo.png</logo>'
>> $METALINKFILE
echo '  <files>' >> $METALINKFILE
echo '    <file name="'$ISONAME'">' >> $METALINKFILE
echo '      <size>'$ISOSIZE'</size>' >> $METALINKFILE
echo '      <os>"'$OS'"</os>' >> $METALINKFILE
echo '      <verification>' >> $METALINKFILE
echo '        <hash type="md5">'$ISOMD5'</hash>' >> $METALINKFILE
echo '      </verification>' >> $METALINKFILE
echo '      <resources>' >> $METALINKFILE
#echo '                 <url type="http" location="us"
preference="70">http://www.mythbuntu.org/download/?file=mythbuntu-8.04.1-desktop-i386.iso</url>'
>> $METALINKFILE
echo '                  <url type="http" location="au"
preference="150">http://mirror.internode.on.net/pub/mythbuntu/</url>'
>> $METALINKFILE
echo '                  <url type="http" location="us"
preference="150">http://osuosl.cdimages.mythbuntu.org/</url>' >>
$METALINKFILE
echo '                  <url type="http" location="uk"
preference="150">http://cdimages.mythbuntu.org/</url>' >>
$METALINKFILE
echo '                  <url type="http" location="us"
preference="75">http://us-ca2.cdimages.mythbuntu.org/</url>' >>
$METALINKFILE
#echo '                 <url type="http" location="us"
preference="50">http://us-az.cdimages.mythbuntu.org/</url>' >>
$METALINKFILE
#echo '                 <url type="http" location="us"
preference="50">http://us-ut.cdimages.mythbuntu.org/</url>' >>
$METALINKFILE
echo '                  <url type="http" location="de"
preference="22">http://germany.cdimages.mythbuntu.org/</url>' >>
$METALINKFILE
#echo '                 <url type="http" location="us"
preference="5">http://us-mi.cdimages.mythbuntu.org/</url>' >>
$METALINKFILE
echo '                  <url type="http" location="us"
preference="5">http://us-ia.cdimages.mythbuntu.org/</url>' >>
$METALINKFILE
echo '      </resources>' >> $METALINKFILE
echo '    </file>' >> $METALINKFILE
echo '  </files>' >> $METALINKFILE
echo '</metalink>' >> $METALINKFILE

md5sum $METALINKFILE | sed -e
"s/\/mnt\/storage\/media\/Mythbuntu-dailies\/$DATEDIR\///g" >>
$WORKDIR/mythbuntu-$VERSION-metalink.md5sum

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Metalink Discussion" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/metalink-discussion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to