Prune old installers from the remote feed on push

rsync without --delete left every previous version on the server (the
screenshot showed 0.1.0 and 0.1.1 side by side). The push now removes
non-current installers over ssh first, so the remote feed mirrors the local
one whether the transfer uses rsync or tar.
This commit is contained in:
2026-09-20 21:39:43 -05:00
parent 3183a3bece
commit 98025e9e6d
+10 -4
View File
@@ -92,6 +92,16 @@ if [ -n "$REMOTE" ]; then
echo
echo "==> Copying the feed to $REMOTE_TARGET:$REMOTE_FEED ..."
if ! ssh "$REMOTE_TARGET" "mkdir -p '$REMOTE_FEED'"; then
echo "ssh to $REMOTE_TARGET failed; nothing was copied." >&2
exit 1
fi
# The remote feed keeps only the current version, like the local one.
if ! ssh "$REMOTE_TARGET" \
"find '$REMOTE_FEED' -maxdepth 1 -type f \\( -name '*.deb' -o -name '*.pkg.tar.zst' -o -name '*.exe' -o -name '*.exe.blockmap' \\) ! -name '*$VERSION*' -exec rm -f {} +"; then
echo "==> Could not prune old installers on $REMOTE_TARGET (continuing)." >&2
fi
transferred=0
if command -v rsync >/dev/null 2>&1; then
if rsync -a --info=progress2 "$FEED"/ "$REMOTE_TARGET:$REMOTE_FEED/"; then
@@ -101,10 +111,6 @@ if [ -n "$REMOTE" ]; then
fi
fi
if [ "$transferred" -eq 0 ]; then
if ! ssh "$REMOTE_TARGET" "mkdir -p '$REMOTE_FEED'"; then
echo "ssh to $REMOTE_TARGET failed; nothing was copied." >&2
exit 1
fi
if ! tar -C "$FEED" -cf - . |
ssh "$REMOTE_TARGET" "tar -C '$REMOTE_FEED' -xf -"; then
echo "Copy to $REMOTE_TARGET:$REMOTE_FEED failed." >&2