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
324a0dd3
Commit
324a0dd3
authored
Mar 19, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update uninstall script
parent
cc77d939
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
101 deletions
+84
-101
build.gradle
app/build.gradle
+4
-4
magisk_uninstaller.sh
app/src/main/assets/magisk_uninstaller.sh
+79
-96
strings.xml
app/src/main/res/values-vi/strings.xml
+1
-1
No files found.
app/build.gradle
View file @
324a0dd3
...
@@ -47,10 +47,10 @@ repositories {
...
@@ -47,10 +47,10 @@ repositories {
dependencies
{
dependencies
{
compile
fileTree
(
include:
[
'*.jar'
],
dir:
'libs'
)
compile
fileTree
(
include:
[
'*.jar'
],
dir:
'libs'
)
compile
'com.android.support:recyclerview-v7:25.
2
.0'
compile
'com.android.support:recyclerview-v7:25.
3
.0'
compile
'com.android.support:cardview-v7:25.
2
.0'
compile
'com.android.support:cardview-v7:25.
3
.0'
compile
'com.android.support:design:25.
2
.0'
compile
'com.android.support:design:25.
3
.0'
compile
'com.android.support:support-v4:25.
2
.0'
compile
'com.android.support:support-v4:25.
3
.0'
compile
'com.jakewharton:butterknife:8.5.1'
compile
'com.jakewharton:butterknife:8.5.1'
compile
'com.github.clans:fab:1.6.4'
compile
'com.github.clans:fab:1.6.4'
compile
'com.thoughtbot:expandablerecyclerview:1.4'
compile
'com.thoughtbot:expandablerecyclerview:1.4'
...
...
app/src/main/assets/magisk_uninstaller.sh
View file @
324a0dd3
#!/system/bin/sh
[
-z
$BOOTMODE
]
&&
BOOTMODE
=
false
[
-z
$BOOTMODE
]
&&
BOOTMODE
=
false
TMPDIR
=
/tmp
(
$BOOTMODE
)
&&
TMPDIR
=
/dev/tmp
BINDIR
=
/data/magisk
# This path should work in any cases
CHROMEDIR
=
$BINDIR
/chromeos
TMPDIR
=
/dev/tmp
NEWBOOT
=
$TMPDIR
/boottmp/new-boot.img
BOOTTMP
=
$TMPDIR
/boottmp
UNPACKDIR
=
$TMPDIR
/boottmp/bootunpac
k
MAGISKBIN
=
/data/magis
k
RAMDISK
=
$TMPDIR
/boottmp/ramdisk
CHROMEDIR
=
$MAGISKBIN
/chromeos
SYSTEMLIB
=
/system/lib
SYSTEMLIB
=
/system/lib
[
-d
/system/lib64
]
&&
SYSTEMLIB
=
/system/lib64
[
-d
/system/lib64
]
&&
SYSTEMLIB
=
/system/lib64
ui_print
()
{
# Default permissions
echo
"
$1
"
umask
022
ui_print_wrapper
()
{
type
ui_print
>
/dev/null
&&
ui_print
"
$1
"
||
echo
"
$1
"
}
}
grep_prop
()
{
grep_prop
()
{
...
@@ -25,7 +24,7 @@ grep_prop() {
...
@@ -25,7 +24,7 @@ grep_prop() {
if
[
-z
"
$FILES
"
]
;
then
if
[
-z
"
$FILES
"
]
;
then
FILES
=
'/system/build.prop'
FILES
=
'/system/build.prop'
fi
fi
cat
$FILES
2>/dev/null |
sed
-n
$REGEX
|
head
-n
1
cat
$FILES
2>/dev/null |
sed
-n
"
$REGEX
"
|
head
-n
1
}
}
find_boot_image
()
{
find_boot_image
()
{
...
@@ -42,109 +41,93 @@ find_boot_image() {
...
@@ -42,109 +41,93 @@ find_boot_image() {
fi
fi
}
}
unpack_boot
()
{
# Environments
rm
-rf
$UNPACKDIR
$RAMDISK
2>/dev/null
mkdir
-p
$UNPACKDIR
mkdir
-p
$RAMDISK
cd
$UNPACKDIR
LD_LIBRARY_PATH
=
$SYSTEMLIB
$BINDIR
/bootimgtools
--extract
$1
cd
$RAMDISK
$BINDIR
/busybox
gunzip
-c
<
$UNPACKDIR
/ramdisk.gz | cpio
-i
}
repack_boot
()
{
cd
$RAMDISK
find
.
| cpio
-o
-H
newc 2>/dev/null |
gzip
-9
>
$UNPACKDIR
/ramdisk.gz
cd
$UNPACKDIR
LD_LIBRARY_PATH
=
$SYSTEMLIB
$BINDIR
/bootimgtools
--repack
$BOOTIMAGE
if
[
-f
chromeos
]
;
then
echo
" "
>
config
echo
" "
>
bootloader
LD_LIBRARY_PATH
=
$SYSTEMLIB
$CHROMEDIR
/futility vbutil_kernel
--pack
new-boot.img.signed
--keyblock
$CHROMEDIR
/kernel.keyblock
--signprivate
$CHROMEDIR
/kernel_data_key.vbprivk
--version
1
--vmlinuz
new-boot.img
--config
config
--arch
arm
--bootloader
bootloader
--flags
0x1
rm
-f
new-boot.img
mv
new-boot.img.signed new-boot.img
fi
if
(
$SAMSUNG
)
;
then
SAMSUNG_CHECK
=
$(
cat
new-boot.img |
grep
SEANDROIDENFORCE
)
if
[
$?
-ne
0
]
;
then
echo
-n
"SEANDROIDENFORCE"
>>
new-boot.img
fi
fi
if
(
$LGE_G
)
;
then
# Prevent secure boot error on LG G2/G3.
# Just for know, It's a pattern which bootloader verifies at boot. Thanks to LG hackers.
echo
-n
-e
"
\x
41
\x
a9
\x
e4
\x
67
\x
74
\x
4d
\x
1d
\x
1b
\x
a4
\x
29
\x
f2
\x
ec
\x
ea
\x
65
\x
52
\x
79"
>>
new-boot.img
fi
mv
new-boot.img
$NEWBOOT
}
# Set permissions
# Set permissions
chmod
-R
755
$CHROMEDIR
/futility
$BINDIR
chmod
-R
755
$CHROMEDIR
/futility
$MAGISKBIN
2>/dev/null
# Temporary busybox for installation
mkdir
-p
$TMPDIR
/busybox
$MAGISKBIN
/busybox
--install
-s
$TMPDIR
/busybox
rm
-f
$TMPDIR
/busybox/su
$TMPDIR
/busybox/sh
$TMPDIR
/busybox/reboot
PATH
=
$TMPDIR
/busybox:
$PATH
# Find the boot image
# Find the boot image
find_boot_image
find_boot_image
if
[
-z
"
$BOOTIMAGE
"
]
;
then
if
[
-z
"
$BOOTIMAGE
"
]
;
then
ui_print
"! Unable to detect boot image"
ui_print
_wrapper
"! Unable to detect boot image"
exit
1
exit
1
fi
fi
ui_print
"- Found Boot Image:
$BOOTIMAGE
"
ui_print_wrapper
"- Found Boot Image:
$BOOTIMAGE
"
rm
-rf
$BOOTTMP
2>/dev/null
mkdir
-p
$BOOTTMP
cd
$BOOTTMP
# Detect special vendors
ui_print_wrapper
"- Unpacking boot image"
SAMSUNG
=
false
LD_LIBRARY_PATH
=
$SYSTEMLIB
$MAGISKBIN
/magiskboot
--unpack
$BOOTIMAGE
SAMSUNG_CHECK
=
$(
cat
/system/build.prop |
grep
"ro.build.fingerprint="
|
grep
-i
"samsung"
)
if
[
$?
-ne
0
]
;
then
if
[
$?
-eq
0
]
;
then
ui_print_wrapper
"! Unable to unpack boot image"
SAMSUNG
=
true
exit
1
fi
fi
LGE_G
=
false
RBRAND
=
$(
grep_prop ro.product.brand
)
# Update our previous backup to new format if exists
RMODEL
=
$(
grep_prop ro.product.device
)
if
[
-f
/data/stock_boot.img
]
;
then
if
[
"
$RBRAND
"
=
"lge"
]
||
[
"
$RBRAND
"
=
"LGE"
]
;
then
SHA1
=
`
LD_LIBRARY_PATH
=
$SYSTEMLIB
$MAGISKBIN
/magiskboot
--sha1
/data/stock_boot.img |
tail
-n
1
`
if
[
"
$RMODEL
"
=
"*D80*"
]
||
STOCKDUMP
=
/data/stock_boot_
${
SHA1
}
.img
[
"
$RMODEL
"
=
"*S98*"
]
||
mv
/data/stock_boot.img
$STOCKDUMP
[
"
$RMODEL
"
=
"*D85*"
]
||
LD_LIBRARY_PATH
=
$SYSTEMLIB
$MAGISKBIN
/magiskboot
--compress
$STOCKDUMP
[
"
$RMODEL
"
=
"*F40*"
]
;
then
LGE_G
=
true
ui_print
"! Bump device detected"
fi
fi
fi
# First unpack the boot image
# Detect boot image state
unpack_boot
$BOOTIMAGE
LD_LIBRARY_PATH
=
$SYSTEMLIB
$MAGISKBIN
/magiskboot
--cpio-test
ramdisk.cpio
case
$?
in
SUPERSU
=
false
0
)
[
-f
sbin/launch_daemonsu.sh
]
&&
SUPERSU
=
true
ui_print_wrapper
"! Magisk is not installed!"
ui_print_wrapper
"! Nothing to uninstall"
if
(
$SUPERSU
)
;
then
exit
ui_print
"- SuperSU patched image detected"
;;
rm
-f
magisk sbin/init.magisk.rc sbin/magic_mask.sh
1
)
repack_boot
# Find SHA1 of stock boot image
else
if
[
-z
$SHA1
]
;
then
if
[
-f
/data/stock_boot.img
]
;
then
LD_LIBRARY_PATH
=
$SYSTEMLIB
$MAGISKBIN
/magiskboot
--cpio-extract
ramdisk.cpio init.magisk.rc init.magisk.rc
ui_print
"- Boot image backup found!"
SHA1
=
`
grep_prop
"# STOCKSHA1"
init.magisk.rc
`
NEWBOOT
=
/data/stock_boot.img
[
!
-z
$SHA1
]
&&
STOCKDUMP
=
/data/stock_boot_
${
SHA1
}
.img
else
rm
-f
init.magisk.rc
ui_print
"! Boot image backup unavailable"
if
[
-d
".backup"
]
;
then
ui_print
"- Restoring ramdisk with backup"
cp
-af
.backup/.
.
fi
fi
rm
-f
magisk sbin/init.magisk.rc sbin/magic_mask.sh
if
[
-f
${
STOCKDUMP
}
.gz
]
;
then
repack_boot
ui_print_wrapper
"- Boot image backup found!"
fi
LD_LIBRARY_PATH
=
$SYSTEMLIB
$MAGISKBIN
/magiskboot
--decompress
${
STOCKDUMP
}
.gz stock_boot.img
else
ui_print_wrapper
"! Boot image backup unavailable"
ui_print_wrapper
"- Restoring ramdisk with backup"
LD_LIBRARY_PATH
=
$SYSTEMLIB
$MAGISKBIN
/magiskboot
--cpio-restore
ramdisk.cpio
LD_LIBRARY_PATH
=
$SYSTEMLIB
$MAGISKBIN
/magiskboot
--repack
$BOOTIMAGE
stock_boot.img
fi
;;
2
)
ui_print_wrapper
"- SuperSU patched image detected"
LD_LIBRARY_PATH
=
$SYSTEMLIB
$MAGISKBIN
/magiskboot
--cpio-restore
ramdisk.cpio
LD_LIBRARY_PATH
=
$SYSTEMLIB
$MAGISKBIN
/magiskboot
--repack
$BOOTIMAGE
stock_boot.img
;;
esac
# Sign chromeos boot
if
[
-f
chromeos
]
;
then
echo
>
config
echo
>
bootloader
LD_LIBRARY_PATH
=
$SYSTEMLIB
$CHROMEDIR
/futility vbutil_kernel
--pack
stock_boot.img.signed
--keyblock
$CHROMEDIR
/kernel.keyblock
--signprivate
$CHROMEDIR
/kernel_data_key.vbprivk
--version
1
--vmlinuz
stock_boot.img
--config
config
--arch
arm
--bootloader
bootloader
--flags
0x1
rm
-f
stock_boot.img
mv
stock_boot.img.signed stock_boot.img
fi
fi
chmod
644
$NEWBOOT
ui_print_wrapper
"- Flashing stock/reverted image"
ui_print
"- Flashing stock/reverted image"
[
!
-L
"
$BOOTIMAGE
"
]
&&
dd
if
=
/dev/zero
of
=
$BOOTIMAGE
bs
=
4096 2>/dev/null
[
!
-L
"
$BOOTIMAGE
"
]
&&
dd
if
=
/dev/zero
of
=
$BOOTIMAGE
bs
=
4096 2>/dev/null
dd
if
=
$NEWBOOT
of
=
$BOOTIMAGE
bs
=
4096
dd
if
=
stock_boot.img
of
=
$BOOTIMAGE
bs
=
4096
ui_print
"- Removing Magisk files"
ui_print
_wrapper
"- Removing Magisk files"
rm
-rf
/cache/magisk.log /cache/last_magisk.log /cache/magiskhide.log /cache/.disable_magisk
\
rm
-rf
/cache/magisk.log /cache/last_magisk.log /cache/magiskhide.log /cache/.disable_magisk
\
/cache/magisk /cache/magisk_merge /cache/magisk_mount /cache/unblock /cache/magisk_uninstaller.sh
\
/cache/magisk /cache/magisk_merge /cache/magisk_mount /cache/unblock /cache/magisk_uninstaller.sh
\
/data/Magisk.apk /data/magisk.apk /data/magisk.img /data/magisk_merge.img
\
/data/Magisk.apk /data/magisk.apk /data/magisk.img /data/magisk_merge.img
\
/data/busybox /data/magisk /data/custom_ramdisk_patch.sh 2>/dev/null
/data/busybox /data/magisk /data/custom_ramdisk_patch.sh 2>/dev/null
(
$BOOTMODE
)
&&
reboot
$BOOTMODE
&&
reboot
app/src/main/res/values-vi/strings.xml
View file @
324a0dd3
...
@@ -196,5 +196,5 @@
...
@@ -196,5 +196,5 @@
<string
name=
"pid"
>
PID:\u0020
</string>
<string
name=
"pid"
>
PID:\u0020
</string>
<string
name=
"target_uid"
>
Target UID:\u0020
</string>
<string
name=
"target_uid"
>
Target UID:\u0020
</string>
<string
name=
"command"
>
Command:\u0020
</string>
<string
name=
"command"
>
Command:\u0020
</string>
</resources>
</resources>
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