| 1 |
#! /bin/sh |
| 2 |
|
| 3 |
# Copyright 2004 Steve McIntyre <[email protected]> |
| 4 |
# See the README file for the license |
| 5 |
|
| 6 |
# This script is called by the Makefile to cleanup the .jigdo |
| 7 |
# files: |
| 8 |
# |
| 9 |
# Make sure the iso filename is sane |
| 10 |
# Add in the TEMPLATEURL information |
| 11 |
# Update the Servers lines |
| 12 |
|
| 13 |
jigdo="$1" # .jigdo file to work on |
| 14 |
iso="$2" # The name to give to the .iso |
| 15 |
dirpath="$3" # The disc build tree |
| 16 |
template="$4" # URL for .template file, can be relative URL |
| 17 |
discinfo="$5" # e.g. "Debian GNU/Linux 3.0 r1 "Woody" - Unofficial i386 Binary-1" |
| 18 |
snapurl="$6" # URL for snapshot.d.o. e.g. https://snapshot.debian.org/archive/debian/20110630T000000Z/ |
| 19 |
# any further parameters are fallback URLs |
| 20 |
info="Generated on "`date -R` |
| 21 |
|
| 22 |
# Don't panic - the \047 in the awk below is the ASCII for ' - if I |
| 23 |
# use ' instead, the enclosing shell script gets annoyed...! |
| 24 |
cat $jigdo | awk -v ISO="$iso" -v TEMPLATE="$template" -v DISCINFO="$discinfo" -v INFO="$info" ' |
| 25 |
/^Filename=/ { |
| 26 |
printf("Filename=%s\n", ISO); |
| 27 |
next |
| 28 |
} |
| 29 |
/^Template=/ { |
| 30 |
printf("Template=%s\n", TEMPLATE); |
| 31 |
next |
| 32 |
} |
| 33 |
/^Template-MD5Sum=/ { |
| 34 |
printf("%s\n", $0); |
| 35 |
printf("ShortInfo=\047%s\047\n", DISCINFO); |
| 36 |
printf("Info=\047%s\047\n", INFO); |
| 37 |
next |
| 38 |
} |
| 39 |
/.*/ { print $0 } |
| 40 |
' > $jigdo.1 |
| 41 |
mv -f $jigdo.1 $jigdo |
| 42 |
|
| 43 |
# If some fallbacks were specified, output a servers section with the |
| 44 |
# URLs. The entries of the variable are expected to be already of the |
| 45 |
# form "Label=https://some.url/" |
| 46 |
if test -n "$JIGDOFALLBACKURLS"; then |
| 47 |
for url in "$JIGDOFALLBACKURLS" |
| 48 |
do |
| 49 |
echo "$url" >> $jigdo |
| 50 |
done |
| 51 |
fi |
| 52 |
|
| 53 |
# Snapshot URL - use last |
| 54 |
if [ "$snapurl"x != ""x ] ; then |
| 55 |
# The --try-last switch assigns a lower priority to the URL, |
| 56 |
# so it will only be used if other server entries (without the |
| 57 |
# --try-last) have already been tried without success. |
| 58 |
echo "$snapurl --try-last" >> $jigdo |
| 59 |
fi |
| 60 |
|
| 61 |
# Create a snapshot tree if we've been told where to create one |
| 62 |
if test -n "$JIGDOFALLBACKPATH"; then |
| 63 |
echo "Creating snapshot tree:" |
| 64 |
for jentry in `cat $jigdo | grep =Debian:` |
| 65 |
do |
| 66 |
file=`echo $jentry | sed 's/^.*Debian://g'` |
| 67 |
dir=$JIGDOFALLBACKPATH/Debian/`dirname $file` |
| 68 |
if [ ! -d $dir ] ; then |
| 69 |
mkdir -p $dir |
| 70 |
fi |
| 71 |
ln -f $MIRROR/$file $JIGDOFALLBACKPATH/Debian/$file |
| 72 |
done |
| 73 |
for jentry in `cat $jigdo | grep =Non-US:` |
| 74 |
do |
| 75 |
file=`echo $jentry | sed 's/^.*Non-US://g'` |
| 76 |
dir=$JIGDOFALLBACKPATH/Non-US/`dirname $file` |
| 77 |
if [ ! -d $dir ] ; then |
| 78 |
mkdir -p $dir |
| 79 |
fi |
| 80 |
ln -f $NONUS/$file $JIGDOFALLBACKPATH/Non-US/$file |
| 81 |
done |
| 82 |
fi |
| 83 |
|
| 84 |
|
| 85 |
|