MagiskHidePropsConf/common/post-fs-data.sh

53 lines
1.6 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})."
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-07-19 19:47:43 +00:00
placeholder_update $POSTFILE IMGPATH IMG_PLACEHOLDER $IMGPATH
2018-05-29 07:29:19 +00:00
# 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})."
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-07-19 19:47:43 +00:00
placeholder_update $LATEFILE IMGPATH IMG_PLACEHOLDER $IMGPATH
placeholder_update $LATEFILE CACHELOC CACHE_PLACEHOLDER $CACHELOC
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
2018-10-21 14:17:11 +00:00
rm -f $POSTCHKFILE