From 83215524dee96f06a59058bb1784764bfc959452 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Wed, 30 May 2018 08:58:03 +0200 Subject: [PATCH] Add snap configure hook to allow enable debug mode --- .gitignore | 1 - scripts/container-manager.sh | 4 ++++ scripts/snap-wrapper.sh | 4 ++++ snap/hooks/configure | 9 +++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 snap/hooks/configure diff --git a/.gitignore b/.gitignore index a9b4b45..0a290ca 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ build*/ parts/ stage/ prime/ -snap/ android-images/ *.snap CMakeLists.txt.user diff --git a/scripts/container-manager.sh b/scripts/container-manager.sh index a0fec05..7e7fb15 100755 --- a/scripts/container-manager.sh +++ b/scripts/container-manager.sh @@ -43,6 +43,10 @@ start() { $SNAP/sbin/apparmor_parser -r $SNAP/apparmor/anbox-container.aa fi + if [ -e "$SNAP_COMMON"/.enable_debug ]; then + export ANBOX_LOG_LEVEL=debug + fi + exec $AA_EXEC $SNAP/bin/anbox-wrapper.sh container-manager \ --data-path=$DATA_PATH \ --android-image=$ANDROID_IMG \ diff --git a/scripts/snap-wrapper.sh b/scripts/snap-wrapper.sh index 60cb85e..7524225 100755 --- a/scripts/snap-wrapper.sh +++ b/scripts/snap-wrapper.sh @@ -29,4 +29,8 @@ export XDG_DATA_HOME="$SNAP_USER_COMMON/app-data" # configured but the actual EGL implementation is missing. export __EGL_VENDOR_LIBRARY_DIRS="$SNAP/glvnd" +if [ -e "$SNAP_COMMON"/.enable_debug ]; then + export ANBOX_LOG_LEVEL=debug +fi + exec $SNAP/usr/bin/anbox $@ diff --git a/snap/hooks/configure b/snap/hooks/configure new file mode 100755 index 0000000..89dea03 --- /dev/null +++ b/snap/hooks/configure @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ "$(snapctl get debug.enable)" = true ]; then + touch "$SNAP_COMMON"/.enable_debug +else + rm -f "$SNAP_COMMON"/.enable_debug +fi + +exit 0