| 1 | #This installs the Android SDK (Software Development Kit)
|
|---|
| 2 | #which is needed for the compilation of the Java project.
|
|---|
| 3 |
|
|---|
| 4 | step=1;
|
|---|
| 5 |
|
|---|
| 6 | #Different steps here.
|
|---|
| 7 | #1: install sdk, ant and sdk tools
|
|---|
| 8 | #2: install an emulator.
|
|---|
| 9 | #3: test the emulator
|
|---|
| 10 | #4: cleanup
|
|---|
| 11 |
|
|---|
| 12 | present_dir=`pwd`;
|
|---|
| 13 | default_droid="Android-4.0"
|
|---|
| 14 | sd_card="issm-sdcard"
|
|---|
| 15 |
|
|---|
| 16 | if [[ $step == "1" ]]; then
|
|---|
| 17 |
|
|---|
| 18 | #Cleanup the install
|
|---|
| 19 | rm -rf install-sdk install-ant
|
|---|
| 20 |
|
|---|
| 21 | #Download from ISSM server
|
|---|
| 22 | $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/android-sdk_r18-macosx.zip' 'android-sdk_r18-macosx.zip'
|
|---|
| 23 |
|
|---|
| 24 | # Install Android SDK and NDK.
|
|---|
| 25 | unzip -o android-sdk_r18-macosx.zip
|
|---|
| 26 | unzip -o apache-ant-1.8.2-bin.zip
|
|---|
| 27 |
|
|---|
| 28 | #Move to install
|
|---|
| 29 | mv -f android-sdk-macosx install-sdk
|
|---|
| 30 | mv -f apache-ant-1.8.2 install-ant
|
|---|
| 31 |
|
|---|
| 32 | #Post_install configuration:
|
|---|
| 33 | #We need specific settings for specific platforms, for the SDK to
|
|---|
| 34 | #function properly
|
|---|
| 35 |
|
|---|
| 36 | #For now, we need to install:
|
|---|
| 37 | #android sdk platform tools
|
|---|
| 38 | #and a specific android api: API 15 and API 14
|
|---|
| 39 | #Note: API 15 and 14 correspond to Android 4.0.3 and 4.0 respectively.
|
|---|
| 40 |
|
|---|
| 41 | cd install-sdk/tools/ && source ./android update sdk -t platform-tools,android-15,android-14,system-image --no-ui
|
|---|
| 42 |
|
|---|
| 43 | fi
|
|---|
| 44 |
|
|---|
| 45 | if [[ $step == "2" ]]; then
|
|---|
| 46 |
|
|---|
| 47 | #Once this is done, we need to install an emulator. Location will default to ~/.android/avd,
|
|---|
| 48 | #which we will move to $ISSM_DIR/externalpackages/android-emulators.
|
|---|
| 49 | #For now, it's called: Android-4.0.3
|
|---|
| 50 |
|
|---|
| 51 | #Here we delete the Android-4.0.3 device if it already exists.
|
|---|
| 52 | cd $present_dir/install-sdk/tools
|
|---|
| 53 |
|
|---|
| 54 | if [ -e $ANDROID_DIR/android-emulators/$default_droid ]
|
|---|
| 55 | then
|
|---|
| 56 | echo "Deleting previously created device: $default_droid"
|
|---|
| 57 | ./android delete avd -n $default_droid
|
|---|
| 58 | fi
|
|---|
| 59 |
|
|---|
| 60 | #Android will prompt the user to specify hardware emulation options. For now, default
|
|---|
| 61 | #default settings will suffice. Press 'enter' to take default settings or enter 'no'.
|
|---|
| 62 |
|
|---|
| 63 | ./android create avd -f -n $default_droid -t 1 -p $ANDROID_DIR/android-emulators/$default_droid --abi armeabi-v7a
|
|---|
| 64 | echo "Creating an SD Card"
|
|---|
| 65 | ./mksdcard -l $sd_card 2G $ANDROID_DIR/android-emulators/$sd_card.img
|
|---|
| 66 | fi
|
|---|
| 67 |
|
|---|
| 68 | if [[ $step == "3" ]]; then
|
|---|
| 69 | #Here we will start up our default emulator to test that it is working properly.
|
|---|
| 70 | #Once the device has booted we will use the Android Debug Bridge tool to gain
|
|---|
| 71 | #a terminal in our device.
|
|---|
| 72 |
|
|---|
| 73 | cd $present_dir/install-sdk/tools
|
|---|
| 74 | ./emulator -avd $default_droid -sdcard $ANDROID_DIR/android-emulators/$sd_card.img &
|
|---|
| 75 |
|
|---|
| 76 | cd ../platform-tools
|
|---|
| 77 | ./adb wait-for-device shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock1 /system
|
|---|
| 78 | #./adb wait-for-device shell
|
|---|
| 79 | ./adb push $ISSM_TIER/src/c/issm.exe /data/issm.exe
|
|---|
| 80 | ./adb shell chmod 777 /data/issm.exe
|
|---|
| 81 | ./adb shell /data/issm.exe
|
|---|
| 82 | fi
|
|---|
| 83 |
|
|---|
| 84 | if [[ $step == "4" ]]; then
|
|---|
| 85 | rm -rf install-sdk install-ant
|
|---|
| 86 | fi
|
|---|