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
30c04872
Commit
30c04872
authored
Nov 14, 2016
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update installer
parent
85dc669d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
35 deletions
+27
-35
update-binary
uninstaller/META-INF/com/google/android/update-binary
+27
-35
No files found.
uninstaller/META-INF/com/google/android/update-binary
View file @
30c04872
...
@@ -10,6 +10,9 @@
...
@@ -10,6 +10,9 @@
INSTALLER
=
/tmp/uninstall
INSTALLER
=
/tmp/uninstall
# Default permissions
umask
022
##########################################################################################
##########################################################################################
# Flashable update-binary preparation
# Flashable update-binary preparation
##########################################################################################
##########################################################################################
...
@@ -63,14 +66,14 @@ getvar() {
...
@@ -63,14 +66,14 @@ getvar() {
find_boot_image
()
{
find_boot_image
()
{
if
[
-z
"
$BOOTIMAGE
"
]
;
then
if
[
-z
"
$BOOTIMAGE
"
]
;
then
for
PARTITION
in
kern-a KERN-A android_boot ANDROID_BOOT kernel KERNEL boot BOOT lnx LNX
;
do
for
PARTITION
in
kern-a KERN-A android_boot ANDROID_BOOT kernel KERNEL boot BOOT lnx LNX
;
do
BOOTIMAGE
=
$(
readlink
/dev/block/by-name/
$PARTITION
||
readlink
/dev/block/platform/
*
/by-name/
$PARTITION
||
readlink
/dev/block/platform/
*
/
*
/by-name/
$PARTITION
)
BOOTIMAGE
=
`
readlink
/dev/block/by-name/
$PARTITION
||
readlink
/dev/block/platform/
*
/by-name/
$PARTITION
||
readlink
/dev/block/platform/
*
/
*
/by-name/
$PARTITION
`
if
[
!
-z
"
$BOOTIMAGE
"
]
;
then
break
;
fi
if
[
!
-z
"
$BOOTIMAGE
"
]
;
then
break
;
fi
done
done
fi
fi
if
[
-z
"
$BOOTIMAGE
"
]
;
then
if
[
-z
"
$BOOTIMAGE
"
]
;
then
FSTAB
=
"/etc/recovery.fstab"
FSTAB
=
"/etc/recovery.fstab"
[
!
-f
"
$FSTAB
"
]
&&
FSTAB
=
"/etc/recovery.fstab.bak"
[
!
-f
"
$FSTAB
"
]
&&
FSTAB
=
"/etc/recovery.fstab.bak"
BOOTIMAGE
=
$(
grep
-E
'\b/boot\b'
"
$FSTAB
"
|
grep
-oE
'/dev/[a-zA-Z0-9_./-]*'
)
[
-f
"
$FSTAB
"
]
BOOTIMAGE
=
`
grep
-E
'\b/boot\b'
"
$FSTAB
"
|
grep
-oE
'/dev/[a-zA-Z0-9_./-]*'
`
fi
fi
}
}
...
@@ -100,11 +103,6 @@ unpack_boot() {
...
@@ -100,11 +103,6 @@ unpack_boot() {
cd
$UNPACKDIR
cd
$UNPACKDIR
$BINDIR
/bootimgtools
--extract
$1
$BINDIR
/bootimgtools
--extract
$1
find
$TMPDIR
/boottmp
-type
d
-exec
chmod
755
{}
\;
find
$TMPDIR
/boottmp
-type
f
-exec
chmod
644
{}
\;
chmod
755
$(
find
$TMPDIR
/boottmp
-type
d
)
chmod
644
$(
find
$TMPDIR
/boottmp
-type
f
)
cd
$RAMDISK
cd
$RAMDISK
gunzip
-c
<
$UNPACKDIR
/ramdisk.gz | cpio
-i
gunzip
-c
<
$UNPACKDIR
/ramdisk.gz | cpio
-i
}
}
...
@@ -135,22 +133,18 @@ revert_boot() {
...
@@ -135,22 +133,18 @@ revert_boot() {
mkdir
-p
$TMPDIR
/boottmp
mkdir
-p
$TMPDIR
/boottmp
CHROMEDIR
=
$INSTALLER
/chromeos
CHROMEDIR
=
$INSTALLER
/chromeos
ORIGBOOT
=
$TMPDIR
/boottmp/boot.img
NEWBOOT
=
$TMPDIR
/boottmp/new-boot.img
NEWBOOT
=
$TMPDIR
/boottmp/new-boot.img
UNPACKDIR
=
$TMPDIR
/boottmp/bootunpack
UNPACKDIR
=
$TMPDIR
/boottmp/bootunpack
RAMDISK
=
$TMPDIR
/boottmp/ramdisk
RAMDISK
=
$TMPDIR
/boottmp/ramdisk
chmod
777
$CHROMEDIR
/futility
$BINDIR
/
*
ORIGBOOT
=
$BOOTIMAGE
ui_print
"- Dumping boot image"
dd
if
=
$BOOTIMAGE
of
=
$ORIGBOOT
ui_print
"- Unpacking boot image"
ui_print
"- Unpacking boot image"
unpack_boot
$ORIGBOOT
unpack_boot
$ORIGBOOT
if
[
-d
".backup"
]
;
then
if
[
-d
".backup"
]
;
then
ui_print
"- Restoring ramdisk with backup"
ui_print
"- Restoring ramdisk with backup"
cp
-af
.backup/
*
.
cp
-af
.backup/
.
.
rm
-rf
magisk init.magisk.rc sbin/magic_mask.sh 2>/dev/null
rm
-rf
magisk init.magisk.rc sbin/magic_mask.sh 2>/dev/null
rm
-rf
.backup
rm
-rf
.backup
else
else
...
@@ -188,24 +182,28 @@ if [ ! -f '/system/build.prop' ]; then
...
@@ -188,24 +182,28 @@ if [ ! -f '/system/build.prop' ]; then
exit
1
exit
1
fi
fi
SAMSUNG
=
false
SAMSUNG_CHECK
=
$(
cat
/system/build.prop |
grep
"ro.build.fingerprint="
|
grep
-i
"samsung"
)
if
[
$?
-eq
0
]
;
then
SAMSUNG
=
true
fi
API
=
$(
grep_prop ro.build.version.sdk
)
API
=
$(
grep_prop ro.build.version.sdk
)
ABI
=
$(
grep_prop ro.product.cpu.abi |
cut
-c-3
)
ABI
=
$(
grep_prop ro.product.cpu.abi |
cut
-c-3
)
ABI2
=
$(
grep_prop ro.product.cpu.abi2 |
cut
-c-3
)
ABI2
=
$(
grep_prop ro.product.cpu.abi2 |
cut
-c-3
)
ABILONG
=
$(
grep_prop ro.product.cpu.abi
)
ABILONG
=
$(
grep_prop ro.product.cpu.abi
)
ARCH
=
arm
ARCH
=
arm
IS64BIT
=
IS64BIT
=
false
if
[
"
$ABI
"
=
"x86"
]
;
then
ARCH
=
x86
;
fi
;
if
[
"
$ABI
"
=
"x86"
]
;
then
ARCH
=
x86
;
fi
;
if
[
"
$ABI2
"
=
"x86"
]
;
then
ARCH
=
x86
;
fi
;
if
[
"
$ABI2
"
=
"x86"
]
;
then
ARCH
=
x86
;
fi
;
if
[
"
$ABILONG
"
=
"arm64-v8a"
]
;
then
ARCH
=
arm64
;
IS64BIT
=
1
;
fi
;
if
[
"
$ABILONG
"
=
"arm64-v8a"
]
;
then
ARCH
=
arm64
;
IS64BIT
=
true
;
fi
;
if
[
"
$ABILONG
"
=
"x86_64"
]
;
then
ARCH
=
x64
;
IS64BIT
=
1
;
fi
;
if
[
"
$ABILONG
"
=
"x86_64"
]
;
then
ARCH
=
x64
;
IS64BIT
=
true
;
fi
;
ui_print
"- Device platform:
$ARCH
"
ui_print
"- Device platform:
$ARCH
"
BINDIR
=
$INSTALLER
/arm
BINDIR
=
$INSTALLER
/
$ARCH
if
[
"
$ARCH
"
=
"x86"
-o
"
$ARCH
"
=
"x64"
]
;
then
chmod
-R
755
$CHROMEDIR
/futility
$BINDIR
BINDIR
=
$INSTALLER
/x86
fi
find_boot_image
find_boot_image
if
[
-z
"
$BOOTIMAGE
"
]
;
then
if
[
-z
"
$BOOTIMAGE
"
]
;
then
...
@@ -213,18 +211,10 @@ if [ -z "$BOOTIMAGE" ]; then
...
@@ -213,18 +211,10 @@ if [ -z "$BOOTIMAGE" ]; then
exit
1
exit
1
fi
fi
SAMSUNG
=
false
SAMSUNG_CHECK
=
$(
cat
/system/build.prop |
grep
"ro.build.fingerprint="
|
grep
-i
"samsung"
)
if
[
$?
-eq
0
]
;
then
SAMSUNG
=
true
fi
##########################################################################################
##########################################################################################
# Detection all done, start installing
# Detection all done, start installing
##########################################################################################
##########################################################################################
umount /magisk 2>/dev/null
if
(
is_mounted /data
)
;
then
if
(
is_mounted /data
)
;
then
cp
-af
/data/stock_boot_
*
.gz /data/stock_boot.img.gz 2>/dev/null
cp
-af
/data/stock_boot_
*
.gz /data/stock_boot.img.gz 2>/dev/null
gzip
-d
/data/stock_boot.img.gz 2>/dev/null
gzip
-d
/data/stock_boot.img.gz 2>/dev/null
...
@@ -237,26 +227,28 @@ if (is_mounted /data); then
...
@@ -237,26 +227,28 @@ if (is_mounted /data); then
revert_boot
revert_boot
fi
fi
ui_print
"- Removing Magisk files"
ui_print
"- Removing Magisk files"
rm
-rf
/cache/magisk /cache/magisk_merge /cache/magisk.log /cache/last_magisk.log /cache/unblock /data/Magisk.apk /data/magisk.img /data/magisk_merge.img /data/busybox /data/magisk /data/custom_ramdisk_patch.sh 2>/dev/null
rm
-rf
/cache/magisk.log /cache/last_magisk.log /cache/magiskhide.log
\
/cache/magisk /cache/magisk_merge /cache/magisk_mount /cache/unblock
\
/data/Magisk.apk /data/magisk.img /data/magisk_merge.img
\
/data/busybox /data/magisk /data/custom_ramdisk_patch.sh 2>/dev/null
else
else
ui_print
"! Data unavalible"
ui_print
"! Data unavalible"
ui_print
"! Impossible to restore original boot image"
ui_print
"! Impossible to restore original boot image"
ui_print
"! Try using ramdisk backup"
ui_print
"! Try using ramdisk backup"
revert_boot
revert_boot
ui_print
"- Removing Magisk files"
ui_print
"- Removing Magisk files"
rm
-rf
/cache/magisk
*
/cache/last_magisk.log /cache/unblock 2>/dev/null
rm
-rf
/cache/magisk.log /cache/last_magisk.log /cache/magiskhide.log
\
/cache/magisk /cache/magisk_merge /cache/magisk_mount /cache/unblock 2>/dev/null
ui_print
"*****************************************"
ui_print
"*****************************************"
ui_print
" Magisk is not fully removed yet "
ui_print
" Magisk is not fully removed yet "
ui_print
" Please manually remove /data/magisk.img "
ui_print
" Please manually remove /data/magisk.img "
ui_print
"*****************************************"
ui_print
"*****************************************"
fi
fi
if
[
-L
"
$BOOTIMAGE
"
]
;
then
chmod
644
$NEWBOOT
ui_print
"- Block symlink detected!"
else
dd
if
=
/dev/zero
of
=
$BOOTIMAGE
bs
=
4096 2>/dev/null
fi
ui_print
"- Flashing reverted image"
ui_print
"- Flashing reverted image"
[
!
-L
"
$BOOTIMAGE
"
]
&&
dd
if
=
/dev/zero
of
=
$BOOTIMAGE
bs
=
4096 2>/dev/null
dd
if
=
$NEWBOOT
of
=
$BOOTIMAGE
bs
=
4096
dd
if
=
$NEWBOOT
of
=
$BOOTIMAGE
bs
=
4096
umount /system
umount /system
...
...
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