mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-22 23:26:42 -08:00
Introduce MagiskSU
This commit is contained in:
28
scripts/magisksu.sh
Normal file
28
scripts/magisksu.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/system/bin/sh
|
||||
|
||||
MODDIR=${0%/*}
|
||||
LOGFILE=/cache/magisk.log
|
||||
PATH=$OLDPATH
|
||||
|
||||
log_print() {
|
||||
echo "MagiskSU: $1"
|
||||
echo "MagiskSU: $1" >> $LOGFILE
|
||||
log -p i -t Magisk "MagiskSU: $1"
|
||||
}
|
||||
|
||||
log_print "Moving and linking /sbin binaries"
|
||||
mount -o rw,remount rootfs /
|
||||
/data/busybox/cp -afc /sbin /sbin_orig
|
||||
mount -o ro,remount rootfs /
|
||||
|
||||
log_print "Exposing su binary"
|
||||
rm -rf /magisk/.core/bin $MODDIR/sbin_bind
|
||||
mkdir -p $MODDIR/sbin_bind
|
||||
ln -s /sbin_orig/* $MODDIR/sbin_bind
|
||||
chcon -h u:object_r:rootfs:s0 $MODDIR/sbin_bind/*
|
||||
chmod 755 $MODDIR/sbin_bind
|
||||
ln -s $MODDIR/su $MODDIR/sbin_bind/su
|
||||
mount -o bind $MODDIR/sbin_bind /sbin
|
||||
|
||||
log_print "Starting su daemon"
|
||||
/sbin/su --daemon
|
||||
Reference in New Issue
Block a user