mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-04-21 00:01:28 +00:00
Cleanup scripts
This commit is contained in:
parent
eae1c17738
commit
ecb33d3176
@ -1,9 +1,13 @@
|
|||||||
package com.topjohnwu.magisk.utils;
|
package com.topjohnwu.magisk.utils;
|
||||||
|
|
||||||
|
import android.content.ComponentName;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.App;
|
import com.topjohnwu.magisk.App;
|
||||||
import com.topjohnwu.magisk.BuildConfig;
|
import com.topjohnwu.magisk.BuildConfig;
|
||||||
|
import com.topjohnwu.magisk.ClassMap;
|
||||||
import com.topjohnwu.magisk.Config;
|
import com.topjohnwu.magisk.Config;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
|
import com.topjohnwu.magisk.SplashActivity;
|
||||||
import com.topjohnwu.magisk.uicomponents.ProgressNotification;
|
import com.topjohnwu.magisk.uicomponents.ProgressNotification;
|
||||||
import com.topjohnwu.net.Networking;
|
import com.topjohnwu.net.Networking;
|
||||||
import com.topjohnwu.net.ResponseListener;
|
import com.topjohnwu.net.ResponseListener;
|
||||||
@ -85,7 +89,9 @@ public class DownloadApp {
|
|||||||
// Make it world readable
|
// Make it world readable
|
||||||
apk.setReadable(true, false);
|
apk.setReadable(true, false);
|
||||||
if (Shell.su("pm install " + apk).exec().isSuccess())
|
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();
|
progress.dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
package com.topjohnwu.magisk.utils;
|
package com.topjohnwu.magisk.utils;
|
||||||
|
|
||||||
|
import android.content.ComponentName;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.core.app.NotificationCompat;
|
import androidx.core.app.NotificationCompat;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.App;
|
import com.topjohnwu.magisk.App;
|
||||||
import com.topjohnwu.magisk.BuildConfig;
|
import com.topjohnwu.magisk.BuildConfig;
|
||||||
|
import com.topjohnwu.magisk.ClassMap;
|
||||||
import com.topjohnwu.magisk.Config;
|
import com.topjohnwu.magisk.Config;
|
||||||
import com.topjohnwu.magisk.Const;
|
import com.topjohnwu.magisk.Const;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
|
import com.topjohnwu.magisk.SplashActivity;
|
||||||
import com.topjohnwu.magisk.uicomponents.Notifications;
|
import com.topjohnwu.magisk.uicomponents.Notifications;
|
||||||
import com.topjohnwu.signing.JarMap;
|
import com.topjohnwu.signing.JarMap;
|
||||||
import com.topjohnwu.signing.SignAPK;
|
import com.topjohnwu.signing.SignAPK;
|
||||||
@ -109,7 +112,8 @@ public class PatchAPK {
|
|||||||
|
|
||||||
Config.set(Config.Key.SU_MANAGER, pkg);
|
Config.set(Config.Key.SU_MANAGER, pkg);
|
||||||
Config.export();
|
Config.export();
|
||||||
RootUtils.rmAndLaunch(BuildConfig.APPLICATION_ID, pkg);
|
RootUtils.rmAndLaunch(BuildConfig.APPLICATION_ID,
|
||||||
|
new ComponentName(pkg, ClassMap.get(SplashActivity.class).getName()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.topjohnwu.magisk.utils;
|
package com.topjohnwu.magisk.utils;
|
||||||
|
|
||||||
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -15,8 +16,8 @@ import java.io.InputStream;
|
|||||||
|
|
||||||
public class RootUtils extends Shell.Initializer {
|
public class RootUtils extends Shell.Initializer {
|
||||||
|
|
||||||
public static void rmAndLaunch(String rm, String launch) {
|
public static void rmAndLaunch(String rm, ComponentName component) {
|
||||||
Shell.su(Utils.fmt("(rm_launch %s %s)&", rm, launch)).exec();
|
Shell.su(Utils.fmt("(rm_launch %s %s)&", rm, component.flattenToString())).exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,12 +7,10 @@ env_check() {
|
|||||||
|
|
||||||
fix_env() {
|
fix_env() {
|
||||||
cd $MAGISKBIN
|
cd $MAGISKBIN
|
||||||
local OLDPATH="$PATH"
|
PATH=/sbin:/system/bin sh update-binary -x
|
||||||
PATH=/sbin:/system/bin:/vendor/bin
|
|
||||||
sh update-binary -x
|
|
||||||
PATH="$OLDPATH"
|
|
||||||
./busybox rm -f $MAGISKTMP/busybox/*
|
./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
|
rm -f update-binary magisk.apk
|
||||||
chmod -R 755 .
|
chmod -R 755 .
|
||||||
./magiskinit -x magisk magisk
|
./magiskinit -x magisk magisk
|
||||||
@ -27,9 +25,6 @@ run_migrations() {
|
|||||||
if [ -f /data/adb/magisk/stock_boot* ]; then
|
if [ -f /data/adb/magisk/stock_boot* ]; then
|
||||||
mv /data/adb/magisk/stock_boot* /data 2>/dev/null
|
mv /data/adb/magisk/stock_boot* /data 2>/dev/null
|
||||||
fi
|
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() {
|
direct_install() {
|
||||||
@ -79,7 +74,10 @@ post_ota() {
|
|||||||
./bootctl hal-info || return
|
./bootctl hal-info || return
|
||||||
[ `./bootctl get-current-slot` -eq 0 ] && SLOT_NUM=1 || SLOT_NUM=0
|
[ `./bootctl get-current-slot` -eq 0 ] && SLOT_NUM=1 || SLOT_NUM=0
|
||||||
./bootctl set-active-boot-slot $SLOT_NUM
|
./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
|
chmod 755 post-fs-data.d/post_ota.sh
|
||||||
cd /
|
cd /
|
||||||
}
|
}
|
||||||
@ -112,6 +110,6 @@ EOF
|
|||||||
|
|
||||||
rm_launch() {
|
rm_launch() {
|
||||||
pm uninstall $1
|
pm uninstall $1
|
||||||
am start -n ${2}/a.c
|
am start -n $2
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user