Advertisement
Guest User

rom-build.sh

a guest
Oct 12th, 2013
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.62 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # before building
  4.  
  5. cd ~/pa43-modded/
  6. export PATH=~/bin:$PATH
  7. export USE_CCACHE=1
  8. #repo sync -j16
  9.  
  10. # get current path
  11. reldir=/var/lib/jenkins/pa43-modded/
  12. cd $reldir
  13. DIR=`pwd`
  14.  
  15. # Colorize and add text parameters
  16. red=$(tput setaf 1)             #  red
  17. grn=$(tput setaf 2)             #  green
  18. cya=$(tput setaf 6)             #  cyan
  19. txtbld=$(tput bold)             # Bold
  20. bldred=${txtbld}$(tput setaf 1) #  red
  21. bldgrn=${txtbld}$(tput setaf 2) #  green
  22. bldblu=${txtbld}$(tput setaf 4) #  blue
  23. bldcya=${txtbld}$(tput setaf 6) #  cyan
  24. txtrst=$(tput sgr0)             # Reset
  25.  
  26. THREADS="16"
  27. DEVICE="i9300"
  28. EXTRAS="clean"
  29.  
  30. # get current version
  31. MAJOR=$(cat $DIR/vendor/pa/config/pa_common.mk | grep 'PA_VERSION_MAJOR = *' | sed  's/PA_VERSION_MAJOR = //g')
  32. MINOR=$(cat $DIR/vendor/pa/config/pa_common.mk | grep 'PA_VERSION_MINOR = *' | sed  's/PA_VERSION_MINOR = //g')
  33. MAINTENANCE=$(cat $DIR/vendor/pa/config/pa_common.mk | grep 'PA_VERSION_MAINTENANCE = *' | sed  's/PA_VERSION_MAINTENANCE = //g')
  34. VERSION=$MAJOR.$MINOR$MAINTENANCE
  35.  
  36. # if we have not extras, reduce parameter index by 1
  37. if [ "$EXTRAS" == "true" ] || [ "$EXTRAS" == "false" ]
  38. then
  39.    SYNC="$2"
  40.    UPLOAD="$3"
  41. else
  42.    SYNC="$3"
  43.    UPLOAD="$4"
  44. fi
  45.  
  46. # get time of startup
  47. res1=$(date +%s.%N)
  48.  
  49. # we don't allow scrollback buffer
  50. echo -e '\0033\0143'
  51. clear
  52.  
  53. echo -e "${cya}Building ${bldcya}ParanoidAndroid v$VERSION ${txtrst}";
  54.  
  55. echo -e "${cya}"
  56. ./vendor/pa/tools/getdevicetree.py $DEVICE
  57. echo -e "${txtrst}"
  58.  
  59. # decide what command to execute
  60. case "$EXTRAS" in
  61.    threads)
  62.        echo -e "${bldblu}Please write desired threads followed by [ENTER] ${txtrst}"
  63.        read threads
  64.        THREADS=$threads;;
  65.    clean)
  66.        echo -e ""
  67.        echo -e "${bldblu}Cleaning intermediates and output files ${txtrst}"
  68.        make clean > /dev/null;;
  69. esac
  70.  
  71. # sync with latest sources
  72. echo -e ""
  73. if [ "$SYNC" == "true" ]
  74. then
  75.    echo -e "${bldblu}Fetching latest sources ${txtrst}"
  76.    repo sync -j"$THREADS"
  77.    echo -e ""
  78. fi
  79.  
  80. # java setup
  81. # echo -e "${bldblu}Setting up java ${txtrst}"
  82. # . vendor/pa/tools/setupjava.sh
  83. # echo -e ""
  84.  
  85. # setup environment
  86. echo -e "${bldblu}Setting up environment ${txtrst}"
  87. . build/envsetup.sh
  88.  
  89. # lunch device
  90. echo -e ""
  91. echo -e "${bldblu}Lunching device ${txtrst}"
  92. lunch "pa_$DEVICE-userdebug";
  93.  
  94. echo -e ""
  95. echo -e "${bldblu}Starting compilation ${txtrst}"
  96.  
  97. # start compilation
  98. mka bacon
  99. echo -e ""
  100.  
  101. # finished? get elapsed time
  102. res2=$(date +%s.%N)
  103. echo "${bldgrn}Total time elapsed: ${txtrst}${grn}$(echo "($res2 - $res1) / 60"|bc ) minutes ($(echo "$res2 - $res1"|bc ) seconds) ${txtrst}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement