File: Packages-gen

package info (click to toggle)
debian-cd 3.2.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,848 kB
  • sloc: sh: 6,129; perl: 4,129; makefile: 413
file content (50 lines) | stat: -rwxr-xr-x 1,316 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /bin/sh
set -e

dir=${LOCALDEBS:-$MIRROR}

if [ ! -d "$dir" ]; then
	echo "error: directory '$dir' does not exist"
	echo "Check that the MIRROR or LOCALDEBS variable is set correctly."
	exit 1
fi
cd $dir

DI=
if [ "$1" = "-i" ]; then
	DI=1
	shift
fi

distr=$1
arch=$2
if [ -z "$distr" ] || [ -z "$arch" ]; then
	echo "Usage: $(basename $0) [-i] <codename> <arch>"
	exit 1
elif [ ! -d dists/$distr/local/ ]; then
	echo "No local repository matching '$distr' was found"
	exit 1
fi

if [ -z "$DI" ]; then
	repo="dists/$distr/local/binary-$arch"
else
	repo="dists/$distr/local/debian-installer/binary-$arch"
fi
[ -d $repo ] || mkdir -p $repo
echo Creating Packages file for $repo...
# Important: generate both uncompressed Packages (see below) and compressed
# Packages.gz (so that the usual Packages.gz/Packages.xz search finds it)!
apt-ftparchive packages $repo | pigz -9nm > $repo/Packages.gz
zcat $repo/Packages.gz > $repo/Packages

# Fun fact, at least when building bookworm images on bullseye:
#  - a missing Release file is fine, but maybe downloads follow;
#  - a present Release file means uncompressed Packages must be present.
echo Creating Release file for dists/$distr...
(
	cd dists/$distr
	rm -f Release*
	(echo "Codename: $distr"; apt-ftparchive release .) > Release.tmp
	mv -f Release.tmp Release
)