Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Colorize and add text parameters
- red=$(tput setaf 1) # red
- grn=$(tput setaf 2) # green
- blu=$(tput setaf 4) # blue
- txtbld=$(tput bold) # bold
- bldgrn=${txtbld}$(tput setaf 1) # bold red
- bldgrn=${txtbld}$(tput setaf 2) # bold green
- bldblu=${txtbld}$(tput setaf 4) # bold blue
- txtrst=$(tput sgr0) # reset
- DEVICE="$1"
- SYNC="$2"
- CLEAN="$3"
- LOG="$4"
- ROOT_PATH=$PWD
- BUILD_PATH="$ROOT_PATH/out/target/product/$DEVICE"
- CCACHE_PATH="$ROOT_PATH/ccache"
- # Kernel Details
- BASE_AK_VER="AK"
- VER=".066-2.ANGLER."
- TOOLCHAIN_VER="LINARO6.1"
- AK_VER="${BASE_AK_VER}${VER}${TOOLCHAIN_VER}"
- export LOCALVERSION=~`echo $AK_VER`
- export KBUILD_BUILD_USER=kantjer
- export KBUILD_BUILD_HOST=Phoenix
- # Start tracking time
- echo -e ${bldblu}
- echo -e "---------------------------------------"
- echo -e "SCRIPT STARTING AT $(date +%D\ %r)"
- echo -e "---------------------------------------"
- echo -e ${txtrst}
- START=$(date +%s)
- # Sync with latest sources
- if [ "$SYNC" == "sync" ]
- then
- echo -e "${bldblu}Syncing latest sources ${txtrst}"
- repo sync -j4 -c -f --force-sync
- fi
- # Setup environment
- echo -e "${bldblu}Setting up build environment ${txtrst}"
- . build/envsetup.sh
- # Setup ccache
- export USE_CCACHE=1
- export CCACHE_DIR=$CCACHE_PATH
- /usr/bin/ccache -M 30G
- # Set the device
- echo -e "Setting the device... ${txtrst}"
- breakfast "nexus_$DEVICE-userdebug"
- # Clean out folder
- if [ "$CLEAN" == "clean" ]
- then
- echo -e "${bldblu}Cleaning up the OUT folder with make clobber ${txtrst}"
- make clean;
- else
- echo -e "${bldblu}No make clobber so just make installclean ${txtrst}"
- make installclean;
- fi
- # Start compilation with or without log
- if [ "$LOG" == "log" ]
- then
- echo -e "${bldblu}Compiling for $DEVICE and saving a build log file ${txtrst}"
- mka bacon 2>&1 | tee build.log;
- else
- echo -e "${bldblu}Compiling for $DEVICE without saving a build log file ${txtrst}"
- mka bacon;
- fi
- # If the above was successful
- if [ `ls $BUILD_PATH/pure_*.zip 2>/dev/null | wc -l` != "0" ]
- then
- BUILD_RESULT="Build successful"
- # copy ROM.zip to root
- echo -e "${bldblu}Copying ROM.zip to $ROOT_PATH ${txtrst}"
- cp $BUILD_PATH/pure_*.zip $ROOT_PATH
- # If the build failed
- else
- BUILD_RESULT="Build failed"
- fi
- # back to root dir
- cd $ROOT_PATH
- # Stop tracking time
- END=$(date +%s)
- echo -e ${bldblu}
- echo -e "-------------------------------------"
- echo -e "SCRIPT ENDING AT $(date +%D\ %r)"
- echo -e ""
- echo -e "${BUILD_RESULT}!"
- echo -e "TIME: $(echo $((${END}-${START})) | awk '{print int($1/60)" MINUTES AND "int($1%60)" SECONDS"}')"
- echo -e "-------------------------------------"
- echo -e ${txtrst}
- BUILDTIME="Build time: $(echo $((${END}-${START})) | awk '{print int($1/60)" minutes and "int($1%60)" seconds"}')"
- curl -s \
- --form-string "token=APP_TOKEN" \
- --form-string "user=USER_KEY" \
- --form-string "message=
- $BUILD_RESULT
- $BUILDTIME" \
- https://api.pushover.net/1/messages.json
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement