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
10ed299c
Commit
10ed299c
authored
Feb 09, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect recovery on FBE devices with no DE access
parent
32b12491
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
+23
-22
flash_script.sh
scripts/flash_script.sh
+23
-22
No files found.
scripts/flash_script.sh
View file @
10ed299c
...
@@ -53,33 +53,44 @@ getvar KEEPVERITY
...
@@ -53,33 +53,44 @@ getvar KEEPVERITY
getvar KEEPFORCEENCRYPT
getvar KEEPFORCEENCRYPT
getvar BOOTIMAGE
getvar BOOTIMAGE
[
-z
$BOOTIMAGE
]
&&
abort
"! Unable to detect boot image"
ui_print
"- Found boot/ramdisk image:
$BOOTIMAGE
"
if
[
!
-z
$DTBOIMAGE
]
;
then
ui_print
"- Found dtbo image:
$DTBOIMAGE
"
# Disable dtbo patch by default
[
-z
$KEEPVERITY
]
&&
KEEPVERITY
=
true
fi
# Detect version and architecture
# Detect version and architecture
api_level_arch_detect
api_level_arch_detect
[
$API
-lt
21
]
&&
abort
"! Magisk is only for Lollipop 5.0+ (SDK 21+)"
[
$API
-lt
21
]
&&
abort
"! Magisk is only for Lollipop 5.0+ (SDK 21+)"
# Check if system root is installed and remove
remove_system_su
ui_print
"- Device platform:
$ARCH
"
ui_print
"- Device platform:
$ARCH
"
BINDIR
=
$INSTALLER
/
$ARCH
BINDIR
=
$INSTALLER
/
$ARCH
chmod
-R
755
$CHROMEDIR
$BINDIR
chmod
-R
755
$CHROMEDIR
$BINDIR
# Check if system root is installed and remove
remove_system_su
##########################################################################################
##########################################################################################
# Environment
# Environment
##########################################################################################
##########################################################################################
ui_print
"- Constructing environment"
ui_print
"- Constructing environment"
if
is_mounted /data
;
then
# Check if we can actually access the data (DE storage)
MAGISKBIN
=
/data/adb/magisk
DATA
=
false
mkdir
-p
/data/adb 2>/dev/null
if
grep
' /data '
/proc/mounts |
grep
-vq
'tmpfs'
;
then
chmod
700 /data/adb 2>/dev/null
[
!
-d
/data/adb
]
&&
mkdir
/data/adb
touch
/data/adb/.write_test
&&
rm
/data/adb/.write_test
&&
DATA
=
true
fi
# Some legacy migration
if
$DATA
;
then
MAGISKBIN
=
/data/adb/magisk
run_migrations
run_migrations
[
-L
/data/magisk.img
]
||
mv
/data/magisk.img /data/adb/magisk.img 2>/dev/null
else
else
MAGISKBIN
=
/cache/data_bin
MAGISKBIN
=
/cache/data_bin
fi
fi
...
@@ -104,18 +115,8 @@ $BOOTMODE || recovery_actions
...
@@ -104,18 +115,8 @@ $BOOTMODE || recovery_actions
# Boot patching
# Boot patching
##########################################################################################
##########################################################################################
[
-z
$BOOTIMAGE
]
&&
find_boot_image
[
-z
$BOOTIMAGE
]
&&
abort
"! Unable to detect boot image"
ui_print
"- Found boot image:
$BOOTIMAGE
"
if
[
!
-z
$DTBOIMAGE
]
;
then
ui_print
"- Found dtbo image:
$DTBOIMAGE
"
# Disable dtbo patch by default
[
-z
$KEEPVERITY
]
&&
KEEPVERITY
=
true
fi
eval
$BOOTSIGNER
-verify
<
$BOOTIMAGE
&&
BOOTSIGNED
=
true
eval
$BOOTSIGNER
-verify
<
$BOOTIMAGE
&&
BOOTSIGNED
=
true
$BOOTSIGNED
&&
ui_print
"-
Signed boot image detected
"
$BOOTSIGNED
&&
ui_print
"-
Boot image is signed with AVB 1.0
"
SOURCEDMODE
=
true
SOURCEDMODE
=
true
cd
$MAGISKBIN
cd
$MAGISKBIN
...
@@ -128,14 +129,14 @@ rm -f new-boot.img
...
@@ -128,14 +129,14 @@ rm -f new-boot.img
if
[
-f
stock_boot
*
]
;
then
if
[
-f
stock_boot
*
]
;
then
rm
-f
/data/stock_boot
*
2>/dev/null
rm
-f
/data/stock_boot
*
2>/dev/null
is_mounted /data
&&
mv
stock_boot
*
/data
$DATA
&&
mv
stock_boot
*
/data
fi
fi
$KEEPVERITY
||
patch_dtbo_image
$KEEPVERITY
||
patch_dtbo_image
if
[
-f
stock_dtbo
*
]
;
then
if
[
-f
stock_dtbo
*
]
;
then
rm
-f
/data/stock_dtbo
*
2>/dev/null
rm
-f
/data/stock_dtbo
*
2>/dev/null
is_mounted /data
&&
mv
stock_dtbo
*
/data
$DATA
&&
mv
stock_dtbo
*
/data
fi
fi
cd
/
cd
/
...
...
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