mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 03:55:25 +00:00
Introduce MagiskSU
This commit is contained in:
parent
d4149d4b7a
commit
298f09402f
3
.gitignore
vendored
3
.gitignore
vendored
@ -15,6 +15,9 @@ ziptools/zipadjust
|
|||||||
|
|
||||||
# Generated scripts
|
# Generated scripts
|
||||||
zip_static/common/magic_mask.sh
|
zip_static/common/magic_mask.sh
|
||||||
|
zip_static/common/magisksu.sh
|
||||||
|
zip_static/common/init.magisk.rc
|
||||||
|
zip_static/common/custom_ramdisk_patch.sh
|
||||||
zip_static/META-INF/com/google/android/update-binary
|
zip_static/META-INF/com/google/android/update-binary
|
||||||
|
|
||||||
# Leave all busybox!
|
# Leave all busybox!
|
||||||
|
@ -53,11 +53,11 @@ EXIT /B %ERRORLEVEL%
|
|||||||
ECHO ************************
|
ECHO ************************
|
||||||
ECHO * Copying binaries
|
ECHO * Copying binaries
|
||||||
ECHO ************************
|
ECHO ************************
|
||||||
COPY /Y libs\armeabi\* zip_static\arm
|
COPY /Y libs\armeabi-v7a\* zip_static\arm
|
||||||
COPY /Y libs\arm64-v8a\* zip_static\arm64
|
COPY /Y libs\arm64-v8a\* zip_static\arm64
|
||||||
COPY /Y libs\x86\* zip_static\x86
|
COPY /Y libs\x86\* zip_static\x86
|
||||||
COPY /Y libs\x86_64\* zip_static\x64
|
COPY /Y libs\x86_64\* zip_static\x64
|
||||||
CALL :mkcp libs\armeabi\bootimgtools uninstaller\arm
|
CALL :mkcp libs\armeabi-v7a\bootimgtools uninstaller\arm
|
||||||
CALL :mkcp libs\arm64-v8a\bootimgtools uninstaller\arm64
|
CALL :mkcp libs\arm64-v8a\bootimgtools uninstaller\arm64
|
||||||
CALL :mkcp libs\x86\bootimgtools uninstaller\x86
|
CALL :mkcp libs\x86\bootimgtools uninstaller\x86
|
||||||
CALL :mkcp libs\x86_64\bootimgtools uninstaller\x64
|
CALL :mkcp libs\x86_64\bootimgtools uninstaller\x64
|
||||||
@ -75,6 +75,8 @@ EXIT /B %ERRORLEVEL%
|
|||||||
forfiles /P zip_static\x64 /C "cmd /C IF NOT @file == \"busybox\" DEL @file"
|
forfiles /P zip_static\x64 /C "cmd /C IF NOT @file == \"busybox\" DEL @file"
|
||||||
2>NUL DEL zip_static\META-INF\com\google\android\update-binary
|
2>NUL DEL zip_static\META-INF\com\google\android\update-binary
|
||||||
2>NUL DEL zip_static\common\custom_ramdisk_patch.sh
|
2>NUL DEL zip_static\common\custom_ramdisk_patch.sh
|
||||||
|
2>NUL DEL zip_static\common\magisksu.sh
|
||||||
|
2>NUL DEL zip_static\common\init.magisk.rc
|
||||||
2>NUL DEL zip_static\common\magic_mask.sh
|
2>NUL DEL zip_static\common\magic_mask.sh
|
||||||
2>NUL RMDIR /S /Q uninstaller\arm
|
2>NUL RMDIR /S /Q uninstaller\arm
|
||||||
2>NUL RMDIR /S /Q uninstaller\arm64
|
2>NUL RMDIR /S /Q uninstaller\arm64
|
||||||
@ -100,6 +102,8 @@ EXIT /B %ERRORLEVEL%
|
|||||||
ECHO * Zipping Magisk v%~1
|
ECHO * Zipping Magisk v%~1
|
||||||
ECHO ************************
|
ECHO ************************
|
||||||
COPY /Y scripts\custom_ramdisk_patch.sh zip_static\common\custom_ramdisk_patch.sh
|
COPY /Y scripts\custom_ramdisk_patch.sh zip_static\common\custom_ramdisk_patch.sh
|
||||||
|
COPY /Y scripts\magisksu.sh zip_static\common\magisksu.sh
|
||||||
|
COPY /Y scripts\init.magisk.rc zip_static\common\init.magisk.rc
|
||||||
CD zip_static
|
CD zip_static
|
||||||
2>NUL DEL "..\Magisk-v%~1.zip"
|
2>NUL DEL "..\Magisk-v%~1.zip"
|
||||||
..\ziptools\win_bin\zip "..\Magisk-v%~1.zip" -r .
|
..\ziptools\win_bin\zip "..\Magisk-v%~1.zip" -r .
|
||||||
|
8
build.sh
8
build.sh
@ -26,6 +26,8 @@ cleanup() {
|
|||||||
ls zip_static/x64/* | grep -v "busybox" | xargs rm -rfv
|
ls zip_static/x64/* | grep -v "busybox" | xargs rm -rfv
|
||||||
rm -rfv zip_static/META-INF/com/google/android/update-binary
|
rm -rfv zip_static/META-INF/com/google/android/update-binary
|
||||||
rm -rfv zip_static/common/custom_ramdisk_patch.sh
|
rm -rfv zip_static/common/custom_ramdisk_patch.sh
|
||||||
|
rm -rfv zip_static/common/magisksu.sh
|
||||||
|
rm -rfv zip_static/common/init.magisk.rc
|
||||||
rm -rfv zip_static/common/magic_mask.sh
|
rm -rfv zip_static/common/magic_mask.sh
|
||||||
rm -rfv uninstaller/arm
|
rm -rfv uninstaller/arm
|
||||||
rm -rfv uninstaller/arm64
|
rm -rfv uninstaller/arm64
|
||||||
@ -52,8 +54,8 @@ build_bin() {
|
|||||||
echo "************************"
|
echo "************************"
|
||||||
echo "* Copying binaries"
|
echo "* Copying binaries"
|
||||||
echo "************************"
|
echo "************************"
|
||||||
mkcp "libs/armeabi/*" zip_static/arm
|
mkcp "libs/armeabi-v7a/*" zip_static/arm
|
||||||
mkcp libs/armeabi/bootimgtools uninstaller/arm
|
mkcp libs/armeabi-v7a/bootimgtools uninstaller/arm
|
||||||
mkcp "libs/arm64-v8a/*" zip_static/arm64
|
mkcp "libs/arm64-v8a/*" zip_static/arm64
|
||||||
mkcp libs/arm64-v8a/bootimgtools uninstaller/arm64
|
mkcp libs/arm64-v8a/bootimgtools uninstaller/arm64
|
||||||
mkcp "libs/x86/*" zip_static/x86
|
mkcp "libs/x86/*" zip_static/x86
|
||||||
@ -73,6 +75,8 @@ zip_package() {
|
|||||||
echo "* Zipping Magisk v$1"
|
echo "* Zipping Magisk v$1"
|
||||||
echo "************************"
|
echo "************************"
|
||||||
cp -afv scripts/custom_ramdisk_patch.sh zip_static/common/custom_ramdisk_patch.sh
|
cp -afv scripts/custom_ramdisk_patch.sh zip_static/common/custom_ramdisk_patch.sh
|
||||||
|
cp -afv scripts/magisksu.sh zip_static/common/magisksu.sh
|
||||||
|
cp -afv scripts/init.magisk.rc zip_static/common/init.magisk.rc
|
||||||
cd zip_static
|
cd zip_static
|
||||||
find . -type f -exec chmod 644 {} \;
|
find . -type f -exec chmod 644 {} \;
|
||||||
find . -type d -exec chmod 755 {} \;
|
find . -type d -exec chmod 755 {} \;
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#!/system/bin/sh
|
#!/system/bin/sh
|
||||||
|
|
||||||
RAMDISK=$1
|
RAMDISK=$1
|
||||||
BINDIR=$2
|
BINDIR=/data/magisk
|
||||||
[ -z $BINDIR ] && BINDIR=/data/magisk
|
[ ! -e $BINDIR ] && BINDIR=/cache/data_bin
|
||||||
|
[ ! -e $BINDIR ] && exit
|
||||||
SYSTEMLIB=/system/lib
|
SYSTEMLIB=/system/lib
|
||||||
[ -d /system/lib64 ] && SYSTEMLIB=/system/lib64
|
[ -d /system/lib64 ] && SYSTEMLIB=/system/lib64
|
||||||
|
|
||||||
|
@ -321,25 +321,25 @@ ui_print "- Constructing environment"
|
|||||||
|
|
||||||
if (is_mounted /data); then
|
if (is_mounted /data); then
|
||||||
rm -rf /data/busybox /data/magisk 2>/dev/null
|
rm -rf /data/busybox /data/magisk 2>/dev/null
|
||||||
mkdir -p /data/busybox
|
mkdir -p /data/busybox /data/magisk
|
||||||
cp -af $BINDIR /data/magisk
|
cp -af $BINDIR/busybox $BINDIR/sepolicy-inject $BINDIR/resetprop \
|
||||||
cp -af $INSTALLER/common/init.magisk.rc $INSTALLER/common/magic_mask.sh /data/magisk
|
$INSTALLER/common/init.magisk.rc $INSTALLER/common/magic_mask.sh /data/magisk
|
||||||
cp -af $INSTALLER/common/magisk.apk /data/magisk.apk
|
cp -af $INSTALLER/common/magisk.apk /data/magisk.apk
|
||||||
/data/magisk/busybox --install -s /data/busybox
|
/data/magisk/busybox --install -s /data/busybox
|
||||||
ln -s /data/magisk/busybox /data/busybox/busybox
|
ln -s /data/magisk/busybox /data/busybox/busybox
|
||||||
# Prevent issues
|
# Prevent issues
|
||||||
rm -f /data/busybox/su /data/busybox/sh /data/busybox/reboot
|
rm -f /data/busybox/su /data/busybox/sh /data/busybox/reboot
|
||||||
chcon -hR "u:object_r:system_file:s0" /data/magisk /data/busybox
|
chcon -hR u:object_r:system_file:s0 /data/magisk /data/busybox
|
||||||
chmod -R 755 /data/magisk /data/busybox
|
chmod -R 755 /data/magisk /data/busybox
|
||||||
PATH=/data/busybox:$PATH
|
# PATH=/data/busybox:$PATH
|
||||||
BINDIR=/data/magisk
|
|
||||||
else
|
else
|
||||||
rm -rf /cache/data_bin 2>/dev/null
|
rm -rf /cache/data_bin 2>/dev/null
|
||||||
cp -af $BINDIR /cache/data_bin
|
mkdir -p /cache/data_bin
|
||||||
cp -af $INSTALLER/common/init.magisk.rc $INSTALLER/common/magic_mask.sh /cache/data_bin
|
cp -af $BINDIR/busybox $BINDIR/sepolicy-inject $BINDIR/resetprop \
|
||||||
|
$INSTALLER/common/custom_ramdisk_patch.sh $INSTALLER/common/init.magisk.rc \
|
||||||
|
$INSTALLER/common/magic_mask.sh /cache/data_bin
|
||||||
cp -af $INSTALLER/common/magisk.apk /cache/magisk.apk
|
cp -af $INSTALLER/common/magisk.apk /cache/magisk.apk
|
||||||
chmod -R 755 /cache/data_bin
|
chmod -R 755 /cache/data_bin
|
||||||
BINDIR=/cache/data_bin
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
@ -370,8 +370,11 @@ if (! is_mounted /magisk); then
|
|||||||
fi
|
fi
|
||||||
MAGISKLOOP=$LOOPDEVICE
|
MAGISKLOOP=$LOOPDEVICE
|
||||||
|
|
||||||
mkdir -p /magisk/.core/magiskhide 2>/dev/null
|
# Core folders and scripts
|
||||||
cp -af $INSTALLER/common/magiskhide/. /magisk/.core/magiskhide
|
mkdir -p $COREDIR/magiskhide $COREDIR/postfsdata.d $COREDIR/service.d 2>/dev/null
|
||||||
|
cp -af $INSTALLER/common/magiskhide/. $BINDIR/magiskhide $COREDIR/magiskhide
|
||||||
|
chmod -R 755 $COREDIR/magiskhide $COREDIR/postfsdata.d $COREDIR/service.d
|
||||||
|
chown -R 0.0 $COREDIR/magiskhide $COREDIR/postfsdata.d $COREDIR/service.d
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
# Boot image patch
|
# Boot image patch
|
||||||
@ -434,7 +437,7 @@ if ($SUPERSU); then
|
|||||||
fi
|
fi
|
||||||
rm -f $TMPDIR/boottmp/stock_boot.img $UNPACKDIR/ramdisk.orig.gz $UNPACKDIR/ramdisk.gz 2>/dev/null
|
rm -f $TMPDIR/boottmp/stock_boot.img $UNPACKDIR/ramdisk.orig.gz $UNPACKDIR/ramdisk.gz 2>/dev/null
|
||||||
ui_print "- Patching ramdisk with sukernel"
|
ui_print "- Patching ramdisk with sukernel"
|
||||||
sh /data/custom_ramdisk_patch.sh $UNPACKDIR/ramdisk $BINDIR
|
sh /data/custom_ramdisk_patch.sh $UNPACKDIR/ramdisk
|
||||||
LD_LIBRARY_PATH=$SYSTEMLIB /su/bin/sukernel --cpio-backup $UNPACKDIR/ramdisk.orig $UNPACKDIR/ramdisk $UNPACKDIR/ramdisk
|
LD_LIBRARY_PATH=$SYSTEMLIB /su/bin/sukernel --cpio-backup $UNPACKDIR/ramdisk.orig $UNPACKDIR/ramdisk $UNPACKDIR/ramdisk
|
||||||
gzip -9 < $UNPACKDIR/ramdisk > $UNPACKDIR/ramdisk.gz
|
gzip -9 < $UNPACKDIR/ramdisk > $UNPACKDIR/ramdisk.gz
|
||||||
rm -f $UNPACKDIR/ramdisk $UNPACKDIR/ramdisk.orig
|
rm -f $UNPACKDIR/ramdisk $UNPACKDIR/ramdisk.orig
|
||||||
@ -481,24 +484,13 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Root
|
# MagiskSU
|
||||||
ROOT=false
|
ui_print "- Installing MagiskSU"
|
||||||
if [ ! -d /magisk/phh ]; then
|
rm -rf $COREDIR/su 2>/dev/null
|
||||||
ui_print "- Installing phh's SuperUser"
|
mkdir -p $COREDIR/su
|
||||||
ROOT=true
|
cp -af $BINDIR/su $INSTALLER/common/magisksu.sh $COREDIR/su
|
||||||
elif [ `grep_prop versionCode /magisk/phh/module.prop` -lt `grep_prop versionCode $INSTALLER/common/phh/module.prop` ]; then
|
chmod -R 755 $COREDIR/su
|
||||||
ui_print "- Upgrading phh's SuperUser"
|
chown -R 0.0 $COREDIR/su
|
||||||
ROOT=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ($ROOT); then
|
|
||||||
mkdir -p /magisk/phh/bin 2>/dev/null
|
|
||||||
mkdir -p /magisk/phh/su.d 2>/dev/null
|
|
||||||
cp -af $INSTALLER/common/phh/. /magisk/phh
|
|
||||||
cp -af $BINDIR/su $BINDIR/sepolicy-inject /magisk/phh/bin
|
|
||||||
chmod -R 755 /magisk/phh
|
|
||||||
chown -R 0.0 /magisk/phh
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Patch ramdisk
|
# Patch ramdisk
|
||||||
ui_print "- Patching ramdisk"
|
ui_print "- Patching ramdisk"
|
||||||
@ -544,6 +536,7 @@ else
|
|||||||
|
|
||||||
chmod 0755 magisk
|
chmod 0755 magisk
|
||||||
chmod 0750 init.magisk.rc sbin/magic_mask.sh
|
chmod 0750 init.magisk.rc sbin/magic_mask.sh
|
||||||
|
chown 0.0 magisk init.magisk.rc sbin/magic_mask.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ui_print "- Repacking boot image"
|
ui_print "- Repacking boot image"
|
||||||
|
@ -266,12 +266,13 @@ case $1 in
|
|||||||
# Don't run twice
|
# Don't run twice
|
||||||
if [ "`getprop magisk.restart_pfsd`" != "1" ]; then
|
if [ "`getprop magisk.restart_pfsd`" != "1" ]; then
|
||||||
|
|
||||||
export OLDPATH=$PATH
|
|
||||||
export PATH=$TOOLPATH:$OLDPATH
|
|
||||||
|
|
||||||
log_print "** Magisk post-fs-data mode running..."
|
log_print "** Magisk post-fs-data mode running..."
|
||||||
|
|
||||||
# Cache support
|
# Cache support
|
||||||
|
mv /cache/stock_boot.img /data/stock_boot.img 2>/dev/null
|
||||||
|
mv /cache/magisk.apk /data/magisk.apk 2>/dev/null
|
||||||
|
mv /cache/custom_ramdisk_patch.sh /data/custom_ramdisk_patch.sh 2>/dev/null
|
||||||
|
|
||||||
if [ -d "/cache/data_bin" ]; then
|
if [ -d "/cache/data_bin" ]; then
|
||||||
rm -rf $BINPATH $TOOLPATH
|
rm -rf $BINPATH $TOOLPATH
|
||||||
mkdir -p $TOOLPATH
|
mkdir -p $TOOLPATH
|
||||||
@ -282,17 +283,16 @@ case $1 in
|
|||||||
rm -f $TOOLPATH/su $TOOLPATH/sh $TOOLPATH/reboot
|
rm -f $TOOLPATH/su $TOOLPATH/sh $TOOLPATH/reboot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mv /cache/stock_boot.img /data/stock_boot.img 2>/dev/null
|
# Live patch sepolicy
|
||||||
mv /cache/magisk.apk /data/magisk.apk 2>/dev/null
|
$BINPATH/sepolicy-inject --live
|
||||||
|
|
||||||
# Set up environment
|
# Set up environment
|
||||||
|
export OLDPATH=$PATH
|
||||||
|
export PATH=$TOOLPATH:$OLDPATH
|
||||||
chmod -R 755 $BINPATH $TOOLPATH
|
chmod -R 755 $BINPATH $TOOLPATH
|
||||||
chown -R 0.0 $BINPATH $TOOLPATH
|
chown -R 0.0 $BINPATH $TOOLPATH
|
||||||
find $BINPATH $TOOLPATH -exec chcon -h u:object_r:system_file:s0 {} \;
|
find $BINPATH $TOOLPATH -exec chcon -h u:object_r:system_file:s0 {} \;
|
||||||
|
|
||||||
# Live patch sepolicy
|
|
||||||
$BINPATH/sepolicy-inject --live -s su
|
|
||||||
|
|
||||||
# Multirom functions should go here, not available right now
|
# Multirom functions should go here, not available right now
|
||||||
MULTIROM=false
|
MULTIROM=false
|
||||||
|
|
||||||
@ -314,9 +314,9 @@ case $1 in
|
|||||||
|
|
||||||
# Remove empty directories, legacy paths, symlinks, old temporary images
|
# Remove empty directories, legacy paths, symlinks, old temporary images
|
||||||
find $MOUNTPOINT -type d -depth ! -path "*core*" -exec rmdir {} \; 2>/dev/null
|
find $MOUNTPOINT -type d -depth ! -path "*core*" -exec rmdir {} \; 2>/dev/null
|
||||||
rm -rf $MOUNTPOINT/zzsupersu $COREDIR/bin $COREDIR/dummy $COREDIR/mirror /data/magisk/*.img 2>/dev/null
|
rm -rf $MOUNTPOINT/zzsupersu $MOUNTPOINT/phh $COREDIR/bin $COREDIR/dummy $COREDIR/mirror /data/magisk/*.img 2>/dev/null
|
||||||
|
|
||||||
# Remove modules that is labeled to be removed
|
# Remove modules that are labeled to be removed
|
||||||
for MOD in $MOUNTPOINT/* ; do
|
for MOD in $MOUNTPOINT/* ; do
|
||||||
rm -f $MOD/system/placeholder 2>/dev/null
|
rm -f $MOD/system/placeholder 2>/dev/null
|
||||||
if [ -f $MOD/remove ]; then
|
if [ -f $MOD/remove ]; then
|
||||||
@ -342,13 +342,10 @@ case $1 in
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_print "* Preparing modules"
|
# Start MagiskSU if no SuperSU
|
||||||
|
[ ! -f /sbin/launch_daemonsu.sh ] && sh $COREDIR/su/magisksu.sh
|
||||||
|
|
||||||
# Disable phh and Magisk Hide for SuperSU
|
log_print "* Preparing modules"
|
||||||
if [ -f /sbin/launch_daemonsu.sh ]; then
|
|
||||||
touch /magisk/phh/disable 2>/dev/null
|
|
||||||
rm -f $COREDIR/magiskhide/enable 2>/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p $DUMMDIR
|
mkdir -p $DUMMDIR
|
||||||
mkdir -p $MIRRDIR/system
|
mkdir -p $MIRRDIR/system
|
||||||
|
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
|
@ -1,8 +0,0 @@
|
|||||||
id=phh
|
|
||||||
name=phh's SuperUser
|
|
||||||
version=topjohnwu r2
|
|
||||||
versionCode=7
|
|
||||||
author=phhusson & topjohnwu
|
|
||||||
description=OpenSource SELinux-capable SuperUser
|
|
||||||
support=http://forum.xda-developers.com/showthread.php?t=3216394
|
|
||||||
donate=http://forum.xda-developers.com/donatetome.php?u=1915408
|
|
@ -1,46 +0,0 @@
|
|||||||
#!/system/bin/sh
|
|
||||||
|
|
||||||
LOGFILE=/cache/magisk.log
|
|
||||||
MODDIR=${0%/*}
|
|
||||||
|
|
||||||
log_print() {
|
|
||||||
echo $1
|
|
||||||
echo "phh: $1" >> $LOGFILE
|
|
||||||
log -p i -t phh "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Disable the other root
|
|
||||||
[ -d "/magisk/zzsupersu" ] && touch /magisk/zzsupersu/disable
|
|
||||||
|
|
||||||
log_print "Live patching sepolicy"
|
|
||||||
$MODDIR/bin/sepolicy-inject --live
|
|
||||||
|
|
||||||
log_print "Moving and linking /sbin binaries"
|
|
||||||
mount -o rw,remount rootfs /
|
|
||||||
mv /sbin /sbin_orig
|
|
||||||
mkdir /sbin
|
|
||||||
chmod 755 /sbin
|
|
||||||
ln -s /sbin_orig/* /sbin
|
|
||||||
mount -o ro,remount rootfs /
|
|
||||||
|
|
||||||
# Expose the root path
|
|
||||||
log_print "Mounting supath"
|
|
||||||
rm -rf /magisk/.core/bin $MODDIR/sbin_bind
|
|
||||||
mkdir -p $MODDIR/sbin_bind
|
|
||||||
/data/busybox/cp -afc /sbin/. $MODDIR/sbin_bind
|
|
||||||
chmod 755 $MODDIR/sbin_bind
|
|
||||||
ln -s $MODDIR/bin/* $MODDIR/sbin_bind
|
|
||||||
mount -o bind $MODDIR/sbin_bind /sbin
|
|
||||||
|
|
||||||
# Run su.d
|
|
||||||
for script in $MODDIR/su.d/* ; do
|
|
||||||
if [ -f "$script" ]; then
|
|
||||||
chmod 755 $script
|
|
||||||
log_print "su.d: $script"
|
|
||||||
sh $script
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
log_print "Starting su daemon"
|
|
||||||
[ ! -z $OLDPATH ] && export PATH=$OLDPATH
|
|
||||||
/sbin/su --daemon
|
|
Loading…
Reference in New Issue
Block a user