2017-12-25 21:21:25 +00:00
|
|
|
#!/system/bin/sh
|
2018-04-15 22:05:33 +00:00
|
|
|
# Please don't hardcode /magisk/modname/... ; instead, please use $MODPATH/...
|
2017-12-25 21:21:25 +00:00
|
|
|
# This will make your scripts compatible even if Magisk change its mount point in the future
|
2018-04-15 22:05:33 +00:00
|
|
|
MODPATH=${0%/*}
|
2017-12-25 21:21:25 +00:00
|
|
|
|
|
|
|
# This script will be executed in post-fs-data mode
|
|
|
|
# More info in the main Magisk thread
|
2018-03-18 15:39:43 +00:00
|
|
|
|
|
|
|
# MagiskHide Props Config
|
2018-04-15 22:05:33 +00:00
|
|
|
# By Didgeridoohan @ XDA Developers
|
2018-03-18 15:39:43 +00:00
|
|
|
|
|
|
|
# Variables
|
2018-04-15 22:05:33 +00:00
|
|
|
IMGPATH=$(dirname "$MODPATH")
|
2018-12-22 18:41:34 +00:00
|
|
|
COREPATH=$(dirname "$IMGPATH")
|
|
|
|
POSTLOGFILE=$CACHELOC/propsconf_postfile.log
|
|
|
|
POSTDEL=0
|
2018-03-18 15:39:43 +00:00
|
|
|
|
|
|
|
# Load functions
|
2018-04-15 22:05:33 +00:00
|
|
|
. $MODPATH/util_functions.sh
|
2018-03-18 15:39:43 +00:00
|
|
|
|
2018-05-29 07:29:19 +00:00
|
|
|
if [ ! -f "$POSTCHKFILE" ]; then
|
|
|
|
touch $POSTCHKFILE
|
|
|
|
fi
|
2018-03-18 15:39:43 +00:00
|
|
|
|
2018-04-15 22:05:33 +00:00
|
|
|
# Check for boot scripts and restore backup if deleted, or if the resetfile is present
|
2018-05-29 07:29:19 +00:00
|
|
|
if [ ! -f "$POSTFILE" ]; then
|
|
|
|
# Start logging
|
|
|
|
log_start
|
2018-12-05 15:22:57 +00:00
|
|
|
log_handler "post-fs-data boot script not found."
|
|
|
|
log_handler "Restoring post-fs-data boot script (${POSTFILE})."
|
2018-08-07 11:50:01 +00:00
|
|
|
cp -af $MODPATH/propsconf_post $POSTFILE >> $LOGFILE 2>&1
|
|
|
|
chmod -v 755 $POSTFILE >> $LOGFILE 2>&1
|
2018-12-22 18:41:34 +00:00
|
|
|
placeholder_update $POSTFILE COREPATH CORE_PLACEHOLDER "$COREPATH"
|
|
|
|
placeholder_update $POSTFILE CACHELOC CACHE_PLACEHOLDER "$CACHELOC"
|
2018-05-29 07:29:19 +00:00
|
|
|
# Deleting settings script to force a restore
|
|
|
|
rm -f $LATEFILE
|
2018-12-22 18:41:34 +00:00
|
|
|
POSTDEL=1
|
2018-05-29 07:29:19 +00:00
|
|
|
fi
|
2018-04-15 22:05:33 +00:00
|
|
|
if [ ! -f "$LATEFILE" ] || [ -f "$RESETFILE" ]; then
|
2018-04-25 22:17:32 +00:00
|
|
|
if [ -f "$RESETFILE" ]; then
|
2018-05-29 07:29:19 +00:00
|
|
|
RSTTXT="Resetting"
|
2018-12-22 18:41:34 +00:00
|
|
|
rm -f $RESETFILE
|
2018-04-25 22:17:32 +00:00
|
|
|
else
|
2018-05-29 07:29:19 +00:00
|
|
|
RSTTXT="Restoring"
|
2018-12-05 15:22:57 +00:00
|
|
|
log_handler "late_start service boot script not found."
|
2018-05-29 07:29:19 +00:00
|
|
|
fi
|
2018-12-05 15:22:57 +00:00
|
|
|
log_handler "$RSTTXT late_start service boot script (${LATEFILE})."
|
2018-08-07 11:50:01 +00:00
|
|
|
cp -af $MODPATH/propsconf_late $LATEFILE >> $LOGFILE 2>&1
|
|
|
|
chmod -v 755 $LATEFILE >> $LOGFILE 2>&1
|
2018-12-22 18:41:34 +00:00
|
|
|
placeholder_update $LATEFILE POSTFILE POST_PLACEHOLDER "$POSTFILE"
|
|
|
|
placeholder_update $LATEFILE COREPATH CORE_PLACEHOLDER "$COREPATH"
|
|
|
|
placeholder_update $LATEFILE CACHELOC CACHE_PLACEHOLDER "$CACHELOC"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Checking if the post-fs-data boot script ran during boot
|
|
|
|
if [ -f "$POSTLOGFILE" ] || [ "$POSTDEL" == 1 ]; then
|
|
|
|
if [ "$(cat $POSTLOGFILE | grep "Module no longer installed.")" ] || [ "$POSTDEL" == 1 ]; then
|
|
|
|
log_handler "post-fs-data boot script did not run. Attempting a re-run."
|
|
|
|
. $POSTFILE
|
|
|
|
fi
|
2018-03-18 15:39:43 +00:00
|
|
|
fi
|
|
|
|
|
2018-12-05 15:22:57 +00:00
|
|
|
log_handler "post-fs-data.sh module script finished.\n\n===================="
|
2018-03-18 15:39:43 +00:00
|
|
|
|
2018-05-29 07:29:19 +00:00
|
|
|
# Deletes the post-fs-data control file
|
2018-10-21 14:17:11 +00:00
|
|
|
rm -f $POSTCHKFILE
|