Merge branch 'master' into update-readme

This commit is contained in:
Simon Fels 2018-05-26 18:18:23 +02:00 committed by GitHub
commit a05ca6a20d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 1 deletions

36
scripts/anbox-shell.sh Executable file
View file

@ -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

View file

@ -26,7 +26,7 @@ set -x
cp /var/snap/anbox/common/data/system.log $TMPDIR || true
cp /var/snap/anbox/containers/lxc-monitord.log $TMPDIR || true
cp /var/snap/anbox/logs/container.log $TMPDIR || true
anbox system-info > $TMPDIR/system-info.log 2>&1 || true
$SNAP/command-anbox.wrapper system-info > $TMPDIR/system-info.log 2>&1 || true
if [ -e /etc/systemd/system/snap.anbox.container-manager.service ]; then
sudo journalctl --no-pager -u snap.anbox.container-manager.service > $TMPDIR/container-manager.log 2>&1

View file

@ -37,6 +37,8 @@ apps:
daemon: simple
collect-bug-info:
command: bin/collect-bug-info.sh
shell:
command: bin/anbox-shell.sh
android-settings:
command: desktop-launch $SNAP/bin/app-android-settings.sh
desktop: desktop/android-settings.desktop
@ -159,8 +161,10 @@ parts:
collect-bug-info.sh: bin/collect-bug-info.sh
app-android-settings.sh: bin/app-android-settings.sh
app-appmgr.sh: bin/app-appmgr.sh
anbox-shell.sh: bin/anbox-shell.sh
prime:
- bin/anbox-bridge.sh
- bin/anbox-shell.sh
- bin/anbox-wrapper.sh
- bin/container-manager.sh
- bin/collect-bug-info.sh