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:
+10
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user