get-updates.sh 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/bin/bash
  2. RED=$(tput setaf 1)
  3. NC=$(tput sgr0) # No Color
  4. exec 0</dev/tty
  5. source .env
  6. clear
  7. # Permissions
  8. echo ""
  9. echo "Verifying file and user permissions are set correctly"
  10. echo ""
  11. sudo chmod -R 777 .
  12. echo ""
  13. echo "Compiling all code now."
  14. echo ""
  15. echo ""
  16. ant -f server/build.xml compile_core
  17. ant -f server/build.xml compile_plugins
  18. ant -f Client_Base/build.xml compile
  19. ant -f PC_Launcher/build.xml compile
  20. # Export the Android SDK path
  21. export ANDROID_SDK_ROOT=/usr/lib/android-sdk
  22. export PATH=$ANDROID_SDK_ROOT/cmdline-tools/tools/bin:$PATH
  23. ANDROID_COMPILE_SDK="29"
  24. ANDROID_BUILD_TOOLS="29.0.3"
  25. ANDROID_SDK_TOOLS="6200805"
  26. echo y | sdkmanager --version &>/dev/null
  27. echo y | sdkmanager --update &>/dev/null
  28. yes | sdkmanager --sdk_root=$ANDROID_SDK_ROOT --licenses &>/dev/null
  29. echo y | sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platforms;android-$ANDROID_COMPILE_SDK" &>/dev/null
  30. echo y | sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platform-tools" &>/dev/null
  31. echo y | sdkmanager --sdk_root=$ANDROID_SDK_ROOT "build-tools;$ANDROID_BUILD_TOOLS" &>/dev/null
  32. export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
  33. # Gradle compile Android client
  34. gradle -b Android_Client/Open\ RSC\ Android\ Client/build.gradle assembleDebug
  35. # Launcher
  36. echo ""
  37. echo "Copy and md5sum compiled client and cache files to the Website downloads folder?
  38. Choices:
  39. ${RED}1${NC} - No
  40. ${RED}2${NC} - Yes (prod)
  41. ${RED}3${NC} - Yes (dev)"
  42. echo ""
  43. echo "Type the choice number and press enter."
  44. echo ""
  45. read -r compiling
  46. if [ "$compiling" == "1" ]; then
  47. echo ""
  48. elif [ "$compiling" == "2" ]; then
  49. # PC Client
  50. yes | sudo cp -f Client_Base/*.jar ../Website/site/public/downloads/
  51. # Android client
  52. yes | sudo find . -type f -path '*Android_Client*/*Open RSC Android Client*/*' -name \*.apk | xargs -I {} sudo cp "{}" ../Website/site/public/downloads/
  53. ##yes | sudo cp -f Android_Client/Open\ RSC\ Android\ Client/*.apk ../Website/site/public/downloads/
  54. # Launcher
  55. yes | sudo cp -rf PC_Launcher/*.jar ../Website/site/public/downloads/
  56. # Set file permissions within the Website downloads folder
  57. sudo chmod +x ../Website/site/public/downloads/*.jar
  58. sudo chmod +x ../Website/site/public/downloads/*.jar
  59. sudo chmod +x ../Website/site/public/downloads/*.apk
  60. sudo chmod -R 777 ../Website/site/public/downloads
  61. # Cache copy and file permissions
  62. sudo chmod 777 -R 'Client_Base/Cache' # Normal cache related files
  63. yes | sudo cp -a -rf "Client_Base/Cache/." "../Website/site/public/downloads/" # Normal cache related files
  64. cd '../Website/site/public/downloads/' || exit
  65. find -type f \( -not -name "MD5.SUM" \) -exec md5sum '{}' \; >MD5.SUM # Performs md5 hashing of all files in cache and writes to a text file for the launcher to read
  66. cd '../../../../Game' || exit
  67. elif [ "$compiling" == "3" ]; then
  68. # PC Client
  69. sudo mv Client_Base/*.jar Client_Base/Open_RSC_Client_dev.jar
  70. yes | sudo cp -f Client_Base/Open_RSC_Client_dev.jar ../Website/site/public/downloads/
  71. # Android client
  72. yes | sudo find . -type f -path '*Android_Client*/*Open RSC Android Client*/*' -name \*.apk | xargs -I {} sudo cp "{}" ../Website/site/public/downloads/
  73. ##yes | sudo cp -f Android_Client/Open\ RSC\ Android\ Client/*.apk ../Website/site/public/downloads/
  74. # Launcher
  75. #yes | sudo cp -rf PC_Launcher/*.jar ../Website/site/public/downloads/
  76. # Set file permissions within the Website downloads folder
  77. sudo chmod +x ../Website/site/public/downloads/*.jar
  78. sudo chmod +x ../Website/site/public/downloads/*.jar
  79. sudo chmod +x ../Website/site/public/downloads/*.apk
  80. sudo chmod -R 777 ../Website/site/public/downloads
  81. # Cache copy and file permissions
  82. #sudo chmod 777 -R 'Client_Base/Cache' # Normal cache related files
  83. #yes | sudo cp -a -rf "Client_Base/Cache/." "../Website/site/public/downloads/" # Normal cache related files
  84. cd '../Website/site/public/downloads/' || exit
  85. find -type f \( -not -name "MD5.SUM" \) -exec md5sum '{}' \; >MD5.SUM # Performs md5 hashing of all files in cache and writes to a text file for the launcher to read
  86. cd '../../../../Game' || exit
  87. fi
  88. clear
  89. # Finished
  90. echo ""
  91. echo "What would you like to do?
  92. Choices:
  93. ${RED}1${NC} - Run game server
  94. ${RED}2${NC} - Return to the main menu"
  95. echo ""
  96. echo "Type the choice number and press enter."
  97. echo ""
  98. read -r finished
  99. if [ "$finished" == "1" ]; then
  100. make run-server
  101. elif [ "$finished" == "2" ]; then
  102. make start-linux
  103. fi