Adding two new helper scripts needed for JTE changes
This commit is contained in:
parent
537afe73f2
commit
d137795c8d
|
@ -0,0 +1,94 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# grab_md5
|
||||
# (c) 2004 Steve McIntyre <steve@einval.com>
|
||||
#
|
||||
# GPL v2
|
||||
#
|
||||
# Parse Packages and Sources files out of a mirror and pre-process
|
||||
# them into a single list ready for mkisofs to check later
|
||||
|
||||
MIRROR=$1
|
||||
ARCH=$2
|
||||
SUITE=$3
|
||||
OUT=$4
|
||||
|
||||
case $ARCH in
|
||||
source)
|
||||
FILES=`find $MIRROR/dists/$SUITE/ -name Sources.gz`
|
||||
echo -e "Using MD5 sums from Sources files:\n$FILES"
|
||||
zcat -f $FILES | awk -v MIRROR=$MIRROR '
|
||||
/^Directory:/ {
|
||||
DIR = $2
|
||||
next
|
||||
}
|
||||
/^Files:/ {
|
||||
in_files = 1
|
||||
next
|
||||
}
|
||||
/^ / {
|
||||
if (in_files) {
|
||||
gsub("^ ", "", $0)
|
||||
MD5 = $1
|
||||
SIZE = $2
|
||||
FILE = $3
|
||||
printf("%s %12s %s/%s/%s\n", MD5, SIZE, MIRROR, DIR, FILE);
|
||||
}
|
||||
}
|
||||
/.*/ {
|
||||
if (!length($0)) {
|
||||
in_files = 0
|
||||
next
|
||||
}
|
||||
}' | sort | uniq >> $OUT
|
||||
;;
|
||||
alpha|amd64|arm|hppa|i386|ia64|m68k|mips|mipsel|powerpc|s390|sparc)
|
||||
FILES=`find $MIRROR/dists/$SUITE/ -name Packages -o -name Packages.gz | grep binary-$ARCH`
|
||||
echo -e "Using MD5 sums from Packages files:\n$FILES"
|
||||
zcat -f $FILES | awk -v MIRROR=$MIRROR '
|
||||
/^Filename:/ {
|
||||
FILE = $2
|
||||
}
|
||||
/^Size:/ {
|
||||
SIZE = $2
|
||||
}
|
||||
/^MD5sum:/ {
|
||||
MD5 = $2
|
||||
printf("%s %12d %s/%s\n", MD5, SIZE, MIRROR, FILE)
|
||||
}' | sort | uniq >> $OUT
|
||||
case $SUITE in
|
||||
woody)
|
||||
# Use the old boot-floppies images
|
||||
FILE=$MIRROR/dists/$SUITE/main/disks-$ARCH/current/md5sum.txt
|
||||
echo "Using MD5 sums from boot-floppies: $FILE"
|
||||
LOC=dists/$SUITE/main/disks-$ARCH/current
|
||||
for ENTRY in `cat $FILE | sed 's/ /:/g'`
|
||||
do
|
||||
PATH=`echo $ENTRY | /bin/sed "s?^.*:\./?$MIRROR/$LOC/?g"`
|
||||
MD5=`echo $ENTRY | /bin/sed 's/:.*$//g'`
|
||||
SIZE=`/usr/bin/stat -c %s $PATH`
|
||||
printf '%s %12.12s %s\n' $MD5 $SIZE $PATH
|
||||
done | sort | uniq >> $OUT
|
||||
;;
|
||||
*)
|
||||
# Use the new D-I images
|
||||
FILE=$MIRROR/dists/$SUITE/main/installer-$ARCH/current/images/MD5SUMS
|
||||
echo "Using MD5 sums from d-i: $FILE"
|
||||
LOC=dists/$SUITE/main/installer-$ARCH/current/images
|
||||
for ENTRY in `cat $FILE | sed 's/ /:/g'`
|
||||
do
|
||||
PATH=`echo $ENTRY | /bin/sed "s?^.*:\./?$MIRROR/$LOC/?g"`
|
||||
MD5=`echo $ENTRY | /bin/sed 's/:.*$//g'`
|
||||
SIZE=`/usr/bin/stat -c %s $PATH`
|
||||
printf '%s %12.12s %s\n' $MD5 $SIZE $PATH
|
||||
done | sort | uniq >> $OUT
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "Unknown arch/source $ARCH!"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,79 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Copyright 2004 Steve McIntyre <steve@einval.com>
|
||||
# See the README file for the license
|
||||
|
||||
# This script is called by the Makefile to cleanup the .jigdo
|
||||
# files:
|
||||
#
|
||||
# Make sure the iso filename is sane
|
||||
# Add in the TEMPLATEURL information
|
||||
# Update the Servers lines
|
||||
|
||||
jigdo="$1" # .jigdo file to work on
|
||||
iso="$2" # The name to give to the .iso
|
||||
dirpath="$3" # The disc build tree
|
||||
template="$4" # URL for .template file, can be relative URL
|
||||
discinfo="$5" # e.g. "Debian GNU/Linux 3.0 r1 "Woody" - Unofficial i386 Binary-1"
|
||||
# any further parameters are fallback URLs
|
||||
info="Generated on "`date -R`
|
||||
|
||||
# Don't panic - the \047 in the awk below is the ASCII for ' - if I
|
||||
# use ' instead, the enclosing shell script gets annoyed...!
|
||||
cat $jigdo | awk -v ISO="$iso" -v TEMPLATE="$template" -v DISCINFO="$discinfo" -v INFO="$info" '
|
||||
/^Filename=/ {
|
||||
printf("Filename=%s\n", ISO);
|
||||
next
|
||||
}
|
||||
/^Template=/ {
|
||||
printf("Template=%s\n", TEMPLATE);
|
||||
next
|
||||
}
|
||||
/^Template-MD5Sum=/ {
|
||||
printf("%s\n", $0);
|
||||
printf("ShortInfo=\047%s\047\n", DISCINFO);
|
||||
printf("Info=\047%s\047\n", INFO);
|
||||
next
|
||||
}
|
||||
/.*/ { print $0 }
|
||||
' > $jigdo.1
|
||||
mv -f $jigdo.1 $jigdo
|
||||
|
||||
# If some fallbacks were specified, output a servers section with the
|
||||
# URLs. The entries of the variable are expected to be already of the
|
||||
# form "Label=http://some.url/"
|
||||
if test -n "$JIGDOFALLBACKURLS"; then
|
||||
for url in "$JIGDOFALLBACKURLS"
|
||||
do
|
||||
# The --try-last switch assigns a lower priority to the URL,
|
||||
# so it will only be used if other server entries (without the
|
||||
# --try-last) have already been tried without success.
|
||||
echo "$url --try-last" >> $jigdo
|
||||
done
|
||||
fi
|
||||
|
||||
# Create a snapshot tree if we've been told where to create one
|
||||
if test -n "$JIGDOFALLBACKPATH"; then
|
||||
echo "Creating snapshot tree:"
|
||||
for jentry in `cat $jigdo | grep =Debian:`
|
||||
do
|
||||
file=`echo $jentry | sed 's/^.*Debian://g'`
|
||||
dir=$JIGDOFALLBACKPATH/Debian/`dirname $file`
|
||||
if [ ! -d $dir ] ; then
|
||||
mkdir -p $dir
|
||||
fi
|
||||
ln -f $MIRROR/$file $JIGDOFALLBACKPATH/Debian/$file
|
||||
done
|
||||
for jentry in `cat $jigdo | grep =Non-US:`
|
||||
do
|
||||
file=`echo $jentry | sed 's/^.*Non-US://g'`
|
||||
dir=$JIGDOFALLBACKPATH/Non-US/`dirname $file`
|
||||
if [ ! -d $dir ] ; then
|
||||
mkdir -p $dir
|
||||
fi
|
||||
ln -f $NONUS/$file $JIGDOFALLBACKPATH/Non-US/$file
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue