iota-patch-libs.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. set -euo pipefail
  3. # This script patches the SUI code to be compatible with IOTA. IOTA is a fork
  4. # of SUI but is not compatible with SUI. You'd need to run this script for
  5. # deploying Pyth contracts and updating the vendored libs.
  6. #
  7. # Note: Do not commit the patched Pyth code to the repo.
  8. # Check if exactly one argument (base path) is provided
  9. if [ $# -ne 1 ]; then
  10. echo "Usage: $0 <base-path>"
  11. exit 1
  12. fi
  13. # Detect OS to determine correct sed syntax
  14. if sed --version >/dev/null 2>&1; then
  15. SED_CMD=sed
  16. else
  17. if ! command -v gsed >/dev/null 2>&1; then
  18. echo "Error: GNU sed (gsed) is required for macOS/BSD. Install core-utils via Homebrew."
  19. exit 1
  20. fi
  21. SED_CMD=gsed
  22. fi
  23. # Use find to get all .move files recursively and process them
  24. find "$1" -type f -name "*.move" | while read -r file; do
  25. echo "Processing: $file"
  26. $SED_CMD -i -e 's/\bSUI\b/IOTA/g' \
  27. -e 's/\bSui\b/Iota/g' \
  28. -e 's/\bsui\b/iota/g' "$file"
  29. done
  30. echo "Replacements complete."