-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_dist
executable file
·54 lines (43 loc) · 1.5 KB
/
create_dist
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
51
52
53
54
#!/usr/bin/env bash
set -exufo pipefail
target="$(realpath "$1")"
dist="$2"
description="$3"
index_files="$(mktemp)"
for arch in all amd64 arm64; do
dir="$target/dists/$dist/main/binary-$arch"
mkdir -p "$dir"
(cd "$target" && dpkg-scanpackages --arch "$arch" pool) > "$dir/Packages"
size="$(wc -c "$dir/Packages" | awk '{ print $1 }')"
hash="$(sha256sum "$dir/Packages" | head -c 64)"
echo " $hash $size main/binary-$arch/Packages" >> "$index_files"
gzip < "$dir/Packages" > "$dir/Packages.gz"
rm "$dir/Packages"
size="$(wc -c "$dir/Packages.gz" | awk '{ print $1 }')"
hash="$(sha256sum "$dir/Packages.gz" | head -c 64)"
echo " $hash $size main/binary-$arch/Packages.gz" >> "$index_files"
done
dir="$target/dists/$dist/main/source"
mkdir -p "$dir"
(cd "$target" && dpkg-scansources pool) > "$dir/Sources"
size="$(wc -c "$dir/Sources" | awk '{ print $1 }')"
hash="$(sha256sum "$dir/Sources" | head -c 64)"
echo " $hash $size main/source/Sources" >> "$index_files"
gzip < "$dir/Sources" > "$dir/Sources.gz"
rm "$dir/Sources"
size="$(wc -c "$dir/Sources.gz" | awk '{ print $1 }')"
hash="$(sha256sum "$dir/Sources.gz" | head -c 64)"
echo " $hash $size main/source/Sources.gz" >> "$index_files"
date="$(date -R -u)"
cat << EOF | gpg --clearsign > "$target/dists/$dist/InRelease"
Origin: GardenLinux
Codename: $dist
Description: $description
Components: main
Architectures: all amd64 arm64
Date: $(date -R -u -d "$date")
Valid-Until: $(date -R -u -d "$date + 100 years")
SHA256:
$(cat "$index_files")
EOF
rm "$index_files"