Account for multiple subdirectories for syncing

This commit is contained in:
David Heinemeier Hansson committed 2025-11-21 15:01:59 +01:00
1 parent 15ba03658b
commit 44ce28a0d8
1 file changed
+7 -5
+7 -5
View File
@@ -46,9 +46,11 @@ while [[ $# -gt 0 ]]; do
esac esac
done done
DESTINATION_DIRECTORY="${DIRECTORY#pkgs.omarchy.org/}"
# Check if syncing to production and warn user # Check if syncing to production and warn user
if [[ "$REMOTE" == "$DEFAULT_REMOTE" ]] && [[ "$SKIP_PROD_CHECK" != true ]]; then if [[ "$REMOTE" == "$DEFAULT_REMOTE" ]] && [[ "$SKIP_PROD_CHECK" != true ]]; then
print_warning "You are about to sync to PRODUCTION ($REMOTE)" print_warning "You are about to sync to PRODUCTION ($REMOTE/$DESTINATION_DIRECTORY)"
echo "" echo ""
read -p "Are you sure you want to sync to production? (y/N) " -n 1 -r read -p "Are you sure you want to sync to production? (y/N) " -n 1 -r
echo echo
@@ -58,12 +60,12 @@ if [[ "$REMOTE" == "$DEFAULT_REMOTE" ]] && [[ "$SKIP_PROD_CHECK" != true ]]; the
fi fi
fi fi
print_info "Syncing to: $REMOTE/$(basename $DIRECTORY)" print_info "Syncing to: $REMOTE/$DESTINATION_DIRECTORY"
# First sync packages (excluding database files to ensure packages are uploaded first) # First sync packages (excluding database files to ensure packages are uploaded first)
# Use --ignore-existing to not overwrite different versions already on remote # Use --ignore-existing to not overwrite different versions already on remote
print_info "Syncing packages..." print_info "Syncing packages..."
rclone sync "$DIRECTORY" "$REMOTE/$(basename $DIRECTORY)" \ rclone sync "$DIRECTORY" "$REMOTE/$DESTINATION_DIRECTORY" \
--exclude "omarchy.db*" \ --exclude "omarchy.db*" \
--exclude "omarchy.files*" \ --exclude "omarchy.files*" \
--ignore-existing \ --ignore-existing \
@@ -71,8 +73,8 @@ rclone sync "$DIRECTORY" "$REMOTE/$(basename $DIRECTORY)" \
# Then sync database files last to ensure repository integrity # Then sync database files last to ensure repository integrity
print_info "Updating repository database..." print_info "Updating repository database..."
rclone copy "$DIRECTORY" "$REMOTE/$(basename $DIRECTORY)/" \ rclone copy "$DIRECTORY" "$REMOTE/$DESTINATION_DIRECTORY" \
--include "omarchy.*" \ --include "omarchy.*" \
--checksum --copy-links -v --checksum --copy-links -v
print_success "Sync complete!" print_success "sync complete!"