debian-cd-clone/tools/which_deb

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