-
Notifications
You must be signed in to change notification settings - Fork 0
/
apt.sh
executable file
·51 lines (40 loc) · 1.69 KB
/
apt.sh
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
#!/usr/bin/env bash
#
# https://unix.stackexchange.com/a/403489
# https://gist.github.com/aarroyoc/1a96b2f8b01fcf34221a
#
set -euo pipefail
# repos=(kiron1/proxydetox kiron1/bazel-compile-commands)
repos=(kiron1/proxydetox)
machines=(x86_64)
key=packages@colorto.cc
declare -A aptarch=( ["x86_64"]="amd64" )
suits=(focal jammy)
eval "$(apt-config -c apt-ftparchive.conf shell archive_dir Dir::ArchiveDir/d)"
mkdir -p "${archive_dir}/pool/main"
for r in "${repos[@]}"; do
tag=$(gh release view -R "${r}" --json tagName --jq '.tagName')
for s in "${suits[@]}"; do
mkdir -p "${archive_dir}/pool/${s}/main"
rm -f -- "${archive_dir}/pool/${s}/main"/*.deb
for m in "${machines[@]}"; do
printf 'Download %s %s\n' "${r}" "${tag}"
gh release download -R "${r}" "${tag}" --dir "${archive_dir}/pool/${s}/main" --pattern "*-${m}-${s}.deb" --skip-existing
done
find "${archive_dir}/pool/${s}/main/" -name '*.deb' -exec dpkg-name {} +
done
done
r=kiron1/bazel-compile-commands
tag=$(gh release view -R "${r}" --json tagName --jq '.tagName')
gh release download -R "${r}" "${tag}" --dir "${archive_dir}/pool/focal/main" --pattern "*.deb" --skip-existing
for s in "${suits[@]}"; do
for m in "${machines[@]}"; do
mkdir -p "${archive_dir}/dists/${s}/main/binary-${aptarch[${m}]}"
done
apt-ftparchive generate apt-ftparchive.conf
apt-ftparchive "-c=${s}.conf" release "${archive_dir}/dists/${s}" > "${archive_dir}/dists/${s}/Release"
done
for s in "${suits[@]}"; do
gpg -u "${key}" -bao "${archive_dir}/dists/${s}/Release.gpg" "${archive_dir}/dists/${s}/Release"
gpg -u "${key}" --clear-sign --output "${archive_dir}/dists/${s}/InRelease" "${archive_dir}/dists/${s}/Release"
done