Advertisement
Guest User

Untitled

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