debian-cd-clone/tools/which_deb

55 lines
1.3 KiB
Bash
Executable File

#!/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
PTH=$MIRROR/dists/$CODENAME/main
case $PKG in
debootstrap)
DEB="$MIRROR/"`zcat $PTH/binary-i386/Packages.gz | \
awk '/\/debootstrap_.*deb/ {print $2}'`
;;
silo)
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
DEB="$MIRROR/"`zcat $PTH/binary-i386/Packages.gz | \
awk '/\/syslinux-common.*deb/ {print $2}'`
if [ "$DEB"x = "$MIRROR/"x ] ; then
DEB="$MIRROR/"`zcat $PTH/binary-i386/Packages.gz | \
awk '/\/syslinux.*deb/ {print $2}'`
fi
;;
yaboot)
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