X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fscripts%2Fanbox-shell.sh;fp=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fscripts%2Fanbox-shell.sh;h=10016f0d6d32e92a9c5de7271f61bff65266b77d;hb=e26c1ec581be598521517829adba8c8dd23a768f;hp=0000000000000000000000000000000000000000;hpb=6699c1aea74eeb0eb400e6299079f0c7576f716f;p=iec.git diff --git a/src/type3_AndroidCloud/anbox-master/scripts/anbox-shell.sh b/src/type3_AndroidCloud/anbox-master/scripts/anbox-shell.sh new file mode 100644 index 0000000..10016f0 --- /dev/null +++ b/src/type3_AndroidCloud/anbox-master/scripts/anbox-shell.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +if [ "$(id -u)" -ne 0 ]; then + echo "ERROR: You need to run this script as root!" + exit 1 +fi + +CONTAINER_PATH="$SNAP_COMMON/containers" +CONTAINER_NAME=default + +if [ -z "$SNAP" ] ; then + CONTAINER_PATH=/var/lib/anbox/containers +fi + +state=$(lxc-info -P "$CONTAINER_PATH" -n "$CONTAINER_NAME" -s | cut -d':' -f 2 | tr -d '[:space:]') +if [ "$state" != "RUNNING" ] ; then + echo "ERROR: Cannot attach to container as it is not running" + exit 1 +fi + +echo "NOTE: This shell will give you full root access inside the Android" +echo " container. Be careful with what you're doing!" +echo + +exec lxc-attach \ + -q \ + --clear-env \ + -P "$CONTAINER_PATH" \ + -n "$CONTAINER_NAME" \ + -v PATH=/sbin:/system/bin:/system/sbin:/system/xbin \ + -v ANDROID_ASSETS=/assets \ + -v ANDROID_DATA=/data \ + -v ANDROID_ROOT=/system \ + -v ANDROID_STORAGE=/storage \ + -v ASEC_MOUNTPOINT=/mnt/asec \ + -v EXTERNAL_STORAGE=/sdcard -- /system/bin/sh