From 1450230c316ecdeb8ad98dda8ebf6030d9159d8e Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Sun, 25 Oct 2020 21:08:28 +0100 Subject: [PATCH] Make rw-system debug easier, but just having to create /cache/phh-log (obviously works only if device has a cache partition), and having perms make it accessible from system app (treble app) --- rw-system.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/rw-system.sh b/rw-system.sh index 7881880..e745c7e 100644 --- a/rw-system.sh +++ b/rw-system.sh @@ -1,10 +1,14 @@ #!/system/bin/sh -#Uncomment me to output sh -x of this script to /cache/phh/logs -#if [ -z "$debug" ];then -# mkdir -p /cache/phh -# debug=1 exec sh -x "$(readlink -f -- "$0")" > /cache/phh/logs 2>&1 -#fi +if [ -z "$debug" ] && [ -f /cache/phh-log ];then + mkdir -p /cache/phh + debug=1 exec sh -x "$(readlink -f -- "$0")" > /cache/phh/logs 2>&1 +else + # Allow accessing logs from system app + # Protected via SELinux for other apps + chmod 0755 /cache/phh + chmod 0644 /cache/phh/logs +fi vndk="$(getprop persist.sys.vndk)" [ -z "$vndk" ] && vndk="$(getprop ro.vndk.version |grep -oE '^[0-9]+')"