MagiskHidePropsConf/common/post-fs-data.sh

48 lines
1.3 KiB
Bash
Raw Normal View History

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-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
log_handler "Post-fs-data boot script not found."
log_handler "Restoring boot script (${POSTFILE})."
cp -afv $MODPATH/propsconf_post $POSTFILE >> $LOGFILE
chmod 755 $POSTFILE
# Deleting settings script to force a restore
rm -f $LATEFILE
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-04-25 22:17:32 +00:00
else
2018-05-29 07:29:19 +00:00
RSTTXT="Restoring"
log_handler "Late_start service boot script not found."
fi
log_handler "$RSTTXT boot script (${LATEFILE})."
cp -afv $MODPATH/propsconf_late $LATEFILE >> $LOGFILE
chmod 755 $LATEFILE
2018-03-18 15:39:43 +00:00
fi
2018-05-29 07:29:19 +00:00
log_handler "post-fs-data.sh 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
rm -f $POSTCHKFILE