mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-17 13:58:28 +00:00
Cleanup scripts
This commit is contained in:
parent
eae1c17738
commit
ecb33d3176
@ -1,9 +1,13 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,17 @@
|
||||
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;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
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
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user