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
6ce9225f
Commit
6ce9225f
authored
Dec 19, 2020
by
vvb2060
Committed by
topjohnwu
Dec 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check block dev ro status
magisk is shared object, use static busybox instead
parent
13a88206
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
13 deletions
+28
-13
manager.sh
app/src/main/res/raw/manager.sh
+10
-4
util_functions.sh
scripts/util_functions.sh
+18
-9
No files found.
app/src/main/res/raw/manager.sh
View file @
6ce9225f
...
@@ -30,10 +30,16 @@ direct_install() {
...
@@ -30,10 +30,16 @@ direct_install() {
rm
-f
$MAGISKBIN
/new-boot.img
rm
-f
$MAGISKBIN
/new-boot.img
echo
"- Flashing new boot image"
echo
"- Flashing new boot image"
flash_image
$1
/new-boot.img
$2
flash_image
$1
/new-boot.img
$2
if
[
$?
-ne
0
]
;
then
case
$?
in
echo
"! Insufficient partition size"
1
)
return
1
echo
"! Insufficient partition size"
fi
return
1
;;
2
)
echo
"!
$2
is read only"
return
2
;;
esac
rm
-rf
$1
rm
-rf
$1
return
0
return
0
}
}
...
...
scripts/util_functions.sh
View file @
6ce9225f
...
@@ -388,8 +388,6 @@ find_boot_image() {
...
@@ -388,8 +388,6 @@ find_boot_image() {
}
}
flash_image
()
{
flash_image
()
{
# Make sure all blocks are writable
$MAGISKBIN
/magisk
--unlock-blocks
2>/dev/null
case
"
$1
"
in
case
"
$1
"
in
*
.gz
)
CMD1
=
"
$MAGISKBIN
/magiskboot decompress '
$1
' - 2>/dev/null"
;;
*
.gz
)
CMD1
=
"
$MAGISKBIN
/magiskboot decompress '
$1
' - 2>/dev/null"
;;
*
)
CMD1
=
"cat '
$1
'"
;;
*
)
CMD1
=
"cat '
$1
'"
;;
...
@@ -401,16 +399,19 @@ flash_image() {
...
@@ -401,16 +399,19 @@ flash_image() {
CMD2
=
"cat -"
CMD2
=
"cat -"
fi
fi
if
[
-b
"
$2
"
]
;
then
if
[
-b
"
$2
"
]
;
then
local
img_sz
=
`
stat
-c
'%s'
"
$1
"
`
local
img_sz
=
$(
stat
-c
'%s'
"
$1
"
)
local
blk_sz
=
`
blockdev
--getsize64
"
$2
"
`
local
blk_sz
=
$(
blockdev
--getsize64
"
$2
"
)
[
$img_sz
-gt
$blk_sz
]
&&
return
1
[
"
$img_sz
"
-gt
"
$blk_sz
"
]
&&
return
1
eval
$CMD1
|
eval
$CMD2
|
cat
- /dev/zero
>
"
$2
"
2>/dev/null
blockdev
--setrw
"
$2
"
local
blk_ro
=
$(
blockdev
--getro
"
$2
"
)
[
"
$blk_ro
"
-eq
1
]
&&
return
2
eval
"
$CMD1
"
|
eval
"
$CMD2
"
|
cat
- /dev/zero
>
"
$2
"
2>/dev/null
elif
[
-c
"
$2
"
]
;
then
elif
[
-c
"
$2
"
]
;
then
flash_eraseall
"
$2
"
>
&2
flash_eraseall
"
$2
"
>
&2
eval
$CMD1
|
eval
$CMD2
| nandwrite
-p
"
$2
"
-
>
&2
eval
"
$CMD1
"
|
eval
"
$CMD2
"
| nandwrite
-p
"
$2
"
-
>
&2
else
else
ui_print
"- Not block or char device, storing image"
ui_print
"- Not block or char device, storing image"
eval
$CMD1
|
eval
$CMD2
>
"
$2
"
2>/dev/null
eval
"
$CMD1
"
|
eval
"
$CMD2
"
>
"
$2
"
2>/dev/null
fi
fi
return
0
return
0
}
}
...
@@ -445,7 +446,15 @@ install_magisk() {
...
@@ -445,7 +446,15 @@ install_magisk() {
# Restore the original boot partition path
# Restore the original boot partition path
[
"
$BOOTNAND
"
]
&&
BOOTIMAGE
=
$BOOTNAND
[
"
$BOOTNAND
"
]
&&
BOOTIMAGE
=
$BOOTNAND
flash_image new-boot.img
"
$BOOTIMAGE
"
||
abort
"! Insufficient partition size"
flash_image new-boot.img
"
$BOOTIMAGE
"
case
$?
in
1
)
abort
"! Insufficient partition size"
;;
2
)
abort
"!
$BOOTIMAGE
is read only"
;;
esac
./magiskboot cleanup
./magiskboot cleanup
rm
-f
new-boot.img
rm
-f
new-boot.img
...
...
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