mirror of
https://github.com/Magisk-Modules-Repo/MagiskHidePropsConf.git
synced 2024-10-04 21:59:45 +00:00
125 lines
4.1 KiB
Plaintext
125 lines
4.1 KiB
Plaintext
|
#!/system/bin/sh
|
||
|
|
||
|
# MagiskHide Props Config
|
||
|
# By Didgeridoohan @ XDA Developers
|
||
|
|
||
|
# This is a script file for the Magisk module "MagiskHide Props Config" By Didgeridoohan @ XDA Developers.
|
||
|
# DO NOT DELETE!
|
||
|
# Unless: If you don't have the module installed something has gone horribly wrong and this file is an orphan.
|
||
|
# In that case, feel free to delete it.
|
||
|
|
||
|
# Variables
|
||
|
IMGPATH=IMG_PLACEHOLDER
|
||
|
MODPATH=$IMGPATH/MagiskHidePropsConf
|
||
|
POSTLOGFILE=$CACHELOC/propsconf_postfile.log
|
||
|
|
||
|
# Checks if the module is installed. Deletes itself if it isn't.
|
||
|
if [ -d "$MODPATH" ]; then
|
||
|
# Checks if the module is set for removal
|
||
|
if [ -f "$MODPATH/remove" ]; then
|
||
|
echo "Module set for removal." >> $POSTLOGFILE
|
||
|
else
|
||
|
# Load functions
|
||
|
. $MODPATH/util_functions.sh
|
||
|
|
||
|
# Clears out the script control file
|
||
|
rm -f $POSTCHKFILE
|
||
|
touch $POSTCHKFILE
|
||
|
|
||
|
# Clears out the script check file
|
||
|
rm -f $RUNFILE
|
||
|
touch $RUNFILE
|
||
|
|
||
|
# Start logging
|
||
|
log_start
|
||
|
|
||
|
# Get the current values saved in propsconf_late
|
||
|
latefile_values
|
||
|
# Get default values
|
||
|
file_values
|
||
|
|
||
|
# Save default file values in propsconf_late
|
||
|
replace_fn FILEDEBUGGABLE "\"$LATEFILEDEBUGGABLE\"" "\"$FILEDEBUGGABLE\"" $LATEFILE
|
||
|
replace_fn FILESECURE "\"$LATEFILESECURE\"" "\"$FILESECURE\"" $LATEFILE
|
||
|
replace_fn FILETYPE "\"$LATEFILETYPE\"" "\"$FILETYPE\"" $LATEFILE
|
||
|
replace_fn FILETAGS "\"$LATEFILETAGS\"" "\"$FILETAGS\"" $LATEFILE
|
||
|
replace_fn FILESELINUX "\"$LATEFILESELINUX\"" "\"$FILESELINUX\"" $LATEFILE
|
||
|
replace_fn FILEFINGERPRINT "\"$LATEFILEFINGERPRINT\"" "\"$FILEFINGERPRINT\"" $LATEFILE
|
||
|
log_handler "Default values saved to $LATEFILE."
|
||
|
|
||
|
# Check if original file values are safe
|
||
|
orig_safe
|
||
|
|
||
|
# Checks for configuration file
|
||
|
config_file
|
||
|
|
||
|
# Edits prop values if set for post-fs-data
|
||
|
if [ "$(get_file_value $LATEFILE "OPTIONLATE=")" == 0 ]; then
|
||
|
echo "\n--------------------" >> $LOGFILE
|
||
|
log_handler "Setting prop values in post-fs-data mode."
|
||
|
# ---Setting/Changing fingerprint---
|
||
|
print_edit
|
||
|
# ---Setting custom props---
|
||
|
custom_edit
|
||
|
echo "\n--------------------" >> $LOGFILE
|
||
|
fi
|
||
|
|
||
|
# Edits build.prop
|
||
|
if [ "$(get_file_value $LATEFILE "FILESAFE=")" == 0 ]; then
|
||
|
log_handler "Checking for conflicting build.prop modules."
|
||
|
# Checks if any other modules are using a local copy of build.prop
|
||
|
BUILDMODULE=false
|
||
|
MODID=$(get_file_value $MODPATH/module.prop "id=")
|
||
|
for D in $(ls $IMGPATH); do
|
||
|
if [ $D != "$MODID" ]; then
|
||
|
if [ -f "$IMGPATH/$D/system/build.prop" ]; then
|
||
|
NAME=$(get_file_value $IMGPATH/$D/module.prop "name=")
|
||
|
log_handler "Conflicting build.prop editing in module '$NAME'."
|
||
|
BUILDMODULE=true
|
||
|
fi
|
||
|
fi
|
||
|
done
|
||
|
if [ "$BUILDMODULE" == "true" ]; then
|
||
|
replace_fn BUILDPROPENB 1 0 $LATEFILE
|
||
|
else
|
||
|
replace_fn BUILDPROPENB 0 1 $LATEFILE
|
||
|
fi
|
||
|
|
||
|
# Copies the stock build.prop to the module. Only if set in propsconf_late.
|
||
|
if [ "$(get_file_value $LATEFILE "BUILDPROPENB=")" == 1 ] && [ "$(get_file_value $LATEFILE "BUILDEDIT=")" == 1 ]; then
|
||
|
log_handler "Stock build.prop copied from /system."
|
||
|
cp -afv /system/build.prop $MODPATH/system/build.prop >> $LOGFILE
|
||
|
|
||
|
# Edits the module copy of build.prop
|
||
|
module_values
|
||
|
log_handler "Editing build.prop."
|
||
|
# ro.build props
|
||
|
change_prop_file "build"
|
||
|
# Fingerprint
|
||
|
if [ "$MODULEFINGERPRINT" ] && [ "$(get_file_value $LATEFILE "SETFINGERPRINT=")" == "true" ]; then
|
||
|
PRINTSTMP="$(cat /system/build.prop | grep "$FILEFINGERPRINT")"
|
||
|
for ITEM in $PRINTSTMP; do
|
||
|
replace_fn $(get_eq_left "$ITEM") $(get_eq_right "$ITEM") $MODULEFINGERPRINT $MODPATH/system/build.prop && log_handler "$(get_eq_left "$ITEM")=$MODULEFINGERPRINT"
|
||
|
done
|
||
|
fi
|
||
|
else
|
||
|
rm -f $MODPATH/system/build.prop
|
||
|
log_handler "Build.prop editing disabled."
|
||
|
fi
|
||
|
else
|
||
|
rm -f $MODPATH/system/build.prop
|
||
|
log_handler "Prop file editing disabled. All values ok."
|
||
|
fi
|
||
|
|
||
|
# Check if the late_start service log file exists.
|
||
|
if [ -f "$POSTLOGFILE" ]; then
|
||
|
log_handler "Removing post-fs-data log ($POSTLOGFILE)."
|
||
|
rm -f $POSTLOGFILE
|
||
|
fi
|
||
|
log_script_chk "post-fs-data.d finished.\n\n===================="
|
||
|
fi
|
||
|
else
|
||
|
echo "$MODPATH not found." >> $POSTLOGFILE
|
||
|
echo "Module no longer installed." >> $POSTLOGFILE
|
||
|
fi
|