-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsign-upload-debian
executable file
·66 lines (51 loc) · 1.76 KB
/
sign-upload-debian
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
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
set -euo pipefail
shopt -s nullglob
archs=(amd64 armel armhf i386 arm64)
export TMPDIR=/var/tmp
if [[ ! -z ${1:-} ]] ; then
workdir=$(mktemp -d)
echo Working dir is "$workdir"
pushd "$workdir" >/dev/null
echo Downloading release
cp "$1"/*.deb .
ver=(syncthing_*_amd64.deb)
ver="${ver#syncthing_}"
ver="${ver%_amd64.deb}"
for arch in "${archs[@]}" ; do
mv "syncthing_${ver}_${arch}.deb" "$HOME/apt-dists/pool"
done
popd >/dev/null
rm -r "$workdir"
fi
pushd "$HOME/apt-dists" >/dev/null
echo Cleaning out old releases
find "pool" -name syncthing_\*.deb -mtime +60 -delete
echo Generating and signing package archives
shopt -s nullglob
for arch in "${archs[@]}" ; do
for chan in release stable ; do
path="dists/syncthing/$chan/binary-$arch"
pushd "$path"
rm -f *
ln -s ../../../../pool/*_{[0-9],[0-9][0-9]}.{[0-9],[0-9][0-9]}.{[0-9],[0-9][0-9]}_$arch.deb . || true
popd
dpkg-scanpackages -m "$path" > "$path/Packages"
gzip -c "$path/Packages" > "$path/Packages.gz"
done
path="dists/syncthing/candidate/binary-$arch"
pushd "$path"
rm -f *
ln -s ../../../../pool/*_$arch.deb . || true
popd
dpkg-scanpackages -m "$path" > "$path/Packages"
gzip -c "$path/Packages" > "$path/Packages.gz"
done
apt-ftparchive -c Releases.conf release dists/syncthing | gpg --clearsign > dists/syncthing/InRelease
gzip -c dists/syncthing/InRelease > dists/syncthing/InRelease.gz
apt-ftparchive -c Releases.conf release dists/syncthing > dists/syncthing/Release
gzip -c dists/syncthing/Release > dists/syncthing/Release.gz
gpg --detach-sign --yes -a -o dists/syncthing/Release.gpg dists/syncthing/Release
gzip -c dists/syncthing/Release.gpg > dists/syncthing/Release.gpg.gz
echo Uploading new distribution
rsync -va --delete --rsh="$RSYNC_RSH_CMD" ./ "$RELEASE_ROOT/"