#!/bin/sh # Copyright 1999 Raphaël Hertzog # See the README file for the license # This script will create the Packages.gz and the Packages.cd files # First arg = "scan" or "install" # Second arg = directory of the CD #set -e BDIR=$TDIR/$CODENAME-$ARCH PREFIX=`echo $2 | sed "s?$BDIR/CD?$BDIR/?"` SECTIONS="main" SECTIONSNONUS="non-US/main" if [ "${NONFREE:-0}" != "0" -o "${EXTRANONFREE:-0}" != "0" ]; then SECTIONS="${SECTIONS} non-free" SECTIONSNONUS="${SECTIONSNONUS} non-US/non-free" fi if [ "${CONTRIB:-0}" != "0" ]; then SECTIONS="${SECTIONS} contrib" SECTIONSNONUS="${SECTIONSNONUS} non-US/contrib" fi if [ -n "$LOCAL" ]; then SECTIONS="$SECTIONS local" fi cd "$2" if [ "$1" = "install" ]; then # these two lines can be inserted below the "Architectures" line below, # to sort out broken Release files just after the testing --> stable # transition # sed -e "s/^Suite: .*$/Suite: stable/" | \ # sed -e "s/^Description: .*$/Description: Debian $DEBVERSION/" | \ if [ -e "$MIRROR/dists/$CODENAME/Release" ]; then # Strip the MD5Sum and SHA1 fields # Update some other information as well sed -e "s/^Architectures: .*$/Architectures: $ARCH/" \ $MIRROR/dists/$CODENAME/Release | \ sed -e "s|^Components: .*$|Components: $SECTIONS|" | \ perl -ne 'if (/^(MD5Sum|SHA1):/i) { $f=1; next } if ($f) { unless (/^ /) { print; $f=0 } } else { print }' > dists/$CODENAME/Release else echo "ERROR: Release file ($MIRROR/dists/$CODENAME/Release) is missing !" exit 1 fi if [ -n "$NONUS" ]; then if [ -e "$NONUS/dists/$CODENAME/non-US/Release" ]; then # Strip the MD5Sum and SHA1 fields # Update some other information as well sed -e "/^ /d" -e "s/^Architectures: .*$/Architectures: $ARCH/" \ $NONUS/dists/$CODENAME/non-US/Release | \ sed -e "s|^Components: .*$|Components: $SECTIONSNONUS|" | \ perl -ne 'if (/^(MD5Sum|SHA1):/i) { $f=1; next } if ($f) { unless (/^ /) { print; $f=0 } } else { print }' > dists/$CODENAME/non-US/Release else echo -n "ERROR: Release file ($NONUS/dists/$CODENAME/non-US/Release)" echo " is missing !" exit 1 fi fi # Copying release files for SECT in $SECTIONS; do # Install the release files if [ -e "$MIRROR/dists/$CODENAME/$SECT/binary-$ARCH/Release" ]; then cp $MIRROR/dists/$CODENAME/$SECT/binary-$ARCH/Release \ dists/$CODENAME/$SECT/binary-$ARCH/ fi if [ -n "$NONUS" -a -e "$NONUS/dists/$CODENAME/non-US/$SECT/binary-$ARCH/Release" ]; then cp $NONUS/dists/$CODENAME/non-US/$SECT/binary-$ARCH/Release \ dists/$CODENAME/non-US/$SECT/binary-$ARCH/ fi done if [ -n "$LOCALDEBS" -a -n "$LOCAL" ]; then if [ -e $LOCALDEBS/dists/$CODENAME/local/binary-$ARCH/Release ]; then cp $LOCALDEBS/dists/$CODENAME/local/binary-$ARCH/Release \ dists/$CODENAME/local/binary-$ARCH/ fi fi if [ -e "$MIRROR/dists/$DI_CODENAME/main/debian-installer/binary-$ARCH/Release" ]; then cp $MIRROR/dists/$DI_CODENAME/main/debian-installer/binary-$ARCH/Release \ dists/$CODENAME/main/debian-installer/binary-$ARCH/ fi # Generating Packages files apt-ftparchive generate $PREFIX.generate-binary if [ -n "$NONUS" ]; then apt-ftparchive generate $PREFIX.generate-binary-non-US fi if [ -e "$MIRROR/dists/$DI_CODENAME/main/debian-installer" ]; then apt-ftparchive generate $PREFIX.generate-binary-debian-installer fi fi ## END "$1" = "install" # Prepare the files needed to generate the Packages files if [ "$1" != "scan" ]; then exit 0; fi # # Create the file lists and the config files for apt-ftparchive generate # # We have to scan all possible dists where packages can be DISTS="" DISTSNONUS="" for i in `cd dists; echo *; cd ..`; do if [ ! -L "dists/$i" -a -d "dists/$i" ]; then if [ -d "dists/$i/main/binary-$ARCH" -o \ -d "dists/$i/non-free/binary-$ARCH" -o \ -d "dists/$i/contrib/binary-$ARCH" ]; then DISTS="$DISTS $i" fi if [ -n "$SECURITY" ]; then DISTS="$DISTS $i/updates" fi if [ -d "dists/$i/non-US/main/binary-$ARCH" -o \ -d "dists/$i/non-US/non-free/binary-$ARCH" -o \ -d "dists/$i/non-US/contrib/binary-$ARCH" ]; then DISTSNONUS="$DISTSNONUS $i" fi fi done # Creating the file lists for SECT in $SECTIONS; do touch $PREFIX.filelist_$SECT if [ -d "pool/$SECT" ]; then find pool/$SECT >>$PREFIX.filelist_$SECT fi if [ -d "pool/unstable/$SECT" ]; then find pool/unstable/$SECT >>$PREFIX.filelist_$SECT fi if [ -n "$SECURITY" -a -d "pool/updates/$SECT" ]; then find pool/updates/$SECT >>$PREFIX.filelist_$SECT fi for DIST in $DISTS; do if [ -d "dists/$DIST/$SECT/binary-$ARCH" ]; then find dists/$DIST/$SECT/binary-$ARCH >>$PREFIX.filelist_$SECT fi done if [ -n "$NONUS" ]; then touch $PREFIX.filelist_non-US_$SECT if [ -d "pool/non-US/$SECT" ]; then find pool/non-US/$SECT >>$PREFIX.filelist_non-US_$SECT fi for DIST in $DISTSNONUS; do if [ -d "dists/$DIST/non-US/$SECT/binary-$ARCH" ]; then find dists/$DIST/non-US/$SECT/binary-$ARCH \ >>$PREFIX.filelist_non-US_$SECT fi done fi done # Creating the config files # SAM 2005-11-01: # Nasty hack - we may need to look at extra override files from sid. # See if the extra override exists; if not redirect. EXTRA_CODENAME=$CODENAME if [ ! -e $BDIR/indices/override.$EXTRA_CODENAME.extra.main ] ; then EXTRA_CODENAME=sid fi cat >$PREFIX.generate-binary <$PREFIX.generate-binary-non-US <$PREFIX.generate-binary-debian-installer <>$PREFIX.generate-binary-debian-installer <