submod-sync.sh 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. # Define each submodule, its path, repository URL, and the specific revision to checkout
  3. declare -A submodules=(
  4. ["externals/enet"]="https://github.com/lsalzman/enet.git cc016b0046d563287f0aa9f09b958b5e70d43696"
  5. ["externals/cubeb"]="https://github.com/mozilla/cubeb.git 48689ae7a73caeb747953f9ed664dc71d2f918d8"
  6. ["externals/dynarmic"]="https://gitlab.com/curlyhacks/dynarmic.git ba8192d89078af51ae6f97c9352e3683612cdff1"
  7. ["externals/libusb/libusb"]="https://github.com/libusb/libusb.git c060e9ce30ac2e3ffb49d94209c4dae77b6642f7"
  8. ["externals/discord-rpc"]="https://gitlab.com/curlyhacks/discord-rpc.git 20cc99aeffa08a4834f156b6ab49ed68618cf94a"
  9. ["externals/Vulkan-Headers"]="https://github.com/KhronosGroup/Vulkan-Headers.git 80207f9da86423ce33aff8328a792fd715f3c08f"
  10. ["externals/sirit"]="https://gitlab.com/curlyhacks/sirit.git ab75463999f4f3291976b079d42d52ee91eebf3f"
  11. ["externals/mbedtls"]="https://gitlab.com/curlyhacks/mbedtls.git 8c88150ca139e06aa2aae8349df8292a88148ea1"
  12. ["externals/xbyak"]="https://github.com/herumi/xbyak.git a1ac3750f9a639b5a6c6d6c7da4259b8d6790989"
  13. ["externals/opus"]="https://github.com/xiph/opus.git 101a71e03bbf860aaafb7090a0e440675cb27660"
  14. ["externals/SDL"]="https://github.com/libsdl-org/SDL.git cc016b0046d563287f0aa9f09b958b5e70d43696"
  15. ["externals/cpp-httplib"]="https://github.com/yhirose/cpp-httplib.git a609330e4c6374f741d3b369269f7848255e1954"
  16. ["externals/ffmpeg/ffmpeg"]="https://github.com/FFmpeg/FFmpeg.git 9c1294eaddb88cb0e044c675ccae059a85fc9c6c"
  17. ["externals/vcpkg"]="https://github.com/microsoft/vcpkg.git a42af01b72c28a8e1d7b48107b33e4f286a55ef6"
  18. ["externals/cpp-jwt"]="https://github.com/arun11299/cpp-jwt.git 10ef5735d842b31025f1257ae78899f50a40fb14"
  19. ["externals/libadrenotools"]="https://github.com/bylaws/libadrenotools.git 5cd3f5c5ceea6d9e9d435ccdd922d9b99e55d10b"
  20. ["externals/nx_tzdb/tzdb_to_nx"]="https://github.com/lat9nq/tzdb_to_nx.git 97929690234f2b4add36b33657fe3fe09bd57dfd"
  21. ["externals/VulkanMemoryAllocator"]="https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git 2f382df218d7e8516dee3b3caccb819a62b571a2"
  22. ["externals/breakpad"]="https://gitlab.com/curlyhacks/breakpad.git c89f9dddc793f19910ef06c13e4fd240da4e7a59"
  23. ["externals/simpleini"]="https://github.com/brofield/simpleini.git 382ddbb4b92c0b26aa1b32cefba2002119a5b1f2"
  24. ["externals/oaknut"]="https://github.com/merryhime/oaknut.git 9d091109deb445bc6e9289c6195a282b7c993d49"
  25. ["externals/Vulkan-Utility-Libraries"]="https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git 524f8910d0e4a5f2ec5961996b23e5b74b95cb1d"
  26. )
  27. # Loop through each submodule to process it
  28. for name in "${!submodules[@]}"; do
  29. read -r url revision <<<"${submodules[$name]}"
  30. echo "Processing $name..."
  31. path=$name
  32. # echo "Path: $path"
  33. # echo "URL: $url"
  34. # echo "Revision: $revision"
  35. # 1. Delete the submodule path if it exists
  36. if [ -d "$path" ]; then
  37. git rm -rf $path
  38. rm -rf $path
  39. fi
  40. # # 2. Remove it from the git index (this step is integrated with git rm above)
  41. # # 3. Add the submodule
  42. git submodule add --force $url $path
  43. # # 4. Checkout the specific revision
  44. pushd $path
  45. git checkout $revision
  46. popd
  47. # # Add changes to the index
  48. git add -A $path
  49. done
  50. # Commit the changes
  51. git commit -m "Updated submodules to specified revisions."