techmik

download and build

Sep 4th, 2011
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.76 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # mybuild2.sh
  4.  
  5. # my custom script to download, build and flash
  6.  
  7. # note the start time
  8. START=$(date +%s)
  9.  
  10. # assign variable
  11. DEVICE="$1"
  12.  
  13. # start from the beginning, if called
  14. case "$DEVICE" in
  15.     buildall)
  16.         # make the needed directories
  17.         cd ~
  18.         mkdir -p ~/bin
  19.         mkdir -p ~/android/system
  20.         # download repo and make executable
  21.         curl http://android.git.kernel.org/repo > ~/bin/repo
  22.         chmod a+x ~/bin/repo
  23.         # reload terminal
  24.         source .bashrc
  25.         # change to the proper directory and download the source
  26.         cd ~/android/system/
  27.         repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
  28.         repo sync -j16
  29.         # extract proprietary files
  30.         cd ~/android/system/device/samsung/captivatemtd/
  31.         ./extract-files.sh
  32.         # change to top of build directory and build
  33.         cd ~/android/system
  34.         . build/envsetup.sh && brunch captivatemtd
  35.         ;;
  36.         exit        
  37.     clean)
  38.         make clean
  39.         rm -rf ./out
  40.         ;;
  41. esac
  42.  
  43. # get rom manager
  44. cd vendor/cyanogen
  45. ./get-rommanager
  46.  
  47. # prepare to build kernel
  48. cd ~/android/system && . build/envsetup.sh && lunch cyanogen_captivatemtd-eng
  49.  
  50. # change to kernel directory and build kernel
  51. cd ~/android/system/kernel/samsung/aries && ./build.sh captivatemtd
  52.  
  53. # change to top of build directory and build, using ccache to speed things up
  54. cd ~/android/system && USE_CCACHE=1 brunch captivatemtd
  55.  
  56. # push zip to connected phone and flash
  57. eat
  58.  
  59. # calculate and show elapsed time
  60. END=$(date +%s)
  61. ELAPSED=$((END - START))
  62. E_MIN=$((ELAPSED / 60))
  63. E_SEC=$((ELAPSED - E_MIN * 60))
  64. printf "Elapsed: "
  65. [ $E_MIN != 0 ] && printf "%d min(s) " $E_MIN
  66. printf "%d sec(s)\n" $E_SEC
Add Comment
Please, Sign In to add comment