Files

45 lines
1.9 KiB
Bash
Executable File

#!/bin/sh
# Publish blobs before either signed list can advertise them.
set -eu
REPO=${REPO:-/mnt/Games/@project/patchserver/repo}
if [ "$#" -eq 0 ]; then set -- octo; fi
for ch do
(
cd "$REPO/$ch"
# publish.py locks this directory exclusively while signing both lists.
flock -s 9
for file in manifest.txt manifest-store.txt manifest.txt.sig manifest-store.txt.sig; do
test -s "$file" || { echo "Missing signed release file $ch/$file" >&2; exit 1; }
done
set --
for list in install-p2p.txt install.txt; do
if [ -e "$list" ] || [ -e "$list.sig" ]; then
if [ ! -s "$list" ] || [ ! -s "$list.sig" ]; then
echo "Incomplete signed install list $ch/$list" >&2
exit 1
fi
set -- "$@" "$list"
fi
done
dest="octo-vps:/srv/octo/public/$ch/"
rsync -a --chmod=D755,F644 --exclude '/state.json*' --exclude '/.manifest-*' \
--exclude '/manifest.txt*' --exclude '/manifest-store.txt*' \
--exclude '/install.txt*' --exclude '/install-p2p.txt*' ./ "$dest"
rsync -a --checksum --chmod=F644 manifest.txt manifest-store.txt "$dest"
rsync -a --checksum --chmod=F644 manifest.txt.sig manifest-store.txt.sig "$dest"
for file in manifest.txt manifest-store.txt manifest.txt.sig manifest-store.txt.sig; do
curl -fsS --compressed --max-time 30 "https://dl.hybridgateway.eu/$ch/$file" | cmp - "$file"
done
# A new base can already contain the latest FILES outputs. Its installer
# list becomes visible after that same update history and the seed files.
for list do
rsync -a --checksum --chmod=F644 "$list" "$dest"
rsync -a --checksum --chmod=F644 "$list.sig" "$dest"
for file in "$list" "$list.sig"; do
curl -fsS --compressed --max-time 30 "https://dl.hybridgateway.eu/$ch/$file" | cmp - "$file"
done
done
echo "$ch: VPS signed lists match"
) 9< "$REPO/$ch"
done