Daemons cannot run in /data on Samsung, move to magisk.img
This commit is contained in:
parent
469aba8ed0
commit
8c7fbe20f9
@ -1 +1 @@
|
||||
Subproject commit 2e6bea23acc073aa9b3890c50342dd4a3dc8e754
|
||||
Subproject commit f66a820e14e1df23948b06dbe631c781c029abe0
|
@ -248,8 +248,8 @@ is_mounted /data && MAGISKBIN=/data/magisk || MAGISKBIN=/cache/data_bin
|
||||
# Copy required files
|
||||
rm -rf $MAGISKBIN 2>/dev/null
|
||||
mkdir -p $MAGISKBIN
|
||||
cp -af $BINDIR/. $COMMONDIR/ramdisk_patch.sh $COMMONDIR/magic_mask.sh \
|
||||
$COMMONDIR/init.magisk.rc $COMMONDIR/magisk.apk $MAGISKBIN
|
||||
cp -af $BINDIR/busybox $BINDIR/magiskboot $BINDIR/magiskpolicy $COMMONDIR/magisk.apk \
|
||||
$COMMONDIR/init.magisk.rc $COMMONDIR/ramdisk_patch.sh $COMMONDIR/magic_mask.sh $MAGISKBIN
|
||||
# Legacy support
|
||||
ln -sf /data/magisk/magiskpolicy $MAGISKBIN/sepolicy-inject
|
||||
|
||||
@ -292,10 +292,13 @@ fi
|
||||
MAGISKLOOP=$LOOPDEVICE
|
||||
|
||||
# Core folders and scripts
|
||||
mkdir -p $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d 2>/dev/null
|
||||
mkdir -p $COREDIR/bin $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d 2>/dev/null
|
||||
cp -af $COMMONDIR/magiskhide/. $COREDIR/magiskhide
|
||||
chmod -R 755 $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d
|
||||
chown -R 0.0 $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d
|
||||
cp -af $BINDIR/resetprop $BINDIR/magiskhide $BINDIR/su $COREDIR/bin
|
||||
# Legacy support
|
||||
ln -sf $COREDIR/bin/resetprop $MAGISKBIN/resetprop
|
||||
chmod -R 755 $COREDIR/bin $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d
|
||||
chown -R 0.0 $COREDIR/bin $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d
|
||||
|
||||
##########################################################################################
|
||||
# Unpack boot
|
||||
|
@ -7,7 +7,6 @@ IMG=/data/magisk.img
|
||||
WHITELIST="/system/bin"
|
||||
|
||||
MOUNTPOINT=/magisk
|
||||
|
||||
COREDIR=$MOUNTPOINT/.core
|
||||
|
||||
TMPDIR=/dev/magisk
|
||||
@ -18,7 +17,8 @@ MOUNTINFO=$TMPDIR/mnt
|
||||
# Use the included busybox for maximum compatibility and reliable results
|
||||
# e.g. we rely on the option "-c" for cp (reserve contexts), and -exec for find
|
||||
TOOLPATH=/dev/busybox
|
||||
BINPATH=/data/magisk
|
||||
DATABIN=/data/magisk
|
||||
MAGISKBIN=$COREDIR/bin
|
||||
OLDPATH=$PATH
|
||||
export PATH=$TOOLPATH:$OLDPATH
|
||||
|
||||
@ -297,15 +297,22 @@ case $1 in
|
||||
# Cache support
|
||||
mv /cache/stock_boot* /data 2>/dev/null
|
||||
if [ -d /cache/data_bin ]; then
|
||||
rm -rf $BINPATH
|
||||
mv /cache/data_bin $BINPATH
|
||||
rm -rf $DATABIN
|
||||
mv /cache/data_bin $DATABIN
|
||||
chmod -R 755 $DATABIN
|
||||
chown -R 0.0 $DATABIN
|
||||
fi
|
||||
|
||||
chmod -R 755 $BINPATH
|
||||
chown -R 0.0 $BINPATH
|
||||
|
||||
# Live patch sepolicy
|
||||
$BINPATH/magiskpolicy --live
|
||||
$DATABIN/magiskpolicy --live
|
||||
|
||||
# Set up environment
|
||||
mkdir -p $TOOLPATH
|
||||
$DATABIN/busybox --install -s $TOOLPATH
|
||||
ln -sf $DATABIN/busybox $TOOLPATH/busybox
|
||||
# Prevent issues
|
||||
rm -f $TOOLPATH/su $TOOLPATH/sh $TOOLPATH/reboot
|
||||
find $DATABIN $TOOLPATH -exec chcon -h u:object_r:system_file:s0 {} \;
|
||||
|
||||
if [ -f $UNINSTALLER ]; then
|
||||
touch /dev/.magisk.unblock
|
||||
@ -314,38 +321,6 @@ case $1 in
|
||||
exit
|
||||
fi
|
||||
|
||||
# Set up environment
|
||||
mkdir -p $TOOLPATH
|
||||
$BINPATH/busybox --install -s $TOOLPATH
|
||||
ln -sf $BINPATH/busybox $TOOLPATH/busybox
|
||||
# Prevent issues
|
||||
rm -f $TOOLPATH/su $TOOLPATH/sh $TOOLPATH/reboot
|
||||
chmod -R 755 $TOOLPATH
|
||||
chown -R 0.0 $TOOLPATH
|
||||
find $BINPATH $TOOLPATH -exec chcon -h u:object_r:system_file:s0 {} \;
|
||||
|
||||
log_print "* Linking binaries to /sbin"
|
||||
mount -o rw,remount rootfs /
|
||||
chmod 755 /sbin
|
||||
ln -sf $BINPATH/magiskpolicy /sbin/magiskpolicy
|
||||
ln -sf $BINPATH/magiskpolicy /sbin/sepolicy-inject
|
||||
ln -sf $BINPATH/resetprop /sbin/resetprop
|
||||
if [ ! -f /sbin/launch_daemonsu.sh ]; then
|
||||
log_print "* Starting MagiskSU"
|
||||
export PATH=$OLDPATH
|
||||
ln -sf $BINPATH/su /sbin/su
|
||||
ln -sf $BINPATH/magiskpolicy /sbin/supolicy
|
||||
/sbin/su --daemon
|
||||
export PATH=$TOOLPATH:$OLDPATH
|
||||
fi
|
||||
mount -o ro,remount rootfs /
|
||||
|
||||
# Exit if disabled
|
||||
[ -f $DISABLEFILE ] && unblock
|
||||
|
||||
# Multirom functions should go here, not available right now
|
||||
MULTIROM=false
|
||||
|
||||
# Image merging
|
||||
chmod 644 $IMG /cache/magisk.img /data/magisk_merge.img 2>/dev/null
|
||||
merge_image /cache/magisk.img
|
||||
@ -364,7 +339,7 @@ case $1 in
|
||||
|
||||
# Remove empty directories, legacy paths, symlinks, old temporary images
|
||||
find $MOUNTPOINT -type d -depth ! -path "*core*" -exec rmdir {} \; 2>/dev/null
|
||||
rm -rf $MOUNTPOINT/zzsupersu $MOUNTPOINT/phh $COREDIR/bin $COREDIR/dummy $COREDIR/mirror \
|
||||
rm -rf $MOUNTPOINT/zzsupersu $MOUNTPOINT/phh $COREDIR/dummy $COREDIR/mirror \
|
||||
$COREDIR/busybox $COREDIR/su /data/magisk/*.img /data/busybox 2>/dev/null
|
||||
|
||||
# Remove modules that are labeled to be removed
|
||||
@ -393,6 +368,28 @@ case $1 in
|
||||
fi
|
||||
fi
|
||||
|
||||
log_print "* Linking binaries to /sbin"
|
||||
mount -o rw,remount rootfs /
|
||||
chmod 755 /sbin
|
||||
ln -sf $DATABIN/magiskpolicy /sbin/magiskpolicy
|
||||
ln -sf $DATABIN/magiskpolicy /sbin/sepolicy-inject
|
||||
ln -sf $MAGISKBIN/resetprop /sbin/resetprop
|
||||
if [ ! -f /sbin/launch_daemonsu.sh ]; then
|
||||
log_print "* Starting MagiskSU"
|
||||
export PATH=$OLDPATH
|
||||
ln -sf $MAGISKBIN/su /sbin/su
|
||||
ln -sf $DATABIN/magiskpolicy /sbin/supolicy
|
||||
/sbin/su --daemon
|
||||
export PATH=$TOOLPATH:$OLDPATH
|
||||
fi
|
||||
mount -o ro,remount rootfs /
|
||||
|
||||
# Exit if disabled
|
||||
[ -f $DISABLEFILE ] && unblock
|
||||
|
||||
# Multirom functions should go here, not available right now
|
||||
MULTIROM=false
|
||||
|
||||
log_print "* Preparing modules"
|
||||
|
||||
# Remove crap folder
|
||||
@ -421,7 +418,7 @@ case $1 in
|
||||
# Read in defined system props
|
||||
if [ -f $MOD/system.prop ]; then
|
||||
log_print "* Reading props from $MOD/system.prop"
|
||||
$BINPATH/resetprop --file $MOD/system.prop
|
||||
$MAGISKBIN/resetprop --file $MOD/system.prop
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@ -494,10 +491,10 @@ case $1 in
|
||||
bind_mount $COREDIR/hosts /system/etc/hosts
|
||||
fi
|
||||
|
||||
if [ -f $BINPATH/magisk.apk ]; then
|
||||
if [ -f $DATABIN/magisk.apk ]; then
|
||||
if ! ls /data/app | grep com.topjohnwu.magisk; then
|
||||
mkdir /data/app/com.topjohnwu.magisk-1
|
||||
cp $BINPATH/magisk.apk /data/app/com.topjohnwu.magisk-1/base.apk
|
||||
cp $DATABIN/magisk.apk /data/app/com.topjohnwu.magisk-1/base.apk
|
||||
chown 1000.1000 /data/app/com.topjohnwu.magisk-1
|
||||
chown 1000.1000 /data/app/com.topjohnwu.magisk-1/base.apk
|
||||
chmod 755 /data/app/com.topjohnwu.magisk-1
|
||||
@ -505,7 +502,7 @@ case $1 in
|
||||
chcon u:object_r:apk_data_file:s0 /data/app/com.topjohnwu.magisk-1
|
||||
chcon u:object_r:apk_data_file:s0 /data/app/com.topjohnwu.magisk-1/base.apk
|
||||
fi
|
||||
rm -f $BINPATH/magisk.apk 2>/dev/null
|
||||
rm -f $DATABIN/magisk.apk 2>/dev/null
|
||||
fi
|
||||
|
||||
# Expose busybox
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/system/bin/sh
|
||||
|
||||
MODDIR=/magisk/.core/magiskhide
|
||||
BINPATH=/data/magisk
|
||||
BINPATH=/magisk/.core/bin
|
||||
LOGFILE=/cache/magisk.log
|
||||
TOOLPATH=/dev/busybox
|
||||
|
||||
@ -23,7 +23,7 @@ if [ ! -d /sbin_orig ]; then
|
||||
mkdir -p /dev/sbin_bind
|
||||
chmod 755 /dev/sbin_bind
|
||||
ln -s /sbin_orig/* /dev/sbin_bind
|
||||
chcon -h u:object_r:rootfs:s0 /dev/sbin_bind /dev/sbin_bind/*
|
||||
chcon -h u:object_r:system_file:s0 /dev/sbin_bind /dev/sbin_bind/*
|
||||
mount -o bind /dev/sbin_bind /sbin
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user