mirror of
https://github.com/Magisk-Modules-Repo/MagiskHidePropsConf.git
synced 2024-11-19 14:14:33 +00:00
67 lines
2.2 KiB
Bash
67 lines
2.2 KiB
Bash
#!/system/bin/sh
|
|
# Please don't hardcode /magisk/modname/... ; instead, please use $MODPATH/...
|
|
# This will make your scripts compatible even if Magisk change its mount point in the future
|
|
MODPATH=${0%/*}
|
|
|
|
# This script will be executed in post-fs-data mode
|
|
# More info in the main Magisk thread
|
|
|
|
# MagiskHide Props Config
|
|
# By Didgeridoohan @ XDA Developers
|
|
|
|
# Variables
|
|
IMGPATH=$(dirname "$MODPATH")
|
|
COREPATH=$(dirname "$IMGPATH")
|
|
POSTLOGFILE=$CACHELOC/propsconf_postfile.log
|
|
POSTDEL=0
|
|
|
|
# Load functions
|
|
. $MODPATH/util_functions.sh
|
|
|
|
if [ ! -f "$POSTCHKFILE" ]; then
|
|
touch $POSTCHKFILE
|
|
fi
|
|
|
|
# Check for boot scripts and restore backup if deleted, or if the resetfile is present
|
|
if [ ! -f "$POSTFILE" ]; then
|
|
# Start logging
|
|
log_start
|
|
log_handler "post-fs-data boot script not found."
|
|
log_handler "Restoring post-fs-data boot script (${POSTFILE})."
|
|
cp -af $MODPATH/propsconf_post $POSTFILE >> $LOGFILE 2>&1
|
|
chmod -v 755 $POSTFILE >> $LOGFILE 2>&1
|
|
placeholder_update $POSTFILE COREPATH CORE_PLACEHOLDER "$COREPATH"
|
|
placeholder_update $POSTFILE CACHELOC CACHE_PLACEHOLDER "$CACHELOC"
|
|
# Deleting settings script to force a restore
|
|
rm -f $LATEFILE
|
|
POSTDEL=1
|
|
fi
|
|
if [ ! -f "$LATEFILE" ] || [ -f "$RESETFILE" ]; then
|
|
if [ -f "$RESETFILE" ]; then
|
|
RSTTXT="Resetting"
|
|
rm -f $RESETFILE
|
|
else
|
|
RSTTXT="Restoring"
|
|
log_handler "late_start service boot script not found."
|
|
fi
|
|
log_handler "$RSTTXT late_start service boot script (${LATEFILE})."
|
|
cp -af $MODPATH/propsconf_late $LATEFILE >> $LOGFILE 2>&1
|
|
chmod -v 755 $LATEFILE >> $LOGFILE 2>&1
|
|
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
|
|
fi
|
|
|
|
log_handler "post-fs-data.sh module script finished.\n\n===================="
|
|
|
|
# Deletes the post-fs-data control file
|
|
rm -f $POSTCHKFILE
|