Make grab_md5 more robust.

If $DI_CODENAME is ever set to a bad value, one would end up trying to
use a non-existing debian-installer, resulting in non-bootable images
way later. To detect that much earlier, make sure all locations
(computed from $CODENAME and $DI_CODENAME) are directories.
This commit is contained in:
Cyril Brulebois 2012-07-13 21:34:54 +00:00
parent ac9aca28db
commit 965b86c295
1 changed files with 9 additions and 0 deletions

View File

@ -8,6 +8,8 @@
# Parse Packages and Sources files out of a mirror and pre-process # Parse Packages and Sources files out of a mirror and pre-process
# them into a single list ready for mkisofs to check later # them into a single list ready for mkisofs to check later
set -e
MIRROR=$1 MIRROR=$1
ARCHES="$2" ARCHES="$2"
CODENAME=$3 CODENAME=$3
@ -19,6 +21,13 @@ do
LOCATIONS="$MIRROR/dists/$CODENAME/ $MIRROR/dists/$DI_CODENAME/" LOCATIONS="$MIRROR/dists/$CODENAME/ $MIRROR/dists/$DI_CODENAME/"
echo "Looking in $LOCATIONS" echo "Looking in $LOCATIONS"
for LOCATION in $LOCATIONS; do
if [ ! -d $LOCATION ]; then
echo "Error: $LOCATION is not a directory"
exit 1
fi
done
case $ARCH in case $ARCH in
source) source)
FILES=`find $LOCATIONS -name Sources.gz` FILES=`find $LOCATIONS -name Sources.gz`