Adjust scripts

This commit is contained in:
topjohnwu 2017-03-30 23:31:37 +08:00
parent 2e185f4ec9
commit 81d054a525
3 changed files with 34 additions and 32 deletions

View File

@ -292,7 +292,7 @@ fi
MAGISKLOOP=$LOOPDEVICE
# Core folders and scripts
mkdir -p $COREDIR/bin $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d 2>/dev/null
mkdir -p $COREDIR/bin $COREDIR/props $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d 2>/dev/null
cp -af $COMMONDIR/magiskhide/. $COREDIR/magiskhide
cp -af $BINDIR/resetprop $BINDIR/magiskhide $BINDIR/su $BINDIR/magiskpolicy $COREDIR/bin
# Legacy support

View File

@ -317,6 +317,20 @@ case $1 in
exit
fi
if [ -f $DATABIN/magisk.apk ]; then
if ! ls /data/app | grep com.topjohnwu.magisk; then
mkdir /data/app/com.topjohnwu.magisk-1
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
chmod 644 /data/app/com.topjohnwu.magisk-1/base.apk
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 $DATABIN/magisk.apk 2>/dev/null
fi
# Image merging
chmod 644 $IMG /cache/magisk.img /data/magisk_merge.img 2>/dev/null
merge_image /cache/magisk.img
@ -480,29 +494,6 @@ case $1 in
bind_mount "$ORIG" "$TARGET"
done
# Bind hosts for Adblock apps
if [ -f $COREDIR/hosts ]; then
log_print "* Enabling systemless hosts file support"
bind_mount $COREDIR/hosts /system/etc/hosts
fi
if [ -f $DATABIN/magisk.apk ]; then
if ! ls /data/app | grep com.topjohnwu.magisk; then
mkdir /data/app/com.topjohnwu.magisk-1
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
chmod 644 /data/app/com.topjohnwu.magisk-1/base.apk
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 $DATABIN/magisk.apk 2>/dev/null
fi
# Expose busybox
[ "`getprop persist.magisk.busybox`" = "1" ] && sh /sbin/magic_mask.sh mount_busybox
# Restart post-fs-data if necessary (multirom)
$MULTIROM && setprop magisk.restart_pfsd 1
@ -522,6 +513,14 @@ case $1 in
MAGISK_VERSION_STUB
log_print "** Magisk late_start service mode running..."
# Bind hosts for Adblock apps
if [ -f $COREDIR/hosts ]; then
log_print "* Enabling systemless hosts file support"
bind_mount $COREDIR/hosts /system/etc/hosts
fi
# Expose busybox
[ "`getprop persist.magisk.busybox`" = "1" ] && sh /sbin/magic_mask.sh mount_busybox
# Live patch sepolicy
$MAGISKBIN/magiskpolicy --live --magisk
@ -545,7 +544,10 @@ case $1 in
general_scripts service
# Start MagiskHide
[ "`getprop persist.magisk.hide`" = "1" ] && sh $COREDIR/magiskhide/enable
if [ "`getprop persist.magisk.hide`" = "1" ]; then
log_print "* Starting MagiskHide"
sh $COREDIR/magiskhide/enable
fi
if [ -f $DISABLEFILE ]; then
# Let MagiskManager know

View File

@ -32,10 +32,10 @@ log_print "Removing dangerous read-only system props"
VERIFYBOOT=`getprop ro.boot.verifiedbootstate`
FLASHLOCKED=`getprop ro.boot.flash.locked`
VERITYMODE=`getprop ro.boot.veritymode`
KNOX1=`getprop ro.boot.warranty_bit`
KNOX2=`getprop ro.warranty_bit`
DEBUGGABLE=`getprop ro.debuggable`
SECURE=`getprop ro.secure`
BUILDTYPE=`getprop ro.build.type`
BUILDTAGS=`getprop ro.build.tags`
[ ! -z "$VERIFYBOOT" -a "$VERIFYBOOT" != "green" ] && \
log_print "`$BINPATH/resetprop -v -n ro.boot.verifiedbootstate green`"
@ -43,14 +43,14 @@ log_print "`$BINPATH/resetprop -v -n ro.boot.verifiedbootstate green`"
log_print "`$BINPATH/resetprop -v -n ro.boot.flash.locked 1`"
[ ! -z "$VERITYMODE" -a "$VERITYMODE" != "enforcing" ] && \
log_print "`$BINPATH/resetprop -v -n ro.boot.veritymode enforcing`"
[ ! -z "$KNOX1" -a "$KNOX1" != "0" ] && \
log_print "`$BINPATH/resetprop -v -n ro.boot.warranty_bit 0`"
[ ! -z "$KNOX2" -a "$KNOX2" != "0" ] && \
log_print "`$BINPATH/resetprop -v -n ro.warranty_bit 0`"
[ ! -z "$DEBUGGABLE" -a "$DEBUGGABLE" != "0" ] && \
log_print "`$BINPATH/resetprop -v -n ro.debuggable 0`"
[ ! -z "$SECURE" -a "$SECURE" != "1" ] && \
log_print "`$BINPATH/resetprop -v -n ro.secure 1`"
[ ! -z "$BUILDTYPE" -a "$BUILDTYPE" != "user" ] && \
log_print "`$BINPATH/resetprop -v -n ro.build.type user`"
[ ! -z "$BUILDTAGS" -a "$BUILDTAGS" != "release-keys" ] && \
log_print "`$BINPATH/resetprop -v -n ro.build.tags release-keys`"
touch $MODDIR/hidelist
chmod -R 755 $MODDIR
@ -65,4 +65,4 @@ while read PROCESS; do
done < $MODDIR/hidelist
log_print "Starting MagiskHide daemon"
$BINPATH/magiskhide --daemon
($BINPATH/magiskhide --daemon)