debian-cd-clone/tools/which_deb

55 lines
1.3 KiB
Plaintext
Raw Normal View History

#!/bin/sh
#
# which_deb
#
# Simple helper tool to find the appropriate version of a package in
# the archive to meet a requirement in the debian-cd build
MIRROR=$1
CODENAME=$2
PKG=$3
2008-09-16 01:40:15 +00:00
PTH=$MIRROR/dists/$CODENAME/main
case $PKG in
debootstrap)
2008-09-16 01:40:15 +00:00
DEB="$MIRROR/"`zcat $PTH/binary-i386/Packages.gz | \
awk '/\/debootstrap_.*deb/ {print $2}'`
;;
silo)
2008-09-16 01:40:15 +00:00
DEB="$MIRROR/"`zcat $PTH/binary-sparc/Packages.gz | \
awk '/\/silo.*deb/ {print $2}'`
;;
syslinux)
# More complex - look for syslinux-common, then fall back to
# syslinux if we don't find that
2008-09-16 01:40:15 +00:00
DEB="$MIRROR/"`zcat $PTH/binary-i386/Packages.gz | \
awk '/\/syslinux-common.*deb/ {print $2}'`
if [ "$DEB"x = "$MIRROR/"x ] ; then
2008-09-16 01:40:15 +00:00
DEB="$MIRROR/"`zcat $PTH/binary-i386/Packages.gz | \
awk '/\/syslinux.*deb/ {print $2}'`
fi
;;
yaboot)
2008-09-16 01:40:15 +00:00
DEB="$MIRROR/"`zcat $PTH/binary-powerpc/Packages.gz | \
awk '/\/yaboot.*deb/ {print $2}'`
;;
*)
# No idea what we should be doing here...
DEB="$MIRROR/"
;;
esac
if [ "$DEB"x = "$MIRROR/"x ] ; then
echo "$0: Failed to find a deb for package $PKG in $MIRROR/"
exit 1
fi
echo $DEB