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
a46c6252
Commit
a46c6252
authored
Aug 11, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect insufficient partition size
Close #388
parent
5c1886c8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
9 deletions
+20
-9
InstallMagisk.java
.../full/java/com/topjohnwu/magisk/asyncs/InstallMagisk.java
+8
-6
utils.sh
app/src/full/res/raw/utils.sh
+5
-0
addon.d.sh
scripts/addon.d.sh
+1
-1
flash_script.sh
scripts/flash_script.sh
+1
-1
magisk_uninstaller.sh
scripts/magisk_uninstaller.sh
+1
-1
util_functions.sh
scripts/util_functions.sh
+4
-0
No files found.
app/src/full/java/com/topjohnwu/magisk/asyncs/InstallMagisk.java
View file @
a46c6252
...
@@ -248,7 +248,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
...
@@ -248,7 +248,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
return
patched
;
return
patched
;
}
}
private
void
outputBoot
(
File
patched
)
throws
IOException
{
private
boolean
outputBoot
(
File
patched
)
throws
IOException
{
switch
(
mode
)
{
switch
(
mode
)
{
case
PATCH_MODE:
case
PATCH_MODE:
String
fmt
=
mm
.
prefs
.
getString
(
Const
.
Key
.
BOOT_FORMAT
,
".img"
);
String
fmt
=
mm
.
prefs
.
getString
(
Const
.
Key
.
BOOT_FORMAT
,
".img"
);
...
@@ -278,13 +278,14 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
...
@@ -278,13 +278,14 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
break
;
break
;
case
SECOND_SLOT_MODE:
case
SECOND_SLOT_MODE:
case
DIRECT_MODE:
case
DIRECT_MODE:
Shell
.
Job
job
=
Shell
.
su
(
Utils
.
fmt
(
"direct_install %s %s %s"
,
patched
,
mBoot
,
installDir
))
if
(!
Shell
.
su
(
Utils
.
fmt
(
"direct_install %s %s %s"
,
patched
,
mBoot
,
installDir
))
.
to
(
console
,
logs
);
.
to
(
console
,
logs
).
exec
().
isSuccess
())
return
false
;
if
(!
Data
.
keepVerity
)
if
(!
Data
.
keepVerity
)
job
.
add
(
"find_dtbo_image"
,
"patch_dtbo_image"
);
Shell
.
su
(
"find_dtbo_image"
,
"patch_dtbo_image"
).
to
(
console
,
logs
).
exec
();
job
.
exec
();
break
;
break
;
}
}
return
true
;
}
}
private
void
postOTA
()
{
private
void
postOTA
()
{
...
@@ -374,7 +375,8 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
...
@@ -374,7 +375,8 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
File
patched
=
patchBoot
();
File
patched
=
patchBoot
();
if
(
patched
==
null
)
if
(
patched
==
null
)
return
false
;
return
false
;
outputBoot
(
patched
);
if
(!
outputBoot
(
patched
))
return
false
;
if
(
mode
==
SECOND_SLOT_MODE
)
if
(
mode
==
SECOND_SLOT_MODE
)
postOTA
();
postOTA
();
console
.
add
(
"- All done!"
);
console
.
add
(
"- All done!"
);
...
...
app/src/full/res/raw/utils.sh
View file @
a46c6252
...
@@ -60,8 +60,13 @@ direct_install() {
...
@@ -60,8 +60,13 @@ direct_install() {
cp
-rf
$3
/
*
/data/adb/magisk
cp
-rf
$3
/
*
/data/adb/magisk
echo
"- Flashing new boot image"
echo
"- Flashing new boot image"
flash_image
$1
$2
flash_image
$1
$2
if
[
$?
-ne
0
]
;
then
echo
"! Insufficient partition size"
return
1
fi
rm
-f
$1
rm
-f
$1
rm
-rf
$3
rm
-rf
$3
return
0
}
}
mm_patch_dtbo
()
{
mm_patch_dtbo
()
{
...
...
scripts/addon.d.sh
View file @
a46c6252
...
@@ -65,7 +65,7 @@ installation() {
...
@@ -65,7 +65,7 @@ installation() {
.
./boot_patch.sh
"
$BOOTIMAGE
"
.
./boot_patch.sh
"
$BOOTIMAGE
"
ui_print
"- Flashing new boot image"
ui_print
"- Flashing new boot image"
flash_image new-boot.img
"
$BOOTIMAGE
"
flash_image new-boot.img
"
$BOOTIMAGE
"
||
abort
"! Insufficient partition size"
rm
-f
new-boot.img
rm
-f
new-boot.img
if
[
-f
stock_boot
*
]
;
then
if
[
-f
stock_boot
*
]
;
then
...
...
scripts/flash_script.sh
View file @
a46c6252
...
@@ -115,7 +115,7 @@ cd $MAGISKBIN
...
@@ -115,7 +115,7 @@ cd $MAGISKBIN
.
./boot_patch.sh
"
$BOOTIMAGE
"
.
./boot_patch.sh
"
$BOOTIMAGE
"
ui_print
"- Flashing new boot image"
ui_print
"- Flashing new boot image"
flash_image new-boot.img
"
$BOOTIMAGE
"
flash_image new-boot.img
"
$BOOTIMAGE
"
||
abort
"! Insufficient partition size"
rm
-f
new-boot.img
rm
-f
new-boot.img
if
[
-f
stock_boot
*
]
;
then
if
[
-f
stock_boot
*
]
;
then
...
...
scripts/magisk_uninstaller.sh
View file @
a46c6252
...
@@ -114,7 +114,7 @@ case $? in
...
@@ -114,7 +114,7 @@ case $? in
# Sign chromeos boot
# Sign chromeos boot
$CHROMEOS
&&
sign_chromeos
$CHROMEOS
&&
sign_chromeos
ui_print
"- Flashing restored boot image"
ui_print
"- Flashing restored boot image"
flash_image new-boot.img
$BOOTIMAGE
flash_image new-boot.img
$BOOTIMAGE
||
abort
"! Insufficient partition size"
fi
fi
;;
;;
2
)
# Other patched
2
)
# Other patched
...
...
scripts/util_functions.sh
View file @
a46c6252
...
@@ -203,11 +203,15 @@ flash_image() {
...
@@ -203,11 +203,15 @@ flash_image() {
COM2
=
"cat -"
COM2
=
"cat -"
fi
fi
if
[
-b
"
$2
"
]
;
then
if
[
-b
"
$2
"
]
;
then
local
s_size
=
`
stat
-c
'%s'
"
$1
"
`
local
t_size
=
`
blockdev
--getsize64
"
$2
"
`
[
$s_size
-gt
$t_size
]
&&
return
1
eval
$COM1
|
eval
$COM2
|
cat
- /dev/zero
>
"
$2
"
2>/dev/null
eval
$COM1
|
eval
$COM2
|
cat
- /dev/zero
>
"
$2
"
2>/dev/null
else
else
ui_print
"- Not block device, storing image"
ui_print
"- Not block device, storing image"
eval
$COM1
|
eval
$COM2
>
"
$2
"
2>/dev/null
eval
$COM1
|
eval
$COM2
>
"
$2
"
2>/dev/null
fi
fi
return
0
}
}
find_dtbo_image
()
{
find_dtbo_image
()
{
...
...
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