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
aa309087
Commit
aa309087
authored
Oct 29, 2016
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update flash script
parent
57bdd9d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
60 deletions
+56
-60
update-binary
zip_static/META-INF/com/google/android/update-binary
+56
-60
No files found.
zip_static/META-INF/com/google/android/update-binary
View file @
aa309087
...
@@ -62,7 +62,7 @@ ui_print() {
...
@@ -62,7 +62,7 @@ ui_print() {
getvar
()
{
getvar
()
{
local
VARNAME
=
$1
local
VARNAME
=
$1
local
VALUE
=
$(
eval echo
\$
"
$VARNAME
"
)
;
local
VALUE
=
$(
eval echo
\$
"
$VARNAME
"
)
;
for
FILE
in
/data/.magisk /cache/.magisk /system/.magisk
;
do
for
FILE
in
/d
ev/.magisk /d
ata/.magisk /cache/.magisk /system/.magisk
;
do
if
[
-z
"
$VALUE
"
]
;
then
if
[
-z
"
$VALUE
"
]
;
then
LINE
=
$(
cat
$FILE
2>/dev/null |
grep
"
$VARNAME
="
)
LINE
=
$(
cat
$FILE
2>/dev/null |
grep
"
$VARNAME
="
)
if
[
!
-z
"
$LINE
"
]
;
then
if
[
!
-z
"
$LINE
"
]
;
then
...
@@ -203,42 +203,12 @@ if [ ! -f '/system/build.prop' ]; then
...
@@ -203,42 +203,12 @@ if [ ! -f '/system/build.prop' ]; then
exit
1
exit
1
fi
fi
API
=
$(
grep_prop ro.build.version.sdk
)
ABI
=
$(
grep_prop ro.product.cpu.abi |
cut
-c-3
)
ABI2
=
$(
grep_prop ro.product.cpu.abi2 |
cut
-c-3
)
ABILONG
=
$(
grep_prop ro.product.cpu.abi
)
ARCH
=
arm
IS64BIT
=
false
if
[
"
$ABI
"
=
"x86"
]
;
then
ARCH
=
x86
;
fi
;
if
[
"
$ABI2
"
=
"x86"
]
;
then
ARCH
=
x86
;
fi
;
if
[
"
$ABILONG
"
=
"arm64-v8a"
]
;
then
ARCH
=
arm64
;
IS64BIT
=
true
;
fi
;
if
[
"
$ABILONG
"
=
"x86_64"
]
;
then
ARCH
=
x64
;
IS64BIT
=
true
;
fi
;
if
[
"
$API
"
-lt
"21"
]
;
then
ui_print
"! Magisk is only for Lollipop 5.0+ (SDK 21+)"
exit
1
fi
ui_print
"- Device platform:
$ARCH
"
BINDIR
=
$INSTALLER
/arm
if
[
"
$ARCH
"
=
"x86"
-o
"
$ARCH
"
=
"x64"
]
;
then
BINDIR
=
$INSTALLER
/x86
fi
find_boot_image
if
[
-z
"
$BOOTIMAGE
"
]
;
then
ui_print
"! Unable to detect boot image"
exit
1
fi
if
[
-z
"
$NOOVERRIDE
"
]
;
then
if
[
-z
"
$NOOVERRIDE
"
]
;
then
# read override variables
# read override variables
getvar KEEPVERITY
getvar KEEPVERITY
getvar KEEPFORCEENCRYPT
getvar KEEPFORCEENCRYPT
getvar NORESTORE
getvar NORESTORE
getvar BOOTIMAGE
fi
fi
if
[
-z
"
$KEEPVERITY
"
]
;
then
if
[
-z
"
$KEEPVERITY
"
]
;
then
...
@@ -260,27 +230,32 @@ if [ $? -eq 0 ]; then
...
@@ -260,27 +230,32 @@ if [ $? -eq 0 ]; then
SAMSUNG
=
true
SAMSUNG
=
true
fi
fi
##########################################################################################
API
=
$(
grep_prop ro.build.version.sdk
)
# Environment
ABI
=
$(
grep_prop ro.product.cpu.abi |
cut
-c-3
)
##########################################################################################
ABI2
=
$(
grep_prop ro.product.cpu.abi2 |
cut
-c-3
)
ABILONG
=
$(
grep_prop ro.product.cpu.abi
)
ui_print
"- Constructing environment"
ARCH
=
arm
IS64BIT
=
false
if
[
"
$ABI
"
=
"x86"
]
;
then
ARCH
=
x86
;
fi
;
if
[
"
$ABI2
"
=
"x86"
]
;
then
ARCH
=
x86
;
fi
;
if
[
"
$ABILONG
"
=
"arm64-v8a"
]
;
then
ARCH
=
arm64
;
IS64BIT
=
true
;
fi
;
if
[
"
$ABILONG
"
=
"x86_64"
]
;
then
ARCH
=
x64
;
IS64BIT
=
true
;
fi
;
if
(
is_mounted /data
)
;
then
rm
-rf
/data/busybox /data/magisk 2>/dev/null
if
[
"
$API
"
-lt
"21"
]
;
then
mkdir
-p
/data/busybox
ui_print
"! Magisk is only for Lollipop 5.0+ (SDK 21+)"
cp
-af
$BINDIR
/data/magisk
exit
1
cp
-af
$INSTALLER
/common/init.magisk.rc
$INSTALLER
/common/magic_mask.sh /data/magisk
fi
chmod
755 /data/busybox /data/magisk /data/magisk/
*
chcon
'u:object_r:system_file:s0'
/data/busybox /data/magisk /data/magisk/
*
ui_print
"- Device platform:
$ARCH
"
/data/magisk/busybox
--install
-s
/data/busybox
# Prevent issues
BINDIR
=
$INSTALLER
/
$ARCH
rm
-f
/data/busybox/su /data/busybox/sh
else
find_boot_image
rm
-rf
/cache/data_bin 2>/dev/null
if
[
-z
"
$BOOTIMAGE
"
]
;
then
mkdir
-p
/cache/data_bin
ui_print
"! Unable to detect boot image"
cp
-af
$BINDIR
/cache/data_bin
exit
1
cp
-af
$INSTALLER
/common/init.magisk.rc
$INSTALLER
/common/magic_mask.sh /cache/data_bin
fi
fi
##########################################################################################
##########################################################################################
...
@@ -288,7 +263,7 @@ fi
...
@@ -288,7 +263,7 @@ fi
##########################################################################################
##########################################################################################
# Fix SuperSU.....
# Fix SuperSU.....
(
$BOOTMODE
)
&&
/data/magisk
/sepolicy-inject
-s
fsck
--live
(
$BOOTMODE
)
&&
$BINDIR
/sepolicy-inject
-s
fsck
--live
if
(
is_mounted /data
)
;
then
if
(
is_mounted /data
)
;
then
IMG
=
/data/magisk.img
IMG
=
/data/magisk.img
...
@@ -318,6 +293,29 @@ cp -af $INSTALLER/common/magiskhide/. /magisk/.core/magiskhide
...
@@ -318,6 +293,29 @@ cp -af $INSTALLER/common/magiskhide/. /magisk/.core/magiskhide
mkdir
-p
/magisk/zzsupersu
mkdir
-p
/magisk/zzsupersu
touch
/magisk/zzsupersu/remove
touch
/magisk/zzsupersu/remove
##########################################################################################
# Environment
##########################################################################################
ui_print
"- Constructing environment"
if
(
is_mounted /data
)
;
then
rm
-rf
/data/busybox /data/magisk 2>/dev/null
mkdir
-p
/data/busybox
cp
-af
$BINDIR
/data/magisk
cp
-af
$INSTALLER
/common/init.magisk.rc
$INSTALLER
/common/magic_mask.sh /data/magisk
chmod
755 /data/busybox /data/magisk /data/magisk/
*
/data/magisk/busybox
--install
-s
/data/busybox
ln
-s
/data/magisk/busybox /data/busybox/busybox
# Prevent issues
rm
-f
/data/busybox/su /data/busybox/sh
else
rm
-rf
/cache/data_bin 2>/dev/null
mkdir
-p
/cache/data_bin
cp
-af
$BINDIR
/cache/data_bin
cp
-af
$INSTALLER
/common/init.magisk.rc
$INSTALLER
/common/magic_mask.sh /cache/data_bin
fi
##########################################################################################
##########################################################################################
# Boot image patch
# Boot image patch
##########################################################################################
##########################################################################################
...
@@ -374,17 +372,15 @@ if (! $NORESTORE); then
...
@@ -374,17 +372,15 @@ if (! $NORESTORE); then
fi
fi
fi
fi
# SuperSU already backup stock boot, no need to do again
if
(!
$SUPERSU
)
;
then
if
(!
$SUPERSU
)
;
then
ui_print
"- Creating backups"
ui_print
"- Creating backups"
mkdir
.backup 2>/dev/null
mkdir
.backup 2>/dev/null
cp
-af
init.environ.rc
*
fstab
*
verity_key sepolicy .backup 2>/dev/null
cp
-af
init.environ.rc
*
fstab
*
verity_key sepolicy .backup 2>/dev/null
if
(!
$SUPERSU
)
;
then
if
(
is_mounted /data
)
;
then
# SuperSU already backup stock boot, no need to do again
cp
-af
$ORIGBOOT
/data/stock_boot.img
if
(
is_mounted /data
)
;
then
else
cp
-af
$ORIGBOOT
/data/stock_boot.img
cp
-af
$ORIGBOOT
/cache/stock_boot.img
else
cp
-af
$ORIGBOOT
/cache/stock_boot.img
fi
fi
fi
fi
fi
...
@@ -400,7 +396,7 @@ for INIT in init*.rc; do
...
@@ -400,7 +396,7 @@ for INIT in init*.rc; do
fi
fi
done
done
# Add magisk
PATH
# Add magisk
specific
if
[
$(
grep
-c
"export PATH"
init.environ.rc
)
-eq
"0"
]
;
then
if
[
$(
grep
-c
"export PATH"
init.environ.rc
)
-eq
"0"
]
;
then
sed
-i
"/on init/a
\ \ \ \
export PATH /magisk/.core/bin:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin:/magisk/.core/busybox"
init.environ.rc
sed
-i
"/on init/a
\ \ \ \
export PATH /magisk/.core/bin:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin:/magisk/.core/busybox"
init.environ.rc
else
else
...
...
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