Created
September 28, 2013 02:41
-
-
Save pcamp96/6737818 to your computer and use it in GitHub Desktop.
compile-carbon.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 | |
| } | |
| # Source the .bashrc | |
| echo ". ~/.bashrc" | |
| . ~/.bashrc | |
| # 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....." | |
| # Set up the build enviornment | |
| 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 | |
| read -p "Are we building tenderloin, m7spr, or other? t/m/o: " lunchanswer | |
| if [[ "$lunchanswer" == "t" ]], then | |
| echo "lunch carbon_tenderloin-userdebug"; lunch carbon_tenderloin-userdebug | |
| elif [[ "$lunchanswer" == "m" ]], then | |
| echo "lunch carbon_m7spr-userdebug"; lunch carbon_m7spr-userdebug | |
| elif [[ "$luncanswer" == "o"]] | |
| lunch | tee $lunchmenu; echo "$lunchmenu"; read -p "What device did you choose? (device name in lowercase letters): " device | |
| fi | |
| echo "Great choice! Now, lets dig in!"; | |
| # Time to actually start the build | |
| read -p "Press ENTER to continue."; | |
| # Start a carbon build with logging | |
| if [[ "$lunchanswer" == "t" ]], then | |
| echo "mka carbon 2>&1 | tee ../logs/tenderloin-carbon-build-$(date +%m.%d-%H_%M_%S)"; mka carbon 2>&1 | tee ../logs/tenderloin-carbon-build-$(date +%m.%d-%H_%M_%S) | |
| elif [[ "$lunchanswer" == "m" ]], then | |
| echo "mka carbon 2>&1 | tee ../logs/m7spr-carbon-build-$(date +%m.%d-%H_%M_%S)"; mka carbon 2>&1 | tee ../logs/m7spr-carbon-build-$(date +%m.%d-%H_%M_%S) | |
| elif [[ "$luncanswer" == "o"]] | |
| echo "mka carbon 2>&1 | tee ../logs/$device-carbon-build-$(date +%m.%d-%H_%M_%S)"; mka carbon 2>&1 | tee ../logs/$device-carbon-build-$(date +%m.%d-%H_%M_%S) | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment