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
e5c31830
Commit
e5c31830
authored
Jan 01, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update scripts
parent
930c8231
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
36 deletions
+31
-36
app
app
+1
-1
daemon.c
core/jni/core/daemon.c
+0
-5
addon.d.sh
scripts/addon.d.sh
+0
-10
boot_patch.sh
scripts/boot_patch.sh
+0
-2
flash_script.sh
scripts/flash_script.sh
+2
-8
magisk_uninstaller.sh
scripts/magisk_uninstaller.sh
+1
-5
util_functions.sh
scripts/util_functions.sh
+27
-5
No files found.
app
@
836d9afe
Subproject commit
1adf331268476405f22725518335ef49f6999fd9
Subproject commit
836d9afe1756070971731198d39e69c78cf3b527
core/jni/core/daemon.c
View file @
e5c31830
...
@@ -129,11 +129,6 @@ void daemon_init() {
...
@@ -129,11 +129,6 @@ void daemon_init() {
unlink
(
"/data/magisk_debug.log"
);
unlink
(
"/data/magisk_debug.log"
);
chmod
(
"/data/adb"
,
0700
);
chmod
(
"/data/adb"
,
0700
);
// Use shell glob to match files
exec_command_sync
(
"sh"
,
"-c"
,
"mv -f /data/adb/magisk/stock_*.img.gz /data;"
"rm -f /data/user*/*/magisk.db;"
,
NULL
);
LOGI
(
"* Creating /sbin overlay"
);
LOGI
(
"* Creating /sbin overlay"
);
DIR
*
dir
;
DIR
*
dir
;
struct
dirent
*
entry
;
struct
dirent
*
entry
;
...
...
scripts/addon.d.sh
View file @
e5c31830
...
@@ -13,8 +13,6 @@
...
@@ -13,8 +13,6 @@
main
()
{
main
()
{
# Magisk binaries
# Magisk binaries
MAGISKBIN
=
/data/adb/magisk
MAGISKBIN
=
/data/adb/magisk
# This script always runs in recovery
BOOTMODE
=
false
mount /data 2>/dev/null
mount /data 2>/dev/null
...
@@ -41,7 +39,6 @@ main() {
...
@@ -41,7 +39,6 @@ main() {
remove_system_su
remove_system_su
find_boot_image
[
-z
$BOOTIMAGE
]
&&
abort
"! Unable to detect boot image"
[
-z
$BOOTIMAGE
]
&&
abort
"! Unable to detect boot image"
ui_print
"- Found boot image:
$BOOTIMAGE
"
ui_print
"- Found boot image:
$BOOTIMAGE
"
...
@@ -59,13 +56,6 @@ main() {
...
@@ -59,13 +56,6 @@ main() {
mv
stock_boot
*
/data
mv
stock_boot
*
/data
fi
fi
patch_dtbo_image
if
[
-f
stock_dtbo
*
]
;
then
rm
-f
/data/stock_dtbo
*
2>/dev/null
mv
stock_dtbo
*
/data
fi
cd
/
cd
/
recovery_cleanup
recovery_cleanup
...
...
scripts/boot_patch.sh
View file @
e5c31830
...
@@ -83,8 +83,6 @@ chmod -R 755 .
...
@@ -83,8 +83,6 @@ chmod -R 755 .
# Unpack
# Unpack
##########################################################################################
##########################################################################################
migrate_boot_backup
CHROMEOS
=
false
CHROMEOS
=
false
ui_print
"- Unpacking boot image"
ui_print
"- Unpacking boot image"
...
...
scripts/flash_script.sh
View file @
e5c31830
...
@@ -13,10 +13,6 @@
...
@@ -13,10 +13,6 @@
# Preparation
# Preparation
##########################################################################################
##########################################################################################
# Detect whether in boot mode
ps |
grep
zygote |
grep
-v
grep
>
/dev/null
&&
BOOTMODE
=
true
||
BOOTMODE
=
false
$BOOTMODE
||
ps
-A
2>/dev/null |
grep
zygote |
grep
-v
grep
>
/dev/null
&&
BOOTMODE
=
true
# This path should work in any cases
# This path should work in any cases
TMPDIR
=
/dev/tmp
TMPDIR
=
/dev/tmp
...
@@ -24,7 +20,6 @@ INSTALLER=$TMPDIR/install
...
@@ -24,7 +20,6 @@ INSTALLER=$TMPDIR/install
COMMONDIR
=
$INSTALLER
/common
COMMONDIR
=
$INSTALLER
/common
APK
=
$COMMONDIR
/magisk.apk
APK
=
$COMMONDIR
/magisk.apk
CHROMEDIR
=
$INSTALLER
/chromeos
CHROMEDIR
=
$INSTALLER
/chromeos
COREDIR
=
/magisk/.core
# Default permissions
# Default permissions
umask
022
umask
022
...
@@ -83,8 +78,8 @@ if is_mounted /data; then
...
@@ -83,8 +78,8 @@ if is_mounted /data; then
chmod
700 /data/adb 2>/dev/null
chmod
700 /data/adb 2>/dev/null
# Some legacy migration
# Some legacy migration
mv
/data/magisk/stock_boot
*
/data 2>/dev/null
run_migrations
[
-L
/data/magisk.img
]
||
mv
/data/magisk.img /data/adb/magisk.img
[
-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
...
@@ -113,7 +108,6 @@ $BOOTMODE || recovery_actions
...
@@ -113,7 +108,6 @@ $BOOTMODE || recovery_actions
[
-z
$BOOTIMAGE
]
&&
abort
"! Unable to detect boot image"
[
-z
$BOOTIMAGE
]
&&
abort
"! Unable to detect boot image"
ui_print
"- Found boot image:
$BOOTIMAGE
"
ui_print
"- Found boot image:
$BOOTIMAGE
"
find_dtbo_image
if
[
!
-z
$DTBOIMAGE
]
;
then
if
[
!
-z
$DTBOIMAGE
]
;
then
ui_print
"- Found dtbo image:
$DTBOIMAGE
"
ui_print
"- Found dtbo image:
$DTBOIMAGE
"
# Disable dtbo patch by default
# Disable dtbo patch by default
...
...
scripts/magisk_uninstaller.sh
View file @
e5c31830
...
@@ -34,20 +34,16 @@ fi
...
@@ -34,20 +34,16 @@ fi
if
$BOOTMODE
;
then
if
$BOOTMODE
;
then
# Load utility functions
# Load utility functions
.
$MAGISKBIN
/util_functions.sh
.
$MAGISKBIN
/util_functions.sh
BOOTMODE
=
true
boot_actions
boot_actions
mount_partitions
mount_partitions
fi
fi
cd
$MAGISKBIN
cd
$MAGISKBIN
# Find the boot image
find_boot_image
[
-z
$BOOTIMAGE
]
&&
abort
"! Unable to detect boot image"
[
-z
$BOOTIMAGE
]
&&
abort
"! Unable to detect boot image"
ui_print
"- Found Boot Image:
$BOOTIMAGE
"
ui_print
"- Found Boot Image:
$BOOTIMAGE
"
migrate_boot_backup
ui_print
"- Unpacking boot image"
ui_print
"- Unpacking boot image"
./magiskboot
--unpack
"
$BOOTIMAGE
"
./magiskboot
--unpack
"
$BOOTIMAGE
"
CHROMEOS
=
false
CHROMEOS
=
false
...
...
scripts/util_functions.sh
View file @
e5c31830
...
@@ -10,6 +10,11 @@
...
@@ -10,6 +10,11 @@
#MAGISK_VERSION_STUB
#MAGISK_VERSION_STUB
SCRIPT_VERSION
=
$MAGISK_VER_CODE
SCRIPT_VERSION
=
$MAGISK_VER_CODE
# Detect whether in boot mode
ps |
grep
zygote |
grep
-v
grep
>
/dev/null
&&
BOOTMODE
=
true
||
BOOTMODE
=
false
$BOOTMODE
||
ps
-A
2>/dev/null |
grep
zygote |
grep
-v
grep
>
/dev/null
&&
BOOTMODE
=
true
$BOOTMODE
||
id
|
grep
-q
'uid=0'
||
BOOTMODE
=
true
# Default location, will override if needed
# Default location, will override if needed
MAGISKBIN
=
/data/adb/magisk
MAGISKBIN
=
/data/adb/magisk
[
-z
$MOUNTPATH
]
&&
MOUNTPATH
=
/sbin/.core/img
[
-z
$MOUNTPATH
]
&&
MOUNTPATH
=
/sbin/.core/img
...
@@ -47,7 +52,12 @@ mount_partitions() {
...
@@ -47,7 +52,12 @@ mount_partitions() {
SLOT
=
_
`
getprop ro.boot.slot
`
SLOT
=
_
`
getprop ro.boot.slot
`
[
$SLOT
=
"_"
]
&&
SLOT
=
[
$SLOT
=
"_"
]
&&
SLOT
=
fi
fi
# Check the boot image to make sure the slot actually make sense
find_boot_image
find_dtbo_image
[
-z
$SLOT
]
||
ui_print
"- A/B partition detected, current slot:
$SLOT
"
[
-z
$SLOT
]
||
ui_print
"- A/B partition detected, current slot:
$SLOT
"
ui_print
"- Mounting /system, /vendor"
ui_print
"- Mounting /system, /vendor"
is_mounted /system
||
[
-f
/system/build.prop
]
||
mount
-o
ro /system 2>/dev/null
is_mounted /system
||
[
-f
/system/build.prop
]
||
mount
-o
ro /system 2>/dev/null
if
!
is_mounted /system
&&
!
[
-f
/system/build.prop
]
;
then
if
!
is_mounted /system
&&
!
[
-f
/system/build.prop
]
;
then
...
@@ -105,7 +115,10 @@ find_boot_image() {
...
@@ -105,7 +115,10 @@ find_boot_image() {
BOOTIMAGE
=
BOOTIMAGE
=
if
[
!
-z
$SLOT
]
;
then
if
[
!
-z
$SLOT
]
;
then
BOOTIMAGE
=
`
find /dev/block
-iname
boot
$SLOT
|
head
-n
1
`
2>/dev/null
BOOTIMAGE
=
`
find /dev/block
-iname
boot
$SLOT
|
head
-n
1
`
2>/dev/null
else
fi
if
[
-z
"
$BOOTIMAGE
"
]
;
then
# The slot info is incorrect...
SLOT
=
for
BLOCK
in
boot_a kern-a android_boot kernel boot lnx bootimg
;
do
for
BLOCK
in
boot_a kern-a android_boot kernel boot lnx bootimg
;
do
BOOTIMAGE
=
`
find /dev/block
-iname
$BLOCK
|
head
-n
1
`
2>/dev/null
BOOTIMAGE
=
`
find /dev/block
-iname
$BLOCK
|
head
-n
1
`
2>/dev/null
[
!
-z
$BOOTIMAGE
]
&&
break
[
!
-z
$BOOTIMAGE
]
&&
break
...
@@ -118,10 +131,10 @@ find_boot_image() {
...
@@ -118,10 +131,10 @@ find_boot_image() {
[
!
-z
$BOOTIMAGE
]
&&
break
[
!
-z
$BOOTIMAGE
]
&&
break
done
done
fi
fi
BOOTIMAGE
=
`
resolve_link
$BOOTIMAGE
`
[
!
-z
"
$BOOTIMAGE
"
]
&&
BOOTIMAGE
=
`
resolve_link
$BOOTIMAGE
`
}
}
migrate_boot_backup
()
{
run_migrations
()
{
# Update the broken boot backup
# Update the broken boot backup
if
[
-f
/data/stock_boot_.img.gz
]
;
then
if
[
-f
/data/stock_boot_.img.gz
]
;
then
$MAGISKBIN
/magiskboot
--decompress
/data/stock_boot_.img.gz /data/stock_boot.img
$MAGISKBIN
/magiskboot
--decompress
/data/stock_boot_.img.gz /data/stock_boot.img
...
@@ -134,8 +147,17 @@ migrate_boot_backup() {
...
@@ -134,8 +147,17 @@ migrate_boot_backup() {
mv
/data/stock_boot.img
$STOCKDUMP
mv
/data/stock_boot.img
$STOCKDUMP
$MAGISKBIN
/magiskboot
--compress
$STOCKDUMP
$MAGISKBIN
/magiskboot
--compress
$STOCKDUMP
fi
fi
mv
/data/magisk/stock_boot
*
/data 2>/dev/null
# Move the stock backups
mv
/data/magisk/adb/stock_boot
*
/data 2>/dev/null
if
[
-f
/data/magisk/stock_boot
*
]
;
then
rm
-rf
/data/stock_boot
*
mv
/data/magisk/stock_boot
*
/data 2>/dev/null
fi
if
[
-f
/data/adb/magisk/stock_boot
*
]
;
then
rm
-rf
/data/stock_boot
*
mv
/data/adb/magisk/stock_boot
*
/data 2>/dev/null
fi
# Remove old dbs
rm
-f
/data/user
*
/
*
/magisk.db
}
}
flash_boot_image
()
{
flash_boot_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