Created
September 28, 2013 02:41
-
-
Save pcamp96/6737825 to your computer and use it in GitHub Desktop.
compile-generic.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Function for the check result of the repo sync | |
| function check_result { | |
| if [ "0" -ne "$?" ] | |
| then | |
| echo $1 | |
| exit 1 | |
| fi | |
| } | |
| # Find out what ROM the user is building | |
| read -p "What ROM are you building? all lowercase please: " rom | |
| # Sync up the repositories if the developer wants to | |
| read -p "Would you like to sync your repository up now? y/n: " repoanswer | |
| if [[ "$repoanswer" == "y" ]]; then | |
| echo "repo sync"; repo sync; check_result "repo sync failed." | |
| fi | |
| echo "Ok, continuing....." | |
| echo "Thanks for that. Now, to get to the fun stuff!" | |
| # Set up the build enviornment | |
| read -p "Ready to set up the build enviornment? If so, please press enter. Otherwise press CONTROL+C" | |
| echo "Setting up the build enviornment"; | |
| echo ". build/envsetup.sh"; | |
| . build/envsetup.sh | |
| echo "Enviornment is set up"; | |
| read -p "Thanks for allowing me to set up your build enviornment. | |
| Please press ENTER to continue to the lunch room!"; | |
| # We are entering the lunch room, time to choose a device. Ask the developer which device he/she wants | |
| echo "Time to look at the lunch menu.. Hmm, what to choose today?"; | |
| lunch | tee $lunchmenu | |
| echo "$lunchmenu"; | |
| # Unneeded now that we echo the $lunchmenu | |
| # read -p "What device did you choose? (Please, only the device name) " device | |
| echo "Great choice! Now, lets dig in!"; | |
| # Time to actually start the build | |
| read -p "Press ENTER to continue."; | |
| # Check if user has a ../build-logs directory, if they do, start the build. If not, create one | |
| read -p "Do you want to keep a log? y/n: " log | |
| if [[ "$log" == "y" ]]; then | |
| echo "Creating a logs directory if one doesn't exist..."; echo "mkdir -p ../build-logs"; mkdir -p ../build-logs; echo "Now it's time to commence building!" | |
| fi | |
| echo "That's ok, we'll let you continue on without one." | |
| # Start a carbon build with logging | |
| if [[ "$log" == "y" ]] && [[ "$rom" == "carbon" ]]; then | |
| echo "mka carbon 2>&1 | tee ../build-logs/$device-$rom-build-$(date +%m.%d-%H_%M_%S)"; mka carbon 2>&1 | tee ../build-logs/$device-$rom-build-$(date +%m.%d-%H_%M_%S) | |
| # Start a carbon build without logging | |
| elif [[ "$log" == "n" ]]; then | |
| echo "mka carbon"; mka carbon | |
| # Start a non carbon build with logging | |
| elif [[ "$log" == "y" ]] && [[ "$rom" != "carbon" ]]; then | |
| echo "mka bacon 2>&1 | tee ../build-logs/$device-$rom-build-$(date +%m.%d-%H_%M_%S)"; mka bacon 2>&1 | tee ../build-logs/$device-$rom-build-$(date +%m.%d-%H_%M_%S) | |
| # Start a non carbon build without logging | |
| elif [[ "$log" == "n" ]] && [[ "$rom" != "carbon" ]]; then | |
| echo "mka bacon"; mka bacon | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment