diff --git a/deploy/push_desktop.sh b/deploy/push_desktop.sh index 9dc45df..cbd29b5 100755 --- a/deploy/push_desktop.sh +++ b/deploy/push_desktop.sh @@ -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