Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "new version is up"
- #detect path where the script is running
- script_path="`dirname \"$0\"`" # relative
- script_path="`( cd \"$script_path\" && pwd )`" # absolutized and normalized
- if [ -z "$script_path" ] ; then
- # error; for some reason, the path is not accessible
- echo "${red}Can not read run path"
- echo "Build can not continue"${txtrst}
- exit 1 # fail
- fi
- arg=$1
- if [ "$arg" = "config" ]; then
- echo "Cleaned up configuration"
- rm -f $script_path"/config"
- fi
- config=$script_path"/config"
- if [ ! -f $config ]; then
- echo "Configuration file is missing"
- echo "Creating..."
- echo "Please enter the path where crDroid folder is located (full path ex:~/Desktop/crDroid)"
- read set_crDroid_path
- echo "How much RAM can JACK use for compiling? (numeric value ex: 16)"
- read set_RAM
- echo "How much space (in GB) can be used to ccache? (numeric value ex: 30)"
- read set_ccachesize
- echo "Copy changelog to script location at end of compilation?"
- set_copy_changelog=false
- select yn in "Yes" "No"; do
- case $yn in
- Yes ) set_copy_changelog=true; break;;
- No ) set_copy_changelog=false;break;;
- esac
- done
- echo "Upload compilation to FTP at end of build?"
- set_upload_build=false
- select yn in "Yes" "No"; do
- case $yn in
- Yes ) set_upload_build=true; break;;
- No ) set_upload_build=false;break;;
- esac
- done
- if [ "$set_upload_build" = true ] ; then
- echo "Enter hostname (ex: uploads.androidfilehost.com): "
- read set_FTP_hostname
- echo "Enter username:"
- read set_FTP_username
- echo "Enter password:"
- read set_FTP_password
- fi
- #create config file
- echo "# << Start configuration >>" >> config
- echo "#crDroid_path is the location of build environment root path aka {ANDROID_BUILD_TOP}" >> config
- echo "crDroid_path="$set_crDroid_path >> config
- echo "#set how much RAM is used by JACK if building with" >> config
- echo "RAM="$set_RAM >> config
- echo "#CCache size" >> config
- echo "ccachesize="$set_ccachesize"G" >> config
- echo "#set if you want to save changelog file to script_path at end of build" >> config
- echo "copy_changelog="$set_copy_changelog >> config
- echo "#FTP config" >> config
- echo "upload_build="$set_upload_build >> config
- echo "FTP_hostname=\"ftp://$set_FTP_hostname\"" >> config
- echo "FTP_username="$set_FTP_username >> config
- echo "FTP_password="$set_FTP_password >> config
- echo "# << End configuration >>" >> config
- fi
- crDroid_path=$(sed -n '3p' < config | cut -d "=" -f 2)
- RAM=$(sed -n '5p' < config | cut -d "=" -f 2)
- ccachesize=$(sed -n '7p' < config | cut -d "=" -f 2)
- copy_changelog=$(sed -n '9p' < config | cut -d "=" -f 2)
- upload_build=$(sed -n '11p' < config | cut -d "=" -f 2)
- FTP_hostname=$(sed -n '12p' < config | cut -d "=" -f 2)
- FTP_username=$(sed -n '13p' < config | cut -d "=" -f 2)
- FTP_password=$(sed -n '14p' < config | cut -d "=" -f 2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement