Move root helper location

This commit is contained in:
topjohnwu
2016-10-15 05:38:30 +08:00
parent 70e8ad7104
commit 696d256fa0
5 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
id=phh
name=phh's SuperUser
version=Root Helper
versionCode=1
author=phhusson, topjohnwu
description=This is a helper, please upgrade from downloads section :)
support=http://forum.xda-developers.com/showthread.php?t=3216394
donate=http://forum.xda-developers.com/donatetome.php?u=1915408
cacheModule=false

View File

@@ -0,0 +1,40 @@
#!/system/bin/sh
LOGFILE=/cache/magisk.log
log_print() {
echo $1
echo "phh: $1" >> $LOGFILE
log -p i -t phh "$1"
}
launch_daemonsu() {
export PATH=$OLDPATH
# Switch contexts
echo "u:r:su_daemon:s0" > /proc/self/attr/current
# Start daemon
exec /magisk/phh/bin/su --daemon
}
# Disable the other root
[ -d "/magisk/zzsupersu" ] && touch /magisk/zzsupersu/disable
log_print "Live patching sepolicy"
/magisk/phh/bin/sepolicy-inject --live
# Expose the root path
log_print "Linking supath"
rm -rf /magisk/.core/bin
ln -s /magisk/phh/bin /magisk/.core/bin
# Run su.d
for script in /magisk/phh/su.d/* ; do
if [ -f "$script" ]; then
chmod 755 $script
log_print "su.d: $script"
$script
fi
done
log_print "Starting su daemon"
(launch_daemonsu &)

View File

@@ -0,0 +1,29 @@
#!/system/bin/sh
cd /magisk/00roothelper
if [ -f "launch_daemonsu.sh" ]; then
# SuperSU mode
rm -rf /magisk/supersu /magisk/zzsupersu
mkdir -p /magisk/zzsupersu
cp supersu.sh /magisk/zzsupersu/post-fs-data.sh
cp supersu.prop /magisk/zzsupersu/module.prop
cp launch_daemonsu.sh /magisk/zzsupersu/launch_daemonsu.sh
chmod 755 /magisk/zzsupersu /magisk/zzsupersu/*
else
# phh mode
if [ -f "/magisk/phh/su" ]; then
# Old version detected
cp /magisk/phh/su su
rm -rf /magisk/phh
mkdir -p /magisk/phh/bin
mkdir -p /magisk/phh/su.d
cp su /magisk/phh/bin/su
cp /data/magisk/sepolicy-inject /magisk/phh/bin/sepolicy-inject
cp phh.sh /magisk/phh/post-fs-data.sh
cp phh.prop /magisk/phh/module.prop
chmod 755 /magisk/phh /magisk/phh/* /magisk/phh/bin/*
fi
fi
rm -rf /magisk/00roothelper

View File

@@ -0,0 +1,7 @@
id=supersu
name=SuperSU Helper
version=v1
versionCode=1
author=topjohnwu
description=This is a helper module for Chainfire's SuperSU to work with Magisk
cacheModule=false

View File

@@ -0,0 +1,11 @@
#!/system/bin/sh
mount -o rw,remount rootfs /
mkdir /su 2>/dev/null
mount -o ro,remount rootfs /
chmod 755 /magisk/zzsupersu/launch_daemonsu.sh
/magisk/zzsupersu/launch_daemonsu.sh post-fs-data
rm -rf /magisk/.core/bin
ln -s /su/bin /magisk/.core/bin