| 1 |
#! /bin/sh |
| 2 |
set -e |
| 3 |
|
| 4 |
dir=${LOCALDEBS:-$MIRROR} |
| 5 |
|
| 6 |
if [ ! -d "$dir" ]; then |
| 7 |
echo "error: directory '$dir' does not exist" |
| 8 |
echo "Check that the MIRROR or LOCALDEBS variable is set correctly." |
| 9 |
exit 1 |
| 10 |
fi |
| 11 |
cd $dir |
| 12 |
|
| 13 |
DI= |
| 14 |
if [ "$1" = "-i" ]; then |
| 15 |
DI=1 |
| 16 |
shift |
| 17 |
fi |
| 18 |
|
| 19 |
distr=$1 |
| 20 |
arch=$2 |
| 21 |
if [ -z "$distr" ] || [ -z "$arch" ]; then |
| 22 |
echo "Usage: $(basename $0) [-i] <codename> <arch>" |
| 23 |
exit 1 |
| 24 |
elif [ ! -d dists/$distr/local/ ]; then |
| 25 |
echo "No local repository matching '$distr' was found" |
| 26 |
exit 1 |
| 27 |
fi |
| 28 |
|
| 29 |
if [ -z "$DI" ]; then |
| 30 |
repo="dists/$distr/local/binary-$arch" |
| 31 |
else |
| 32 |
repo="dists/$distr/local/debian-installer/binary-$arch" |
| 33 |
fi |
| 34 |
[ -d $repo ] || mkdir -p $repo |
| 35 |
echo Creating Packages file for $repo... |
| 36 |
# Important: generate both uncompressed Packages (see below) and compressed |
| 37 |
# Packages.gz (so that the usual Packages.gz/Packages.xz search finds it)! |
| 38 |
apt-ftparchive packages $repo | pigz -9nm > $repo/Packages.gz |
| 39 |
zcat $repo/Packages.gz > $repo/Packages |
| 40 |
|
| 41 |
# Fun fact, at least when building bookworm images on bullseye: |
| 42 |
# - a missing Release file is fine, but maybe downloads follow; |
| 43 |
# - a present Release file means uncompressed Packages must be present. |
| 44 |
echo Creating Release file for dists/$distr... |
| 45 |
( |
| 46 |
cd dists/$distr |
| 47 |
rm -f Release* |
| 48 |
(echo "Codename: $distr"; apt-ftparchive release .) > Release.tmp |
| 49 |
mv -f Release.tmp Release |
| 50 |
) |