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
88d19a4c
Commit
88d19a4c
authored
Mar 18, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Several fixes
parent
af7b9ea8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
32 deletions
+33
-32
resetprop.cpp
jni/resetprop/resetprop.cpp
+2
-2
flash_script.sh
scripts/flash_script.sh
+1
-1
magic_mask.sh
scripts/magic_mask.sh
+30
-29
No files found.
jni/resetprop/resetprop.cpp
View file @
88d19a4c
...
...
@@ -153,13 +153,13 @@ int x_property_set(const char *name, const char *value)
}
int
read_prop_file
(
const
char
*
filename
)
{
printf
(
"
Attempting to read props from
\'
%s
\'\n
"
,
filename
);
printf
(
"Attempting to read props from
\'
%s
\'\n
"
,
filename
);
FILE
*
fp
=
fopen
(
filename
,
"r"
);
if
(
fp
==
NULL
)
{
fprintf
(
stderr
,
"Cannot open
\'
%s
\'\n
"
,
filename
);
return
1
;
}
char
*
line
=
NULL
,
*
pch
,
name
[
PROP_NAME_MAX
],
value
[
PROP_VALUE_MAX
]
;
char
*
line
=
NULL
,
*
pch
;
size_t
len
;
ssize_t
read
;
int
comment
=
0
,
i
;
...
...
scripts/flash_script.sh
View file @
88d19a4c
...
...
@@ -374,7 +374,7 @@ esac
# All ramdisk patch commands are stored in a separate script
ui_print
"- Patching ramdisk"
.
$COMMONDIR
/ramdisk_patch.sh
$BOOTTMP
/ramdisk.cpio
source
$COMMONDIR
/ramdisk_patch.sh
$BOOTTMP
/ramdisk.cpio
cd
$BOOTTMP
# Create ramdisk backups
...
...
scripts/magic_mask.sh
View file @
88d19a4c
...
...
@@ -71,12 +71,14 @@ loopsetup() {
done
}
target
_size_check
()
{
e2fsck
-
p
-f
"
$1
"
image
_size_check
()
{
e2fsck
-
yf
$1
curBlocks
=
`
e2fsck
-n
$1
2>/dev/null |
cut
-d
,
-f3
|
cut
-d
\
-f2
`
;
curUsedM
=
$((
`
echo
"
$curBlocks
"
|
cut
-d
/
-f1
`
*
4
/
1024
))
;
curSizeM
=
$((
`
echo
"
$curBlocks
"
|
cut
-d
/
-f2
`
*
4
/
1024
))
;
curFreeM
=
$((
curSizeM
-
curUsedM
))
;
curUsedM
=
`
echo
"
$curBlocks
"
|
cut
-d
/
-f1
`
curSizeM
=
`
echo
"
$curBlocks
"
|
cut
-d
/
-f1
`
curFreeM
=
$((
(
curSizeM
-
curUsedM
)
*
4
/
1024
))
curUsedM
=
$((
curUsedM
*
4
/
1024
+
1
))
curSizeM
=
$((
curSizeM
*
4
/
1024
))
}
run_scripts
()
{
...
...
@@ -193,11 +195,11 @@ merge_image() {
log_print
"
$IMG
found, attempt to merge"
# Handle large images
target
_size_check
$1
MERGEUSED
=
$curUsedM
target
_size_check
$IMG
if
[
"
$
MERGEUSED
"
-gt
"
$curFreeM
"
]
;
then
NEWDATASIZE
=
$((
(
(
MERGEUSED
+
curUsedM
)
/
32
+
2
)
*
32
))
image
_size_check
$1
mergeUsedM
=
$curUsedM
image
_size_check
$IMG
if
[
"
$
mergeUsedM
"
-gt
"
$curFreeM
"
]
;
then
NEWDATASIZE
=
$((
(
mergeUsedM
+
curUsedM
)
/
32
*
32
+
32
))
log_print
"Expanding
$IMG
to
${
NEWDATASIZE
}
M..."
resize2fs
$IMG
${
NEWDATASIZE
}
M
fi
...
...
@@ -358,8 +360,8 @@ case $1 in
# Unmount, shrink, remount
if
umount
$MOUNTPOINT
;
then
losetup
-d
$LOOPDEVICE
2>/dev/null
target
_size_check
$IMG
NEWDATASIZE
=
$((
(
curUsedM
/
32
+
2
)
*
32
))
image
_size_check
$IMG
NEWDATASIZE
=
$((
curUsedM
/
32
*
32
+
32
))
if
[
"
$curSizeM
"
-gt
"
$NEWDATASIZE
"
]
;
then
log_print
"Shrinking
$IMG
to
${
NEWDATASIZE
}
M..."
resize2fs
$IMG
${
NEWDATASIZE
}
M
...
...
@@ -391,16 +393,23 @@ case $1 in
mount
-o
ro,remount rootfs /
fi
# Travel through all mods
for
MOD
in
$MOUNTPOINT
/
*
;
do
if
[
-f
$MOD
/auto_mount
-a
-d
$MOD
/system
-a
!
-f
$MOD
/disable
]
;
then
log_print
"Analyzing module:
$MOD
"
TRAVEL_ROOT
=
$MOD
(
travel system
)
rm
-f
$MOD
/vendor 2>/dev/null
if
[
-d
$MOD
/system/vendor
]
;
then
ln
-s
$MOD
/system/vendor
$MOD
/vendor
(
travel vendor
)
if
[
!
-f
$MOD
/disable
]
;
then
# Travel through all mods
if
[
-f
$MOD
/auto_mount
-a
-d
$MOD
/system
]
;
then
log_print
"Analyzing module:
$MOD
"
TRAVEL_ROOT
=
$MOD
(
travel system
)
rm
-f
$MOD
/vendor 2>/dev/null
if
[
-d
$MOD
/system/vendor
]
;
then
ln
-s
$MOD
/system/vendor
$MOD
/vendor
(
travel vendor
)
fi
fi
# Read in defined system props
if
[
-f
$MOD
/system.prop
]
;
then
log_print
"* Reading props from
$MOD
/system.prop"
$BINPATH
/resetprop
--file
$MOD
/system.prop
fi
fi
done
...
...
@@ -487,14 +496,6 @@ case $1 in
rm
-f
/data/magisk/magisk.apk 2>/dev/null
fi
for
MOD
in
$MOUNTPOINT
/
*
;
do
# Read in defined system props
if
[
-f
$MOD
/system.prop
]
;
then
log_print
"* Reading props from
$MOD
/system.prop"
/data/magisk/resetprop
--file
$MOD
/system.prop
fi
done
# Expose busybox
[
"
`
getprop persist.magisk.busybox
`
"
=
"1"
]
&&
sh /sbin/magic_mask.sh mount_busybox
...
...
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