Last active
July 19, 2018 20:43
-
-
Save mikecriggs/c3aaa79336d1884d1842d87d77a73d50 to your computer and use it in GitHub Desktop.
A simple build script written for InvictrixROM
This file contains 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 | |
# | |
# A simple build script for InvictrixROM | |
# Written by Michael S Corigliano (Mike Criggs) <[email protected]> | |
# | |
# Usage: ./build.sh <DEVICE> <CLEAN OPTION> | |
# Clean options: rm, clean, clobber, installclean | |
# | |
# Definitions | |
# Arguments | |
DEVICE="$1" | |
CLEAN="$2" | |
# Variables | |
TIMESTAMP=$(date +"%Y-%m-%d-%S") | |
JOBS="$(nproc --all)" | |
# Terminal colors | |
BLDRED="\033[1m""\033[31m" | |
RST="\033[0m" | |
# Functions | |
# Echo message | |
echoMSG () { | |
echo -e ${BLDRED}"$TXT"${RST} | |
echo -e "" | |
echo -e "" | |
} | |
# Build ROM | |
buildROM () { | |
clear | |
TXT="Starting Invictrix build..." | |
echoMSG | |
sleep 2 | |
. build/envsetup.sh | |
lunch invictrix_$DEVICE-userdebug | |
make -j${JOBS} bacon 2>&1 | tee build-logs/$DEVICE/invictrix_$DEVICE-$TIMESTAMP.log | |
} | |
# Tell the user to kill the script if no device was defined | |
if [[ ! $1 ]] | |
then | |
clear | |
TXT="ERROR: No device defined. Please press CTRL+C to kill this script in the next 20 seconds." | |
echoMSG | |
TXT="USAGE: ./build.sh <DEVICE> <CLEAN OPTION>" | |
echoMSG | |
sleep 20 | |
else | |
clear | |
TXT="Building Invictrix for $DEVICE..." | |
echoMSG | |
sleep 2 | |
clear | |
fi | |
# Clean options | |
case $CLEAN in | |
rm) | |
printf "Removing OUT directories...\n\n" | |
sleep 2 | |
clear | |
rm -rf $OUT | |
;; | |
clean) | |
printf "Making clean...\n\n" | |
sleep 2 | |
clear | |
make clean | |
;; | |
clobber) | |
printf "Making clobber...\n\n" | |
sleep 2 | |
clear | |
make clobber | |
;; | |
installclean) | |
printf "Making installclean...\n\n" | |
sleep 2 | |
clear | |
make installclean | |
;; | |
*) | |
TXT="WARNING: No clean option was given so building dirty" | |
echoMSG | |
TXT="USAGE: ./build.sh <DEVICE> <CLEAN OPTION>" | |
echoMSG | |
TXT="Please use the following options for clean:" | |
echoMSG | |
echo -e ${BLDRED}"1: rm (removes OUT directory with rm -rf)"${RST} | |
echo -e ${BLDRED}"2: clean (make clean )"${RST} | |
echo -e ${BLDRED}"3: clobber (make clobber )"${RST} | |
echo -e ${BLDRED}"4: installclean (make installclean )"${RST} | |
echo -e "" | |
echo -e "" | |
esac | |
################################################################################################################# | |
# # | |
# !! NOTE: IF YOU ARE USING ARCH AND DO NOT HAVE YOUR PYTHON PATH SET TO PYTHON 2, UNCOMMENT THE LINES BELOW !! # | |
# # | |
################################################################################################################# | |
# virtualenv2 venv | |
# source venv/bin/activate | |
# Build logs | |
# Make a build-logs directory for device | |
mkdir -p build-logs/$DEVICE | |
# Remove old build logs (uncomment if desired) | |
# rm -rf build-logs/$DEVICE/* | |
# Build ROM | |
buildROM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment