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-06-16 23:42:50 +00:00
|
|
|
|
BDIR=$TDIR/$CODENAME-$ARCH
|
|
|
|
|
|
|
|
|
|
PREFIX=`echo $2 | sed "s?$BDIR/CD?$BDIR/?"`
|
|
|
|
|
|
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"
|
2001-09-09 19:11:21 +00:00
|
|
|
|
SECTIONSNONUS="non-US/main non-US/contrib non-US/non-free"
|
1999-11-11 16:10:37 -01:00
|
|
|
|
else
|
|
|
|
|
SECTIONS="main contrib"
|
2001-09-09 19:11:21 +00:00
|
|
|
|
SECTIONSNONUS="non-US/main non-US/contrib"
|
1999-11-11 16:10:37 -01:00
|
|
|
|
fi
|
|
|
|
|
|
2001-11-09 06:55:23 -01:00
|
|
|
|
if [ -n "$LOCAL" ]; then
|
|
|
|
|
SECTIONS="$SECTIONS local"
|
|
|
|
|
fi
|
|
|
|
|
|
1999-11-11 16:10:37 -01:00
|
|
|
|
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
|
2001-09-09 19:11:21 +00:00
|
|
|
|
# Update some other information as well
|
2001-04-25 22:27:55 +00:00
|
|
|
|
sed -e "s/^Architectures: .*$/Architectures: $ARCH/" \
|
|
|
|
|
$MIRROR/dists/$CODENAME/Release | \
|
2001-09-10 20:14:08 +00:00
|
|
|
|
sed -e "s|^Components: .*$|Components: $SECTIONS|" | \
|
2001-04-25 22:27:55 +00:00
|
|
|
|
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-09-09 19:11:21 +00:00
|
|
|
|
# Update some other information as well
|
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 | \
|
2001-09-10 20:14:08 +00:00
|
|
|
|
sed -e "s|^Components: .*$|Components: $SECTIONSNONUS|" | \
|
2001-04-25 22:27:55 +00:00
|
|
|
|
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
|
|
|
|
|
|
2001-11-09 06:55:23 -01:00
|
|
|
|
# Copying release files
|
1999-11-11 16:10:37 -01:00
|
|
|
|
for SECT in $SECTIONS; do
|
|
|
|
|
# Install the release files
|
2001-11-09 06:55:23 -01:00
|
|
|
|
if [ -e "$MIRROR/dists/$CODENAME/$SECT/binary-$ARCH/Release" ]; then
|
|
|
|
|
cp $MIRROR/dists/$CODENAME/$SECT/binary-$ARCH/Release \
|
1999-11-11 16:10:37 -01:00
|
|
|
|
dists/$CODENAME/$SECT/binary-$ARCH/
|
2001-11-09 06:55:23 -01:00
|
|
|
|
fi
|
2001-10-06 15:55:12 +00:00
|
|
|
|
if [ -n "$NONUS" ]; then
|
1999-11-11 16:10:37 -01:00
|
|
|
|
cp $NONUS/dists/$CODENAME/non-US/$SECT/binary-$ARCH/Release \
|
|
|
|
|
dists/$CODENAME/non-US/$SECT/binary-$ARCH/
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
2001-11-09 06:55:23 -01:00
|
|
|
|
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 \
|
2000-03-07 17:59:31 -01:00
|
|
|
|
dists/$CODENAME/local/binary-$ARCH/
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2001-11-09 06:55:23 -01:00
|
|
|
|
# Generating Packages files
|
|
|
|
|
apt-ftparchive generate $PREFIX.generate-binary
|
|
|
|
|
if [ -n "$NONUS" ]; then
|
|
|
|
|
apt-ftparchive generate $PREFIX.generate-binary-non-US
|
1999-11-11 16:10:37 -01:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
2001-10-06 15:55:12 +00:00
|
|
|
|
fi
|
2001-02-27 00:01:40 -01:00
|
|
|
|
|
2001-11-09 06:55:23 -01:00
|
|
|
|
# Prepare the files needed to generate the Packages files
|
|
|
|
|
if [ "$1" != "scan" ]; then exit 0; fi
|
|
|
|
|
|
2001-02-27 00:01:40 -01:00
|
|
|
|
#
|
2001-11-09 06:55:23 -01:00
|
|
|
|
# Create the file lists and the config files for apt-ftparchive generate
|
2001-02-27 00:01:40 -01:00
|
|
|
|
#
|
2001-11-09 06:55:23 -01:00
|
|
|
|
|
2001-02-27 00:01:40 -01:00
|
|
|
|
# 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
|
2001-11-09 06:55:23 -01:00
|
|
|
|
# Creating the file lists
|
2001-02-27 00:01:40 -01:00
|
|
|
|
for SECT in $SECTIONS; do
|
2001-11-09 06:55:23 -01:00
|
|
|
|
touch $PREFIX.filelist_$SECT
|
|
|
|
|
if [ -d "pool/$SECT" ]; then
|
|
|
|
|
find pool/$SECT >>$PREFIX.filelist_$SECT
|
|
|
|
|
fi
|
2001-02-27 00:01:40 -01:00
|
|
|
|
for DIST in $DISTS; do
|
2001-11-09 06:55:23 -01:00
|
|
|
|
if [ -d "dists/$DIST/$SECT/binary-$ARCH" ]; then
|
|
|
|
|
find dists/$DIST/$SECT/binary-$ARCH >>$PREFIX.filelist_$SECT
|
1999-11-11 16:10:37 -01:00
|
|
|
|
fi
|
2001-02-27 00:01:40 -01:00
|
|
|
|
done
|
2001-10-06 15:55:12 +00:00
|
|
|
|
if [ -n "$NONUS" ]; then
|
2001-11-09 06:55:23 -01:00
|
|
|
|
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
|
2001-02-27 00:01:40 -01:00
|
|
|
|
fi
|
1999-11-11 16:10:37 -01:00
|
|
|
|
done
|
2001-11-09 06:55:23 -01:00
|
|
|
|
# Creating the config files
|
|
|
|
|
cat >$PREFIX.generate-binary <<EOF
|
|
|
|
|
Dir::ArchiveDir "$2";
|
|
|
|
|
Dir::OverrideDir "$BDIR/indices";
|
|
|
|
|
Dir::CacheDir "$APTTMP/$CODENAME-$ARCH/apt-ftparchive-db";
|
|
|
|
|
|
|
|
|
|
TreeDefault::Contents " ";
|
|
|
|
|
|
|
|
|
|
Tree "dists/$CODENAME" {
|
|
|
|
|
FileList "$PREFIX.filelist_\$(SECTION)";
|
|
|
|
|
Sections "$SECTIONS";
|
|
|
|
|
Architectures "$ARCH";
|
|
|
|
|
|
|
|
|
|
BinOverride "override.$CODENAME.\$(SECTION)";
|
|
|
|
|
ExtraOverride "override.$CODENAME.extra.\$(SECTION)";
|
|
|
|
|
SrcOverride "override.$CODENAME.\$(SECTION).src";
|
|
|
|
|
}
|
|
|
|
|
EOF
|
|
|
|
|
cat >$PREFIX.generate-binary-non-US <<EOF
|
|
|
|
|
Dir::ArchiveDir "$2";
|
|
|
|
|
Dir::OverrideDir "$BDIR/indices-non-US";
|
|
|
|
|
Dir::CacheDir "$APTTMP/$CODENAME-$ARCH/apt-ftparchive-db";
|
|
|
|
|
|
|
|
|
|
TreeDefault::Contents " ";
|
|
|
|
|
|
|
|
|
|
Tree "dists/$CODENAME/non-US" {
|
|
|
|
|
FileList "$PREFIX.filelist_non-US_\$(SECTION)";
|
|
|
|
|
Sections "`echo $SECTIONSNONUS | sed -e 's#non-US/##g'`";
|
|
|
|
|
Architectures "$ARCH";
|
|
|
|
|
|
|
|
|
|
BinOverride "override.$CODENAME.\$(SECTION)";
|
|
|
|
|
ExtraOverride "override.$CODENAME.extra.\$(SECTION)";
|
|
|
|
|
SrcOverride "override.$CODENAME.\$(SECTION).src";
|
|
|
|
|
}
|
|
|
|
|
EOF
|
|
|
|
|
# Creating the indices directory
|
|
|
|
|
if [ ! -d "$BDIR/indices" ]; then
|
|
|
|
|
mkdir $BDIR/indices
|
|
|
|
|
cp $MIRROR/indices/* $BDIR/indices/
|
|
|
|
|
if [ -n "$LOCALDEBS" -a -d $LOCALDEBS/indices ]; then
|
|
|
|
|
cp $LOCALDEBS/indices/* $BDIR/indices/
|
|
|
|
|
fi
|
|
|
|
|
gunzip -f $BDIR/indices/*.gz
|
|
|
|
|
for SECT in $SECTIONS; do
|
|
|
|
|
touch $BDIR/indices/override.$CODENAME.$SECT
|
|
|
|
|
touch $BDIR/indices/override.$CODENAME.extra.$SECT
|
|
|
|
|
touch $BDIR/indices/override.$CODENAME.$SECT.src
|
|
|
|
|
done
|
|
|
|
|
fi
|
|
|
|
|
if [ -n "$NONUS" -a ! -d "$BDIR/indices-non-US" ]; then
|
|
|
|
|
mkdir $BDIR/indices-non-US
|
|
|
|
|
cp $NONUS/indices-non-US/* $BDIR/indices-non-US/
|
|
|
|
|
gunzip -f $BDIR/indices-non-US/*.gz
|
|
|
|
|
for SECT in `echo $SECTIONSNONUS | sed -e 's#non-US/##g'`; do
|
|
|
|
|
touch $BDIR/indices-non-US/override.$CODENAME.$SECT
|
|
|
|
|
touch $BDIR/indices-non-US/override.$CODENAME.extra.$SECT
|
|
|
|
|
touch $BDIR/indices-non-US/override.$CODENAME.$SECT.src
|
|
|
|
|
done
|
2000-03-07 17:59:31 -01:00
|
|
|
|
fi
|
|
|
|
|
|
1999-11-11 16:10:37 -01:00
|
|
|
|
exit 0
|