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/?"`
|
|
|
|
|
|
2002-12-07 09:22:40 -01:00
|
|
|
|
SECTIONS="main"
|
|
|
|
|
SECTIONSNONUS="non-US/main"
|
2002-04-13 12:17:57 +00:00
|
|
|
|
if [ "${NONFREE:-0}" != "0" -o "${EXTRANONFREE:-0}" != "0" ]; then
|
2002-12-07 09:22:40 -01:00
|
|
|
|
SECTIONS="${SECTIONS} non-free"
|
|
|
|
|
SECTIONSNONUS="${SECTIONSNONUS} non-US/non-free"
|
|
|
|
|
fi
|
|
|
|
|
if [ "${CONTRIB:-0}" != "0" ]; then
|
|
|
|
|
SECTIONS="${SECTIONS} contrib"
|
|
|
|
|
SECTIONSNONUS="${SECTIONSNONUS} 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
|
|
|
|
|
|
2002-10-10 12:56:48 +00:00
|
|
|
|
|
|
|
|
|
|
1999-11-11 16:10:37 -01:00
|
|
|
|
cd "$2"
|
|
|
|
|
|
|
|
|
|
if [ "$1" = "install" ]; then
|
|
|
|
|
|
2002-12-20 00:46:25 -01:00
|
|
|
|
# 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/" | \
|
|
|
|
|
|
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 | \
|
2005-06-04 14:36:59 +00:00
|
|
|
|
sed -e "s/^Suite: .*$/Suite: stable/" | \
|
|
|
|
|
sed -e "s/^Description: .*$/Description: Debian $DEBVERSION/" | \
|
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-12-29 17:52:24 -01:00
|
|
|
|
else
|
|
|
|
|
echo "ERROR: Release file ($MIRROR/dists/$CODENAME/Release) is missing !"
|
|
|
|
|
exit 1
|
2001-04-12 10:40:08 +00:00
|
|
|
|
fi
|
2001-12-29 17:52:24 -01:00
|
|
|
|
if [ -n "$NONUS" ]; then
|
|
|
|
|
if [ -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-12-29 17:52:24 -01:00
|
|
|
|
else
|
|
|
|
|
echo -n "ERROR: Release file ($NONUS/dists/$CODENAME/non-US/Release)"
|
|
|
|
|
echo " is missing !"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
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
|
2002-10-10 12:56:48 +00:00
|
|
|
|
# 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
|
1999-11-11 16:10:37 -01:00
|
|
|
|
done
|
|
|
|
|
|
2001-11-09 06:55:23 -01:00
|
|
|
|
if [ -n "$LOCALDEBS" -a -n "$LOCAL" ]; then
|
2002-10-10 12:56:48 +00:00
|
|
|
|
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
|
|
|
|
|
|
2004-03-08 12:43:40 -01:00
|
|
|
|
if [ -e "$MIRROR/dists/$DI_CODENAME/main/debian-installer/binary-$ARCH/Release" ]; then
|
|
|
|
|
cp $MIRROR/dists/$DI_CODENAME/main/debian-installer/binary-$ARCH/Release \
|
2002-10-10 12:56:48 +00:00
|
|
|
|
dists/$CODENAME/main/debian-installer/binary-$ARCH/
|
2000-03-07 17:59:31 -01:00
|
|
|
|
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
|
2004-03-08 12:43:40 -01:00
|
|
|
|
if [ -e "$MIRROR/dists/$DI_CODENAME/main/debian-installer" ]; then
|
2002-10-10 12:56:48 +00:00
|
|
|
|
apt-ftparchive generate $PREFIX.generate-binary-debian-installer
|
2001-10-06 15:55:12 +00:00
|
|
|
|
fi
|
2001-02-27 00:01:40 -01:00
|
|
|
|
|
2002-10-10 12:56:48 +00:00
|
|
|
|
fi ## END "$1" = "install"
|
|
|
|
|
|
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
|
2002-03-21 17:30:24 -01:00
|
|
|
|
if [ -n "$SECURITY" ]; then
|
|
|
|
|
DISTS="$DISTS $i/updates"
|
|
|
|
|
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
|
2004-12-08 21:40:45 -01:00
|
|
|
|
if [ -d "pool/unstable/$SECT" ]; then
|
|
|
|
|
find pool/unstable/$SECT >>$PREFIX.filelist_$SECT
|
|
|
|
|
fi
|
2002-07-11 21:40:17 +00:00
|
|
|
|
if [ -n "$SECURITY" -a -d "pool/updates/$SECT" ]; then
|
|
|
|
|
find pool/updates/$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
|
2002-10-10 12:56:48 +00:00
|
|
|
|
cat >$PREFIX.generate-binary-debian-installer <<EOF
|
|
|
|
|
Dir::ArchiveDir "$2";
|
|
|
|
|
Dir::OverrideDir "$BDIR/indices";
|
|
|
|
|
Dir::CacheDir "$APTTMP/$CODENAME-$ARCH/apt-ftparchive-db";
|
|
|
|
|
|
|
|
|
|
TreeDefault::Contents " ";
|
|
|
|
|
|
|
|
|
|
Tree "dists/$CODENAME/main" {
|
|
|
|
|
FileList "$PREFIX.filelist_main";
|
|
|
|
|
Sections "debian-installer";
|
|
|
|
|
Architectures "$ARCH";
|
|
|
|
|
|
|
|
|
|
BinOverride "override.$CODENAME.main.\$(SECTION)";
|
|
|
|
|
ExtraOverride "override.$CODENAME.extra.main";
|
|
|
|
|
SrcOverride "override.$CODENAME.main.src";
|
|
|
|
|
Packages::Extensions ".udeb";
|
|
|
|
|
}
|
|
|
|
|
EOF
|
2004-03-08 12:43:40 -01:00
|
|
|
|
if [ -n "$LOCAL" -a -e "${LOCALDEBS:-$MIRROR}/dists/$DI_CODENAME/local/debian-installer" ]; then
|
2002-10-10 12:56:48 +00:00
|
|
|
|
cat >>$PREFIX.generate-binary-debian-installer <<EOF
|
|
|
|
|
|
|
|
|
|
Tree "dists/$CODENAME/local" {
|
2005-01-12 15:11:51 -01:00
|
|
|
|
FileList "$PREFIX.filelist_local";
|
2002-10-10 12:56:48 +00:00
|
|
|
|
Sections "debian-installer";
|
|
|
|
|
Architectures "$ARCH";
|
|
|
|
|
|
|
|
|
|
BinOverride "override.$CODENAME.local.\$(SECTION)";
|
|
|
|
|
ExtraOverride "override.$CODENAME.extra.local";
|
|
|
|
|
SrcOverride "override.$CODENAME.local.src";
|
|
|
|
|
Packages::Extensions ".udeb";
|
|
|
|
|
}
|
|
|
|
|
EOF
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
2001-11-09 06:55:23 -01:00
|
|
|
|
# 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
|
2004-03-08 12:43:40 -01:00
|
|
|
|
if [ -e "$MIRROR/dists/$DI_CODENAME/main/debian-installer" ]; then
|
2002-10-10 12:56:48 +00:00
|
|
|
|
touch $BDIR/indices/override.$CODENAME.main.debian-installer
|
|
|
|
|
fi
|
2004-03-08 12:43:40 -01:00
|
|
|
|
if [ -n "$LOCAL" -a -e "${LOCALDEBS:-$MIRROR}/dists/$DI_CODENAME/local/debian-installer" ]; then
|
2002-10-10 12:56:48 +00:00
|
|
|
|
touch $BDIR/indices/override.$CODENAME.local.debian-installer
|
|
|
|
|
touch $BDIR/indices/override.$CODENAME.extra.local
|
|
|
|
|
touch $BDIR/indices/override.$CODENAME.local.src
|
|
|
|
|
fi
|
2001-11-09 06:55:23 -01:00
|
|
|
|
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
|