1999-11-11 16:10:37 -01:00
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
# Copyright 1999 Rapha<68>l Hertzog <hertzog@debian.org>
|
|
|
|
|
# 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
|
|
|
|
|
|
2000-12-05 19:53:24 -01:00
|
|
|
|
CDPACKAGES=1
|
|
|
|
|
|
|
|
|
|
if [ "$1"x = "-noPackages.cd"x ] ; then
|
|
|
|
|
shift 1
|
|
|
|
|
CDPACKAGES=0
|
|
|
|
|
fi
|
|
|
|
|
|
2000-06-16 23:42:50 +00:00
|
|
|
|
BDIR=$TDIR/$CODENAME-$ARCH
|
|
|
|
|
|
|
|
|
|
PREFIX=`echo $2 | sed "s?$BDIR/CD?$BDIR/?"`
|
|
|
|
|
|
2001-02-27 00:01:40 -01:00
|
|
|
|
NUM=${PREFIX##$BDIR/}
|
2000-06-16 23:42:50 +00:00
|
|
|
|
NUM=`echo $NUM | sed 's/_NONUS//g'`
|
2000-06-06 17:19:27 +00:00
|
|
|
|
if [ -n "$NONFREE" -o -n "$EXTRANONFREE" ]; then
|
1999-11-11 16:10:37 -01:00
|
|
|
|
SECTIONS="main contrib non-free"
|
|
|
|
|
else
|
|
|
|
|
SECTIONS="main contrib"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
cd "$2"
|
|
|
|
|
|
|
|
|
|
if [ "$1" = "install" ]; then
|
|
|
|
|
|
2001-04-12 10:40:08 +00:00
|
|
|
|
if [ -e "$MIRROR/dists/$CODENAME/Release" ]; then
|
2001-04-25 22:27:55 +00:00
|
|
|
|
# Strip the MD5Sum and SHA1 fields
|
|
|
|
|
sed -e "s/^Architectures: .*$/Architectures: $ARCH/" \
|
|
|
|
|
$MIRROR/dists/$CODENAME/Release | \
|
|
|
|
|
perl -ne 'if (/^(MD5Sum|SHA1):/i) { $f=1; next }
|
|
|
|
|
if ($f) {
|
|
|
|
|
unless (/^ /) { print; $f=0 }
|
|
|
|
|
} else { print }' > dists/$CODENAME/Release
|
2001-04-12 10:40:08 +00:00
|
|
|
|
fi
|
|
|
|
|
if [ -n "$NONUS" -a -e "$NONUS/dists/$CODENAME/non-US/Release" ]; then
|
2001-04-25 22:27:55 +00:00
|
|
|
|
# Strip the MD5Sum and SHA1 fields
|
2001-04-14 20:57:06 +00:00
|
|
|
|
sed -e "/^ /d" -e "s/^Architectures: .*$/Architectures: $ARCH/" \
|
2001-04-25 22:27:55 +00:00
|
|
|
|
$NONUS/dists/$CODENAME/non-US/Release | \
|
|
|
|
|
perl -ne 'if (/^(MD5Sum|SHA1):/i) { $f=1; next }
|
|
|
|
|
if ($f) {
|
|
|
|
|
unless (/^ /) { print; $f=0 }
|
|
|
|
|
} else { print }' > dists/$CODENAME/non-US/Release
|
2001-04-12 10:40:08 +00:00
|
|
|
|
fi
|
|
|
|
|
|
1999-11-11 16:10:37 -01:00
|
|
|
|
for SECT in $SECTIONS; do
|
|
|
|
|
# Install the release files
|
|
|
|
|
cp $MIRROR/dists/$CODENAME/$SECT/binary-$ARCH/Release \
|
|
|
|
|
dists/$CODENAME/$SECT/binary-$ARCH/
|
|
|
|
|
if [ -n "$NONUS" -a "$CODENAME" != "slink" ]; then
|
|
|
|
|
cp $NONUS/dists/$CODENAME/non-US/$SECT/binary-$ARCH/Release \
|
|
|
|
|
dists/$CODENAME/non-US/$SECT/binary-$ARCH/
|
|
|
|
|
fi
|
|
|
|
|
# Install the Packages and Packages.gz files
|
|
|
|
|
grep -v ^X-Medium $PREFIX.Packages-$SECT \
|
|
|
|
|
>dists/$CODENAME/$SECT/binary-$ARCH/Packages
|
|
|
|
|
grep -v ^X-Medium $PREFIX.Packages-$SECT | gzip --best \
|
|
|
|
|
>dists/$CODENAME/$SECT/binary-$ARCH/Packages.gz
|
|
|
|
|
if [ -n "$NONUS" -a "$CODENAME" != "slink" ]; then
|
|
|
|
|
grep -v ^X-Medium $PREFIX.Packages-non-US-$SECT \
|
|
|
|
|
>dists/$CODENAME/non-US/$SECT/binary-$ARCH/Packages
|
|
|
|
|
grep -v ^X-Medium $PREFIX.Packages-non-US-$SECT | gzip --best \
|
|
|
|
|
>dists/$CODENAME/non-US/$SECT/binary-$ARCH/Packages.gz
|
|
|
|
|
fi
|
|
|
|
|
# Install the Packages.cd and Packages.cd.gz files
|
|
|
|
|
# Each CD know about all prior CDs
|
2000-06-16 23:42:50 +00:00
|
|
|
|
# We use "?.packages" here so that we always use US-safe
|
|
|
|
|
# packages files only - we don't want later (supposedly
|
|
|
|
|
# common) CDs having dependencies on a non-US CD#1...
|
2000-12-05 19:53:24 -01:00
|
|
|
|
if [ $CDPACKAGES -eq 1 ] ; then
|
|
|
|
|
for i in $TDIR/$CODENAME-$ARCH/?.packages; do
|
|
|
|
|
dir=${i%%.packages}
|
|
|
|
|
n=${dir##$TDIR/$CODENAME-$ARCH/}
|
|
|
|
|
if [ $n -le $NUM ]; then
|
|
|
|
|
cat $dir.Packages-$SECT \
|
|
|
|
|
>>dists/$CODENAME/$SECT/binary-$ARCH/Packages.cd
|
|
|
|
|
cat $dir.Packages-$SECT | gzip --best \
|
|
|
|
|
>>dists/$CODENAME/$SECT/binary-$ARCH/Packages.cd.gz
|
|
|
|
|
if [ -n "$NONUS" -a "$CODENAME" != "slink" ]; then
|
|
|
|
|
cat $dir.Packages-non-US-$SECT \
|
|
|
|
|
>>dists/$CODENAME/non-US/$SECT/binary-$ARCH/Packages.cd
|
|
|
|
|
cat $dir.Packages-non-US-$SECT | gzip --best \
|
|
|
|
|
>>dists/$CODENAME/non-US/$SECT/binary-$ARCH/Packages.cd.gz
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
1999-11-11 16:10:37 -01:00
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [ -n "$NONUS" -a "$CODENAME" = "slink" ]; then
|
|
|
|
|
cp $NONUS/dists/$CODENAME/non-US/binary-$ARCH/Release \
|
|
|
|
|
dists/$CODENAME/non-US/binary-$ARCH/
|
|
|
|
|
grep -v ^X-Medium $PREFIX.Packages-non-US \
|
|
|
|
|
>dists/$CODENAME/non-US/binary-$ARCH/Packages
|
|
|
|
|
grep -v ^X-Medium $PREFIX.Packages-non-US | gzip --best \
|
|
|
|
|
>dists/$CODENAME/non-US/binary-$ARCH/Packages.gz
|
2000-06-30 00:04:03 +00:00
|
|
|
|
for i in $TDIR/$CODENAME-$ARCH/?.packages; do
|
1999-11-11 16:10:37 -01:00
|
|
|
|
dir=${i%%.packages}
|
|
|
|
|
n=${dir##$TDIR/$CODENAME-$ARCH/}
|
|
|
|
|
if [ $n -le $NUM ]; then
|
|
|
|
|
cat $dir.Packages-non-US \
|
|
|
|
|
>>dists/$CODENAME/non-US/binary-$ARCH/Packages.cd
|
|
|
|
|
cat $dir.Packages-non-US | gzip --best \
|
|
|
|
|
>>dists/$CODENAME/non-US/binary-$ARCH/Packages.cd.gz
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
|
2000-03-07 17:59:31 -01:00
|
|
|
|
if [ -n "$LOCAL" ]; then
|
2000-07-06 10:32:27 +00:00
|
|
|
|
if [ -e ${LOCALDEBS:-$MIRROR}/dists/$CODENAME/local/binary-$ARCH/Release ]; then
|
|
|
|
|
cp ${LOCALDEBS:-$MIRROR}/dists/$CODENAME/local/binary-$ARCH/Release \
|
2000-03-07 17:59:31 -01:00
|
|
|
|
dists/$CODENAME/local/binary-$ARCH/
|
|
|
|
|
fi
|
|
|
|
|
grep -v ^X-Medium $PREFIX.Packages-local \
|
|
|
|
|
>dists/$CODENAME/local/binary-$ARCH/Packages
|
|
|
|
|
grep -v ^X-Medium $PREFIX.Packages-local | gzip --best \
|
|
|
|
|
>dists/$CODENAME/local/binary-$ARCH/Packages.gz
|
|
|
|
|
|
2000-06-30 00:04:03 +00:00
|
|
|
|
for i in $TDIR/$CODENAME-$ARCH/?.packages; do
|
2000-03-07 17:59:31 -01:00
|
|
|
|
dir=${i%%.packages}
|
|
|
|
|
n=${dir##$TDIR/$CODENAME-$ARCH/}
|
|
|
|
|
if [ $n -le $NUM ]; then
|
|
|
|
|
cat $dir.Packages-local \
|
|
|
|
|
>>dists/$CODENAME/local/binary-$ARCH/Packages.cd
|
|
|
|
|
cat $dir.Packages-local | gzip --best \
|
|
|
|
|
>>dists/$CODENAME/local/binary-$ARCH/Packages.cd.gz
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
1999-11-11 16:10:37 -01:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Creates the temp Packages-$SECT files
|
|
|
|
|
if [ "$1" != "scan" ]; then exit 0; fi
|
|
|
|
|
|
|
|
|
|
|
2001-02-27 00:01:40 -01:00
|
|
|
|
if [ ! -e "../overrides" ]; then
|
|
|
|
|
# Create an override file with all sections
|
|
|
|
|
for SECT in $SECTIONS; do
|
|
|
|
|
zcat $MIRROR/indices/override.$CODENAME.$SECT.gz >> ../overrides
|
|
|
|
|
if [ -n "$NONUS" -a "$CODENAME" != "slink" ]; then
|
|
|
|
|
zcat $NONUS/indices-non-US/override.$CODENAME.$SECT.gz \
|
|
|
|
|
>> ../overrides
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Create a Packages file for all packages on the CD
|
|
|
|
|
#
|
|
|
|
|
if [ -d pool ]; then
|
|
|
|
|
dpkg-scanpackages -m "`cat .disk/info`" pool ../overrides \
|
|
|
|
|
> $PREFIX.Packages-BOTH
|
|
|
|
|
fi
|
|
|
|
|
# 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
|
2001-03-25 14:49:14 +00:00
|
|
|
|
if [ -d "dists/$i/main/binary-$ARCH" -o \
|
|
|
|
|
-d "dists/$i/non-free/binary-$ARCH" -o \
|
|
|
|
|
-d "dists/$i/contrib/binary-$ARCH" ]; then
|
2001-02-27 00:01:40 -01:00
|
|
|
|
DISTS="$DISTS $i"
|
|
|
|
|
fi
|
2001-03-25 14:49:14 +00:00
|
|
|
|
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
|
2001-02-27 00:01:40 -01:00
|
|
|
|
DISTSNONUS="$DISTSNONUS $i"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
for SECT in $SECTIONS; do
|
|
|
|
|
for DIST in $DISTS; do
|
|
|
|
|
dpkg-scanpackages -m "`cat .disk/info`" dists/$DIST/$SECT/binary-$ARCH \
|
|
|
|
|
../overrides >> $PREFIX.Packages-BOTH
|
|
|
|
|
done
|
|
|
|
|
for DIST in $DISTSNONUS; do
|
1999-11-11 16:10:37 -01:00
|
|
|
|
if [ -n "$NONUS" -a "$CODENAME" != "slink" ]; then
|
2001-02-27 00:01:40 -01:00
|
|
|
|
dpkg-scanpackages -m "`cat .disk/info`" \
|
|
|
|
|
dists/$DIST/non-US/$SECT/binary-$ARCH \
|
|
|
|
|
../overrides >> $PREFIX.Packages-BOTH
|
1999-11-11 16:10:37 -01:00
|
|
|
|
fi
|
2001-02-27 00:01:40 -01:00
|
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
# Separate non-US from the rest
|
|
|
|
|
grep-dctrl -FFilename -e '/non-[Uu][Ss]/' $PREFIX.Packages-BOTH \
|
|
|
|
|
> $PREFIX.Packages-ALLNONUS
|
|
|
|
|
grep-dctrl -v -FFilename -e '/non-[Uu][Ss]/' $PREFIX.Packages-BOTH \
|
|
|
|
|
> $PREFIX.Packages-ALL
|
|
|
|
|
|
|
|
|
|
# Split the Packages file by section
|
|
|
|
|
for SECT in $SECTIONS; do
|
|
|
|
|
grep-dctrl -FFilename -e "/$SECT/" $PREFIX.Packages-ALL \
|
|
|
|
|
> $PREFIX.Packages-$SECT
|
|
|
|
|
|
|
|
|
|
if [ -n "$NONUS" -a "$CODENAME" != "slink" ]; then
|
|
|
|
|
grep-dctrl -FFilename -e "/$SECT/" $PREFIX.Packages-ALLNONUS \
|
|
|
|
|
> $PREFIX.Packages-non-US-$SECT
|
|
|
|
|
fi
|
1999-11-11 16:10:37 -01:00
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# Slink special case
|
|
|
|
|
if [ -n "$NONUS" -a "$CODENAME" = "slink" ]; then
|
|
|
|
|
dpkg-scanpackages -m "`cat .disk/info`" \
|
|
|
|
|
dists/$CODENAME/non-US/binary-$ARCH \
|
|
|
|
|
$NONUS/indices-non-US/override.$CODENAME.gz \
|
|
|
|
|
> $PREFIX.Packages-non-US
|
|
|
|
|
fi
|
|
|
|
|
|
2000-03-07 17:59:31 -01:00
|
|
|
|
if [ -n "$LOCAL" ]; then
|
|
|
|
|
dpkg-scanpackages -m "`cat .disk/info`" \
|
|
|
|
|
dists/$CODENAME/local/binary-$ARCH \
|
|
|
|
|
/dev/null > $PREFIX.Packages-local
|
|
|
|
|
fi
|
|
|
|
|
|
1999-11-11 16:10:37 -01:00
|
|
|
|
exit 0
|