| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # | 2 # |
| 3 # android_install_skia: installs the skia apk on the device. | 3 # android_install_skia: installs the skia apk on the device. |
| 4 | 4 |
| 5 function print_usage { | 5 function print_usage { |
| 6 echo "USAGE: android_install_skia [options]" | 6 echo "USAGE: android_install_skia [options]" |
| 7 echo " Options: -f Forces the package to be installed by removing any
" | 7 echo " Options: -f Forces the package to be installed by removing any
" |
| 8 echo " previously installed packages" | 8 echo " previously installed packages" |
| 9 echo " -h Prints this help message" | 9 echo " -h Prints this help message" |
| 10 echo " --install-launcher Remounts the system partition and installs the" | |
| 11 echo " skia_launcher binary on the device" | |
| 12 echo " --release Install the release build of Skia" | 10 echo " --release Install the release build of Skia" |
| 13 echo " -s [device_s/n] Serial number of the device to be used" | 11 echo " -s [device_s/n] Serial number of the device to be used" |
| 14 } | 12 } |
| 15 | 13 |
| 16 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 14 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 17 | 15 |
| 18 source $SCRIPT_DIR/utils/setup_adb.sh | 16 source $SCRIPT_DIR/utils/setup_adb.sh |
| 19 source $SCRIPT_DIR/utils/setup_skia_out.sh | 17 source $SCRIPT_DIR/utils/setup_skia_out.sh |
| 20 | 18 |
| 21 forceRemoval="false" | 19 forceRemoval="false" |
| 22 installLauncher="false" | 20 installLauncher="false" |
| 23 installOptions="-r" | 21 installOptions="-r" |
| 24 configuration="Debug" | 22 configuration="Debug" |
| 25 serialNumber="" | |
| 26 | 23 |
| 27 while (( "$#" )); do | 24 while (( "$#" )); do |
| 28 | 25 |
| 29 if [[ "$1" == "-f" ]]; | 26 if [[ "$1" == "-f" ]]; |
| 30 then | 27 then |
| 31 forceRemoval="true" | 28 forceRemoval="true" |
| 32 elif [[ "$1" == "-h" ]]; | 29 elif [[ "$1" == "-h" ]]; |
| 33 then | 30 then |
| 34 print_usage | 31 print_usage |
| 35 exit | 32 exit |
| 36 elif [[ "$1" == "--install-launcher" ]]; | |
| 37 then | |
| 38 installLauncher="true" | |
| 39 elif [[ "$1" == "-r" ]]; | 33 elif [[ "$1" == "-r" ]]; |
| 40 then | 34 then |
| 41 echo "DEPRECATED: -r is now a no-op" | 35 echo "DEPRECATED: -r is now a no-op" |
| 42 elif [[ "$1" == "--release" ]]; | 36 elif [[ "$1" == "--release" ]]; |
| 43 then | 37 then |
| 44 configuration="Release" | 38 configuration="Release" |
| 45 elif [[ "$1" == "-s" ]]; | |
| 46 then | |
| 47 if [[ $# -lt 2 ]]; | |
| 48 then | |
| 49 echo "ERROR: missing serial number" | |
| 50 exit 1; | |
| 51 fi | |
| 52 serialNumber="-s $2" | |
| 53 shift | |
| 54 else | 39 else |
| 55 echo "ERROR: unrecognized option $1" | 40 echo "ERROR: unrecognized option $1" |
| 56 print_usage | 41 print_usage |
| 57 exit 1; | 42 exit 1; |
| 58 fi | 43 fi |
| 59 | 44 |
| 60 shift | 45 shift |
| 61 done | 46 done |
| 62 | 47 |
| 63 if [[ "$forceRemoval" == "true" ]]; | 48 if [[ "$forceRemoval" == "true" ]]; |
| 64 then | 49 then |
| 65 echo "Forcing removal of previously installed packages" | 50 echo "Forcing removal of previously installed packages" |
| 66 $ADB ${serialNumber} uninstall com.skia > /dev/null | 51 $ADB ${DEVICE_SERIAL} uninstall com.skia > /dev/null |
| 67 fi | |
| 68 | |
| 69 if [[ "$installLauncher" == "true" ]]; | |
| 70 then | |
| 71 echo "Installing skia_launcher binary" | |
| 72 $ADB ${serialNumber} root | |
| 73 $ADB ${serialNumber} remount | |
| 74 $ADB ${serialNumber} push ${SKIA_OUT}/${configuration}/skia_launcher /system
/bin | |
| 75 fi | 52 fi |
| 76 | 53 |
| 77 echo "Installing Skia App from ${SKIA_OUT}/${configuration}" | 54 echo "Installing Skia App from ${SKIA_OUT}/${configuration}" |
| 78 $ADB ${serialNumber} install ${installOptions} ${SKIA_OUT}/${configuration}/andr
oid/bin/SkiaAndroid.apk | 55 $ADB ${DEVICE_SERIAL} install ${installOptions} ${SKIA_OUT}/${configuration}/and
roid/bin/SkiaAndroid.apk |
| OLD | NEW |