2013-08-12 12:30:04 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2016-01-14 14:07:40 +00:00
|
|
|
# android_install_app: installs the Skia development apps on the device.
|
2013-08-12 12:30:04 +00:00
|
|
|
|
|
|
|
function print_usage {
|
2016-07-12 16:12:39 +00:00
|
|
|
echo "USAGE: android_install_app [options]"
|
2013-08-12 12:30:04 +00:00
|
|
|
echo " Options: -f Forces the package to be installed by removing any"
|
|
|
|
echo " previously installed packages"
|
|
|
|
echo " -h Prints this help message"
|
|
|
|
echo " -s [device_s/n] Serial number of the device to be used"
|
|
|
|
}
|
|
|
|
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
2017-01-04 19:02:52 +00:00
|
|
|
source $SCRIPT_DIR/utils/android_setup.sh
|
2013-08-12 12:30:04 +00:00
|
|
|
source $SCRIPT_DIR/utils/setup_adb.sh
|
|
|
|
|
|
|
|
forceRemoval="false"
|
|
|
|
|
2015-06-18 20:08:26 +00:00
|
|
|
for arg in ${APP_ARGS[@]}; do
|
|
|
|
if [[ "${arg}" == "-f" ]]; then
|
2013-08-12 12:30:04 +00:00
|
|
|
forceRemoval="true"
|
2015-06-18 20:08:26 +00:00
|
|
|
elif [[ "${arg}" == "-h" ]]; then
|
2013-08-12 12:30:04 +00:00
|
|
|
print_usage
|
|
|
|
exit
|
2015-06-18 20:08:26 +00:00
|
|
|
elif [[ ${arg} == '-'* ]]; then
|
2013-11-06 15:01:37 +00:00
|
|
|
echo "ERROR: unrecognized option ${arg}"
|
2013-08-12 12:30:04 +00:00
|
|
|
print_usage
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2017-01-04 19:02:52 +00:00
|
|
|
APP_LC=$(echo Viewer | tr "[:upper:]" "[:lower:]")
|
2015-06-18 20:08:26 +00:00
|
|
|
|
2013-08-12 12:30:04 +00:00
|
|
|
if [[ "$forceRemoval" == "true" ]];
|
|
|
|
then
|
|
|
|
echo "Forcing removal of previously installed packages"
|
2017-01-04 19:02:52 +00:00
|
|
|
$ADB ${DEVICE_SERIAL} uninstall org.skia.${APP_LC} > /dev/null
|
2015-07-31 17:25:17 +00:00
|
|
|
fi
|
|
|
|
|
2017-01-04 19:02:52 +00:00
|
|
|
echo "Installing ${APP_LC} from ${SKIA_OUT}/${APP_LC}.apk"
|
|
|
|
$ADB ${DEVICE_SERIAL} install -r ${SKIA_OUT}/${APP_LC}.apk
|
2015-06-18 20:08:26 +00:00
|
|
|
|