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
This commit is contained in:
Chris Renshaw authored and GitHub committed 2023-08-10 12:36:28 -03:00
1 parent 9ab60a49de
commit a5ce1c04d1
1 file changed
+2 -2
+2 -2
View File
@@ -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;