From a5ce1c04d14a835238f01e321bc587c23d93970f Mon Sep 17 00:00:00 2001 From: Chris Renshaw Date: Thu, 10 Aug 2023 12:36:28 -0300 Subject: [PATCH] Backend: hide shcon workaround stderr on (likely) working recoveries - some recoveries don't allow reading/changing shell context and will show an error: sh: write error: Invalid argument - these recoveries seem to allow loop mounts unlike most LOS Recovery builds lately, so hide the error output --- META-INF/com/google/android/update-binary | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary index 66cebc5..df1b499 100755 --- a/META-INF/com/google/android/update-binary +++ b/META-INF/com/google/android/update-binary @@ -58,7 +58,7 @@ mount_apex() { setup_mountpoint /apex; mount -t tmpfs tmpfs /apex -o mode=755 && touch /apex/apextmp; shcon=$(cat /proc/self/attr/current); - echo "u:r:su:s0" > /proc/self/attr/current; # work around LOS Recovery not allowing loop mounts in recovery context + echo "u:r:su:s0" > /proc/self/attr/current 2>/dev/null; # work around LOS Recovery not allowing loop mounts in recovery context minorx=1; [ -e /dev/block/loop1 ] && minorx=$(ls -l /dev/block/loop1 | awk '{ print $6 }'); num=0; @@ -94,7 +94,7 @@ mount_apex() { *) mount -o bind $apex $dest && echo "$dest (bind)" >&2;; esac; done; - echo "$shcon" > /proc/self/attr/current; + echo "$shcon" > /proc/self/attr/current 2>/dev/null; for var in $(grep -o 'export .* /.*' /system_root/init.environ.rc | awk '{ print $2 }'); do eval OLD_${var}=\$$var; done;