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
ecb33d31
Commit
ecb33d31
authored
Mar 22, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup scripts
parent
eae1c177
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
14 deletions
+23
-14
DownloadApp.java
...src/main/java/com/topjohnwu/magisk/utils/DownloadApp.java
+7
-1
PatchAPK.java
app/src/main/java/com/topjohnwu/magisk/utils/PatchAPK.java
+5
-1
RootUtils.java
app/src/main/java/com/topjohnwu/magisk/utils/RootUtils.java
+3
-2
utils.sh
app/src/main/res/raw/utils.sh
+8
-10
No files found.
app/src/main/java/com/topjohnwu/magisk/utils/DownloadApp.java
View file @
ecb33d31
package
com
.
topjohnwu
.
magisk
.
utils
;
import
android.content.ComponentName
;
import
com.topjohnwu.magisk.App
;
import
com.topjohnwu.magisk.BuildConfig
;
import
com.topjohnwu.magisk.ClassMap
;
import
com.topjohnwu.magisk.Config
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.SplashActivity
;
import
com.topjohnwu.magisk.uicomponents.ProgressNotification
;
import
com.topjohnwu.net.Networking
;
import
com.topjohnwu.net.ResponseListener
;
...
...
@@ -85,7 +89,9 @@ public class DownloadApp {
// Make it world readable
apk
.
setReadable
(
true
,
false
);
if
(
Shell
.
su
(
"pm install "
+
apk
).
exec
().
isSuccess
())
RootUtils
.
rmAndLaunch
(
app
.
getPackageName
(),
BuildConfig
.
APPLICATION_ID
);
RootUtils
.
rmAndLaunch
(
app
.
getPackageName
(),
new
ComponentName
(
BuildConfig
.
APPLICATION_ID
,
ClassMap
.
get
(
SplashActivity
.
class
).
getName
()));
progress
.
dismiss
();
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/utils/PatchAPK.java
View file @
ecb33d31
package
com
.
topjohnwu
.
magisk
.
utils
;
import
android.content.ComponentName
;
import
android.widget.Toast
;
import
androidx.core.app.NotificationCompat
;
import
com.topjohnwu.magisk.App
;
import
com.topjohnwu.magisk.BuildConfig
;
import
com.topjohnwu.magisk.ClassMap
;
import
com.topjohnwu.magisk.Config
;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.SplashActivity
;
import
com.topjohnwu.magisk.uicomponents.Notifications
;
import
com.topjohnwu.signing.JarMap
;
import
com.topjohnwu.signing.SignAPK
;
...
...
@@ -109,7 +112,8 @@ public class PatchAPK {
Config
.
set
(
Config
.
Key
.
SU_MANAGER
,
pkg
);
Config
.
export
();
RootUtils
.
rmAndLaunch
(
BuildConfig
.
APPLICATION_ID
,
pkg
);
RootUtils
.
rmAndLaunch
(
BuildConfig
.
APPLICATION_ID
,
new
ComponentName
(
pkg
,
ClassMap
.
get
(
SplashActivity
.
class
).
getName
()));
return
true
;
}
...
...
app/src/main/java/com/topjohnwu/magisk/utils/RootUtils.java
View file @
ecb33d31
package
com
.
topjohnwu
.
magisk
.
utils
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
androidx.annotation.NonNull
;
...
...
@@ -15,8 +16,8 @@ import java.io.InputStream;
public
class
RootUtils
extends
Shell
.
Initializer
{
public
static
void
rmAndLaunch
(
String
rm
,
String
launch
)
{
Shell
.
su
(
Utils
.
fmt
(
"(rm_launch %s %s)&"
,
rm
,
launch
)).
exec
();
public
static
void
rmAndLaunch
(
String
rm
,
ComponentName
component
)
{
Shell
.
su
(
Utils
.
fmt
(
"(rm_launch %s %s)&"
,
rm
,
component
.
flattenToString
()
)).
exec
();
}
@Override
...
...
app/src/main/res/raw/utils.sh
View file @
ecb33d31
...
...
@@ -7,12 +7,10 @@ env_check() {
fix_env
()
{
cd
$MAGISKBIN
local
OLDPATH
=
"
$PATH
"
PATH
=
/sbin:/system/bin:/vendor/bin
sh update-binary
-x
PATH
=
"
$OLDPATH
"
PATH
=
/sbin:/system/bin sh update-binary
-x
./busybox
rm
-f
$MAGISKTMP
/busybox/
*
$MAGISKTMP
/mirror/bin/busybox
--install
-s
$MAGISKTMP
/busybox
cp
-af
busybox
$MAGISKTMP
/busybox/busybox
$MAGISKTMP
/busybox/busybox
--install
-s
$MAGISKTMP
/busybox
rm
-f
update-binary magisk.apk
chmod
-R
755
.
./magiskinit
-x
magisk magisk
...
...
@@ -27,9 +25,6 @@ run_migrations() {
if
[
-f
/data/adb/magisk/stock_boot
*
]
;
then
mv
/data/adb/magisk/stock_boot
*
/data 2>/dev/null
fi
# Remove old dbs
rm
-f
/data/user
*
/
*
/magisk.db
[
-L
/data/magisk.img
]
||
mv
/data/magisk.img /data/adb/magisk.img 2>/dev/null
}
direct_install
()
{
...
...
@@ -79,7 +74,10 @@ post_ota() {
./bootctl hal-info
||
return
[
`
./bootctl get-current-slot
`
-eq
0
]
&&
SLOT_NUM
=
1
||
SLOT_NUM
=
0
./bootctl set-active-boot-slot
$SLOT_NUM
echo
"BCTRL=
${
1
}
/bootctl;
\$
BCTRL mark-boot-successful;rm -f
\$
BCTRL
\$
0"
>
post-fs-data.d/post_ota.sh
cat
<<
EOF
> post-fs-data.d/post_ota.sh
${
1
}
/bootctl mark-boot-successful
rm -f
${
1
}
/bootctl
EOF
chmod
755 post-fs-data.d/post_ota.sh
cd
/
}
...
...
@@ -112,6 +110,6 @@ EOF
rm_launch
()
{
pm uninstall
$1
am start
-n
$
{
2
}
/a.c
am start
-n
$
2
exit
}
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