scripts: fix signing in recovery with addon.d-v1

- change to $TMPDIR in addon.d.sh since recovery addon.d-v1 backup + restore leaves you in /tmp/addon.d which the restore then deletes, which would break $BOOTSIGNER execution with the following:
    libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 1078 (main), pid 1078 (main)
    Segmentation fault
- also move $BOOTSIGNER execution to after `cd $MAGISKBIN` to ensure it's in a working directory in all cases
- addon.d.sh data mount wasn't doing anything since /data has to already be mounted for the script to be running, so move it into /system/addon.d/99-magisk.sh stub script where it might be useful on recoveries that don't mount /data initially

Fixes #2013
This commit is contained in:
osm0sis
2019-11-02 22:50:33 -03:00
committed by John Wu
parent 0c9feedb37
commit 6fd357962f
3 changed files with 9 additions and 5 deletions

View File

@ -84,6 +84,8 @@ if [ -d /system/addon.d ]; then
#!/sbin/sh
# ADDOND_VERSION=2
mount /data 2>/dev/null
if [ -f /data/adb/magisk/addon.d.sh ]; then
exec sh /data/adb/magisk/addon.d.sh "\$@"
else