Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
b3bc1a39
Commit
b3bc1a39
authored
Feb 09, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge addon.d scripts
parent
4dd8d75c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
27 deletions
+29
-27
addon.d.sh
scripts/addon.d.sh
+28
-5
flash_script.sh
scripts/flash_script.sh
+1
-22
No files found.
scripts/addon.d.sh
View file @
b3bc1a39
##########################################################################################
#!/sbin/sh
# ADDOND_VERSION=2
########################################################
#
#
# Magisk Survival Script for ROMs with addon.d support
# Magisk Survival Script for ROMs with addon.d support
# by topjohnwu
# by topjohnwu
and osm0sis
#
#
# Inspired by 99-flashafterupdate.sh of osm0sis @ xda-developers
########################################################
#
##########################################################################################
trampoline
()
{
mount /data 2>/dev/null
if
[
-f
/data/adb/magisk/addon.d.sh
]
;
then
exec
sh /data/adb/magisk/addon.d.sh
"
$@
"
else
OUTFD
=
$(
ps |
grep
-v
'grep'
|
grep
-oE
'update(.*)'
|
cut
-d
" "
-f3
)
[
"
$OUTFD
"
-eq
"
$OUTFD
"
]
2>/dev/null
||
OUTFD
=
$(
ps
-Af
|
grep
-v
'grep'
|
grep
-oE
'update(.*)'
|
cut
-d
" "
-f3
)
[
"
$OUTFD
"
-eq
"
$OUTFD
"
]
2>/dev/null
||
OUTFD
=
$(
ps |
grep
-v
'grep'
|
grep
-oE
'status_fd=(.*)'
|
cut
-d
=
-f2
)
[
"
$OUTFD
"
-eq
"
$OUTFD
"
]
2>/dev/null
||
OUTFD
=
$(
ps
-Af
|
grep
-v
'grep'
|
grep
-oE
'status_fd=(.*)'
|
cut
-d
=
-f2
)
ui_print
()
{
echo
-e
"ui_print
$1
\n
ui_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"
exit
1
fi
}
# Always use the script in /data
[
"
$0
"
=
/data/adb/magisk/addon.d.sh
]
||
trampoline
V1_FUNCS
=
/tmp/backuptool.functions
V1_FUNCS
=
/tmp/backuptool.functions
V2_FUNCS
=
/postinstall/system/bin/backuptool_ab.functions
V2_FUNCS
=
/postinstall/system/bin/backuptool_ab.functions
...
...
scripts/flash_script.sh
View file @
b3bc1a39
...
@@ -80,28 +80,7 @@ if [ -d /system/addon.d ]; then
...
@@ -80,28 +80,7 @@ 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
cat
<<
'
EOF
' >
$ADDOND
cp
-af
$COMMONDIR
/addon.d.sh
$ADDOND
#!/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
OUTFD=
$(
ps |
grep
-v
'grep'
|
grep
-oE
'update(.*)'
|
cut
-d
" "
-f3
)
[ ! -z
$OUTFD
-a "
$OUTFD
" -eq "
$OUTFD
" ] 2>/dev/null || OUTFD=
$(
ps
-Af
|
grep
-v
'grep'
|
grep
-oE
'update(.*)'
|
cut
-d
" "
-f3
)
[ ! -z
$OUTFD
-a "
$OUTFD
" -eq "
$OUTFD
" ] 2>/dev/null || OUTFD=
$(
ps |
grep
-v
'grep'
|
grep
-oE
'status_fd=(.*)'
|
cut
-d
=
-f2
)
[ ! -z
$OUTFD
-a "
$OUTFD
" -eq "
$OUTFD
" ] 2>/dev/null || OUTFD=
$(
ps
-Af
|
grep
-v
'grep'
|
grep
-oE
'status_fd=(.*)'
|
cut
-d
=
-f2
)
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment