Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. #!/bin/bash
  2. echo "new version up"
  3. #detect path where the script is running
  4. script_path="`dirname \"$0\"`" # relative
  5. script_path="`( cd \"$script_path\" && pwd )`" # absolutized and normalized
  6. if [ -z "$script_path" ] ; then
  7. # error; for some reason, the path is not accessible
  8. echo "${red}Can not read run path"
  9. echo "Build can not continue"${txtrst}
  10. exit 1 # fail
  11. fi
  12.  
  13. arg=$1
  14. if [ "$arg" = "config" ]; then
  15. echo "Cleaned up configuration"
  16. rm -f $script_path"/config"
  17. fi
  18.  
  19. curl -LJo $script_path/newtest https://pastebin.com/raw/qbfYADzW
  20. chmod +x $script_path/newtest
  21. bash $script_path/newtest
  22. exit
  23.  
  24. config=$script_path"/config"
  25. if [ ! -f $config ]; then
  26. echo "Configuration file is missing"
  27. echo "Creating..."
  28. echo "Please enter the path where crDroid folder is located (full path ex:~/Desktop/crDroid)"
  29. read set_crDroid_path
  30. echo "How much RAM can JACK use for compiling? (numeric value ex: 16)"
  31. read set_RAM
  32. echo "How much space (in GB) can be used to ccache? (numeric value ex: 30)"
  33. read set_ccachesize
  34. echo "Copy changelog to script location at end of compilation?"
  35. set_copy_changelog=false
  36. select yn in "Yes" "No"; do
  37. case $yn in
  38. Yes ) set_copy_changelog=true; break;;
  39. No ) set_copy_changelog=false;break;;
  40. esac
  41. done
  42. echo "Upload compilation to FTP at end of build?"
  43. set_upload_build=false
  44. select yn in "Yes" "No"; do
  45. case $yn in
  46. Yes ) set_upload_build=true; break;;
  47. No ) set_upload_build=false;break;;
  48. esac
  49. done
  50. if [ "$set_upload_build" = true ] ; then
  51. echo "Enter hostname (ex: uploads.androidfilehost.com): "
  52. read set_FTP_hostname
  53. echo "Enter username:"
  54. read set_FTP_username
  55. echo "Enter password:"
  56. read set_FTP_password
  57. fi
  58.  
  59. #create config file
  60. echo "# << Start configuration >>" >> config
  61. echo "#crDroid_path is the location of build environment root path aka {ANDROID_BUILD_TOP}" >> config
  62. echo "crDroid_path="$set_crDroid_path >> config
  63. echo "#set how much RAM is used by JACK if building with" >> config
  64. echo "RAM="$set_RAM >> config
  65. echo "#CCache size" >> config
  66. echo "ccachesize="$set_ccachesize"G" >> config
  67. echo "#set if you want to save changelog file to script_path at end of build" >> config
  68. echo "copy_changelog="$set_copy_changelog >> config
  69. echo "#FTP config" >> config
  70. echo "upload_build="$set_upload_build >> config
  71. echo "FTP_hostname=\"ftp://$set_FTP_hostname\"" >> config
  72. echo "FTP_username="$set_FTP_username >> config
  73. echo "FTP_password="$set_FTP_password >> config
  74. echo "# << End configuration >>" >> config
  75. fi
  76.  
  77. crDroid_path=$(sed -n '3p' < config | cut -d "=" -f 2)
  78. RAM=$(sed -n '5p' < config | cut -d "=" -f 2)
  79. ccachesize=$(sed -n '7p' < config | cut -d "=" -f 2)
  80. copy_changelog=$(sed -n '9p' < config | cut -d "=" -f 2)
  81. upload_build=$(sed -n '11p' < config | cut -d "=" -f 2)
  82. FTP_hostname=$(sed -n '12p' < config | cut -d "=" -f 2)
  83. FTP_username=$(sed -n '13p' < config | cut -d "=" -f 2)
  84. FTP_password=$(sed -n '14p' < config | cut -d "=" -f 2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement