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
93aedcfe
Commit
93aedcfe
authored
Apr 05, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update all hardcode paths in app and script
parent
47d18bb8
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
27 deletions
+38
-27
Const.kt
app/src/main/java/com/topjohnwu/magisk/core/Const.kt
+4
-3
Module.kt
...ain/java/com/topjohnwu/magisk/core/model/module/Module.kt
+1
-1
RootInit.kt
...src/main/java/com/topjohnwu/magisk/core/utils/RootInit.kt
+6
-8
manager.sh
app/src/main/res/raw/manager.sh
+20
-10
util_functions.sh
scripts/util_functions.sh
+7
-5
No files found.
app/src/main/java/com/topjohnwu/magisk/core/Const.kt
View file @
93aedcfe
...
...
@@ -6,7 +6,8 @@ import java.io.File
object
Const
{
// Paths
const
val
MAGISK_PATH
=
"/sbin/.magisk/modules"
lateinit
var
MAGISKTMP
:
String
val
MAGISK_PATH
get
()
=
"$MAGISKTMP/modules"
var
MAGISK_DISABLE_FILE
=
File
(
"xxx"
)
const
val
TMP_FOLDER_PATH
=
"/dev/tmp"
const
val
MAGISK_LOG
=
"/cache/magisk.log"
...
...
@@ -25,8 +26,8 @@ object Const {
object
Version
{
const
val
MIN_VERSION
=
"v19.0"
const
val
MIN_VERCODE
=
19000
const
val
CONNECT_MODE
=
201
00
const
val
PROVIDER_CONNECT
=
20102
const
val
PROVIDER_CONNECT
=
202
00
const
val
DYNAMIC_PATH
=
20400
}
object
ID
{
...
...
app/src/main/java/com/topjohnwu/magisk/core/model/module/Module.kt
View file @
93aedcfe
...
...
@@ -62,7 +62,7 @@ class Module(path: String) : BaseModule() {
companion
object
{
private
const
val
PERSIST
=
"/sbin/.magisk
/mirror/persist/magisk"
private
val
PERSIST
get
()
=
"${Const.MAGISKTMP}
/mirror/persist/magisk"
@WorkerThread
fun
loadModules
():
List
<
Module
>
{
...
...
app/src/main/java/com/topjohnwu/magisk/core/utils/RootInit.kt
View file @
93aedcfe
...
...
@@ -18,22 +18,20 @@ class RootInit : Shell.Initializer() {
fun
init
(
context
:
Context
,
shell
:
Shell
):
Boolean
{
val
job
=
shell
.
newJob
()
if
(
Info
.
env
.
magiskVersionCode
>=
Const
.
Version
.
DYNAMIC_PATH
)
job
.
add
(
"MAGISKTMP=$(magisk --path)/.magisk"
)
else
job
.
add
(
"MAGISKTMP=/sbin/.magisk"
)
job
.
add
(
context
.
rawResource
(
R
.
raw
.
manager
))
if
(
shell
.
isRoot
)
{
job
.
add
(
context
.
rawResource
(
R
.
raw
.
util_functions
))
.
add
(
"SHA1=`grep_prop SHA1 /sbin/.magisk/config`"
)
Const
.
MAGISK_DISABLE_FILE
=
SuFile
(
"/cache/.disable_magisk"
)
}
job
.
add
(
"export BOOTMODE=true"
,
"mount_partitions"
,
"get_flags"
,
"run_migrations"
).
exec
()
job
.
add
(
"mm_init"
).
exec
()
fun
getvar
(
name
:
String
)
=
ShellUtils
.
fastCmd
(
shell
,
"echo \$$name"
).
toBoolean
()
Const
.
MAGISKTMP
=
ShellUtils
.
fastCmd
(
shell
,
"echo \$MAGISKTMP"
)
Info
.
keepVerity
=
getvar
(
"KEEPVERITY"
)
Info
.
keepEnc
=
getvar
(
"KEEPFORCEENCRYPT"
)
Info
.
isSAR
=
getvar
(
"SYSTEM_ROOT"
)
...
...
app/src/main/res/raw/manager.sh
View file @
93aedcfe
...
...
@@ -11,12 +11,9 @@ env_check() {
fix_env
()
{
cd
$MAGISKBIN
PATH
=
/sbin:/system/bin sh update-binary
-x
./busybox
rm
-f
$MAGISKTMP
/busybox/
*
cp
-af
busybox
$MAGISKTMP
/busybox/busybox
$MAGISKTMP
/busybox/busybox
--install
-s
$MAGISKTMP
/busybox
rm
-f
update-binary magisk.apk
chmod
-R
755
.
PATH
=
/system/bin /system/bin/sh update-binary
-x
./busybox
rm
-f
update-binary magisk.apk
./busybox
chmod
-R
755
.
./magiskinit
-x
magisk magisk
cd
/
}
...
...
@@ -95,8 +92,8 @@ EOF
add_hosts_module
()
{
# Do not touch existing hosts module
[
-d
/sbin/.magisk
/modules/hosts
]
&&
return
cd
/sbin/.magisk
/modules
[
-d
$MAGISKTMP
/modules/hosts
]
&&
return
cd
$MAGISKTMP
/modules
mkdir
-p
hosts/system/etc
cat
<<
EOF
> hosts/module.prop
id=hosts
...
...
@@ -106,8 +103,7 @@ versionCode=1
author=Magisk Manager
description=Magisk Manager built-in systemless hosts module
EOF
cp
-f
/system/etc/hosts hosts/system/etc/hosts
magisk
--clone-attr
/system/etc/hosts hosts/system/etc/hosts
magisk
--clone
/system/etc/hosts hosts/system/etc/hosts
touch
hosts/update
cd
/
}
...
...
@@ -159,3 +155,17 @@ get_flags() {
}
run_migrations
()
{
return
;
}
grep_prop
()
{
return
;
}
#############
# Initialize
#############
mm_init
()
{
export
BOOTMODE
=
true
mount_partitions
get_flags
run_migrations
SHA1
=
$(
grep_prop SHA1
$MAGISKTMP
/config
)
}
scripts/util_functions.sh
View file @
93aedcfe
...
...
@@ -34,8 +34,10 @@ grep_prop() {
getvar
()
{
local
VARNAME
=
$1
local
VALUE
=
VALUE
=
`
grep_prop
$VARNAME
/sbin/.magisk/config /data/.magisk /cache/.magisk
`
local
VALUE
local
PROPPATH
=
'/data/.magisk /cache/.magisk'
[
-n
$MAGISKTMP
]
&&
PROPPATH
=
"
$MAGISKTMP
/config
$PROPPATH
"
VALUE
=
$(
grep_prop
$VARNAME
$PROPPATH
)
[
!
-z
$VALUE
]
&&
eval
$VARNAME
=
\$
VALUE
}
...
...
@@ -628,7 +630,8 @@ is_legacy_script() {
# Require OUTFD, ZIPFILE to be set
install_module
()
{
local
PERSISTDIR
=
/sbin/.magisk/mirror/persist
local
PERSISTDIR
command
-v
magisk
>
/dev/null
&&
PERSISTDIR
=
$(
magisk
--path
)
/mirror/persist
rm
-rf
$TMPDIR
mkdir
-p
$TMPDIR
...
...
@@ -705,7 +708,7 @@ install_module() {
fi
# Copy over custom sepolicy rules
if
[
-f
$MODPATH
/sepolicy.rule
-a
-e
$PERSISTDIR
]
;
then
if
[
-f
$MODPATH
/sepolicy.rule
-a
-e
"
$PERSISTDIR
"
]
;
then
ui_print
"- Installing custom sepolicy patch"
PERSISTMOD
=
$PERSISTDIR
/magisk/
$MODID
mkdir
-p
$PERSISTMOD
...
...
@@ -733,7 +736,6 @@ install_module() {
[
-z
$BOOTMODE
]
&&
ps
-A
2>/dev/null |
grep
zygote |
grep
-qv
grep
&&
BOOTMODE
=
true
[
-z
$BOOTMODE
]
&&
BOOTMODE
=
false
MAGISKTMP
=
/sbin/.magisk
NVBASE
=
/data/adb
TMPDIR
=
/dev/tmp
...
...
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