1. #!/bin/bash
  2.  
  3. # Written By Brandon Golway (brando56894)
  4. # All commands in this script were taken from
  5. # http://wiki.cyanogenmod.com/index.php?title=Compile_CyanogenMod_for_Sholes
  6. # Once executed this script will setup the build environment for a Motorola Droid
  7.  
  8.  
  9. #install the build packages for a 64 bit system
  10. sudo apt-get -y install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-6-jdk pngcrush g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib
  11.  
  12. #creating build directories
  13. mkdir -p ~/android/system
  14.  
  15. #installing repository
  16. curl http://android.git.kernel.org/repo > ~/build-env/repo
  17. chmod a+x ~/build-env/repo
  18. cd ~/android/system/
  19.  
  20. #syncing entire repository, including HTC Devices
  21. ~/build-env/repo init -u git://github.com/CyanogenMod/android.git -b froyo
  22. ~/build-env/repo sync
  23.  
  24. #grabbing proprietary files from phone
  25. if [[-d ~/build-env/proprietary ]];then
  26.    cp -R proprietary ~/android/system/vendor/motorola/sholes/
  27. else
  28.    read -p "Is your phone connected to the pc?"
  29.    sudo cp ~/build-env/adb /bin/
  30.    chmod a+x ~/build-env/adb
  31.    adb kill-server
  32.    sudo ~/build-env/adb start-server
  33.    cd ~/android/system/device/motorola/sholes/
  34.    ./extract-files.sh
  35. fi
  36.  
  37. #installs new versions of gApps and Rom Manager
  38. cd ~/android/system/vendor/cyanogen/
  39. ./get-rommanager
  40. ./get-google-files -v HDPI
  41.  
  42. #checks for updates to the source code
  43. cd ~/android/system/
  44. ~/build-env/repo sync
  45.  
  46. #configures build environment for sholes (droid)
  47. cp ./vendor/cyanogen/products/cyanogen_sholes.mk ./buildspec.mk
  48. . build/envsetup.sh
  49. lunch cyanogen_sholes-eng
  50.  
  51. echo "Done..."
  52. echo "Edit the source files that you want to"
  53. echo "Then run flash_recovery.sh"