Commit e6bd5f2c authored by osm0sis's avatar osm0sis Committed by John Wu

Display error if actual Magisk addon.d script cannot be run

- this would likely occur on an FDE device with block map OTAs (a la LineageOS) since they do not require/request decrypt
- for reference all other addon.d "v1" cases should work fine:
  1) FDE with openrecovery script works fine since it requests decrypt
  2) FBE with openrecovery script OR block map work fine since /data/adb remains accessible
parent 8a904ee3
...@@ -80,9 +80,23 @@ if [ -d /system/addon.d ]; then ...@@ -80,9 +80,23 @@ if [ -d /system/addon.d ]; then
ui_print "- Adding addon.d survival script" ui_print "- Adding addon.d survival script"
mount -o rw,remount /system mount -o rw,remount /system
ADDOND=/system/addon.d/99-magisk.sh ADDOND=/system/addon.d/99-magisk.sh
echo '#!/sbin/sh' > $ADDOND cat <<EOF > $ADDOND
echo '# ADDOND_VERSION=2' >> $ADDOND #!/sbin/sh
echo 'exec sh /data/adb/magisk/addon.d.sh "$@"' >> $ADDOND # ADDOND_VERSION=2
if [ -f /data/adb/magisk/addon.d.sh ]; then
exec sh /data/adb/magisk/addon.d.sh "\$@"
else
OUTFD=\$(ps | grep -oE 'update(.*)' | grep -v 'grep' | cut -d" " -f3)
ui_print() { echo -e "ui_print \$1\nui_print" >> /proc/self/fd/\$OUTFD; }
ui_print "************************"
ui_print "* Magisk addon.d failed"
ui_print "************************"
ui_print "! Cannot find Magisk binaries - was data wiped or not decrypted?"
ui_print "! Reflash OTA from decrypted recovery or reflash Magisk"
fi
EOF
chmod 755 $ADDOND chmod 755 $ADDOND
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment