43 lines
1.4 KiB
Bash
Executable File
43 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
# Compatibility wrapper. The shared emulator lives in the sibling
|
|
# mg-infotainment-emulator repository.
|
|
# Existing MG Utility commands continue to work with this script.
|
|
|
|
set -eu
|
|
|
|
APP_ROOT=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
EMULATOR_REPO=${MG_EMULATOR_REPO:-$APP_ROOT/../mg-infotainment-emulator}
|
|
if [ ! -x "$EMULATOR_REPO/emulator.sh" ]; then
|
|
echo "emulator: shared helper not found at $EMULATOR_REPO/emulator.sh; set MG_EMULATOR_REPO" >&2
|
|
exit 1
|
|
fi
|
|
GENERIC=$EMULATOR_REPO/emulator.sh
|
|
|
|
case "${1:-}" in
|
|
install)
|
|
# Preserve the old convenience behavior: build MG Utility on demand
|
|
# when no APK has been supplied and the default artifact is absent.
|
|
if [ "$#" -eq 1 ] && [ -z "${MG_APP_APK:-}" ] && [ ! -f "$APP_ROOT/build/MG-Utility.apk" ]; then
|
|
(cd "$APP_ROOT" && ./build.sh)
|
|
fi
|
|
MG_APP_APK=${MG_APP_APK:-$APP_ROOT/build/MG-Utility.apk}
|
|
export MG_APP_APK
|
|
exec "$GENERIC" "$@"
|
|
;;
|
|
launch)
|
|
MG_APP_PACKAGE=${MG_APP_PACKAGE:-cloud.molberg.mgutility}
|
|
MG_APP_ACTIVITY=${MG_APP_ACTIVITY:-.MainActivity}
|
|
export MG_APP_PACKAGE MG_APP_ACTIVITY
|
|
exec "$GENERIC" "$@"
|
|
;;
|
|
screenshot)
|
|
if [ "$#" -eq 1 ]; then
|
|
exec "$GENERIC" screenshot "$APP_ROOT/build/emulator/screenshot.png"
|
|
fi
|
|
exec "$GENERIC" "$@"
|
|
;;
|
|
*)
|
|
exec "$GENERIC" "$@"
|
|
;;
|
|
esac
|