mirror of
https://github.com/Magisk-Modules-Repo/MagiskHidePropsConf.git
synced 2024-11-19 14:14:33 +00:00
169 lines
4.1 KiB
Bash
169 lines
4.1 KiB
Bash
#!/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.
|
|
|
|
# Script version
|
|
SCRIPTV=2
|
|
SETTRANSF=1
|
|
|
|
# Variables
|
|
IMGPATH=IMG_PLACEHOLDER
|
|
MODPATH=$IMGPATH/MagiskHidePropsConf
|
|
|
|
FINGERPRINTENB=1
|
|
PRINTEDIT=0
|
|
BUILDPROPENB=1
|
|
FILESAFE=1
|
|
BUILDEDIT=0
|
|
DEFAULTEDIT=0
|
|
PROPCOUNT=0
|
|
PROPEDIT=0
|
|
CUSTOMEDIT=0
|
|
REBOOTCHK=0
|
|
OPTIONCOLOUR=1
|
|
OPTIONWEB=1
|
|
|
|
# Function to clean up different files after the module has been uninstalled
|
|
cleanup() {
|
|
CACHELOC=CACHE_PLACEHOLDER
|
|
rm -f $CACHELOC/propsconf.log
|
|
rm -f $CACHELOC/propsconf_last.log
|
|
rm -f $CACHELOC/propsconf_conf
|
|
rm -f $CACHELOC/reset_mhpc
|
|
# Suicide.
|
|
rm $0
|
|
}
|
|
|
|
# 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
|
|
# Cleanup
|
|
cleanup
|
|
else
|
|
# Load functions
|
|
. $MODPATH/util_functions.sh
|
|
|
|
log_handler "Running boot script."
|
|
|
|
if [ -f "$MODPATH/disable" ]; then
|
|
log_handler "Module disabled."
|
|
else
|
|
# ---Original values---
|
|
# default.prop
|
|
FILEDEBUGGABLE=""
|
|
FILESECURE=""
|
|
# build.prop
|
|
FILETYPE=""
|
|
FILETAGS=""
|
|
FILESELINUX=""
|
|
# Prop values
|
|
ORIGDEBUGGABLE=""
|
|
ORIGSECURE=""
|
|
ORIGTYPE=""
|
|
ORIGTAGS=""
|
|
ORIGSELINUX=""
|
|
ORIGFINGERPRINT=""
|
|
|
|
# ---Module values---
|
|
MODULEDEBUGGABLE=""
|
|
MODULESECURE=""
|
|
MODULETYPE=""
|
|
MODULETAGS=""
|
|
MODULESELINUX=""
|
|
MODULEFINGERPRINT=""
|
|
|
|
# ---Custom prop values---
|
|
CUSTOMPROPS=""
|
|
|
|
# ---MagiskHide sensitive props---
|
|
REDEBUGGABLE=false
|
|
RESECURE=false
|
|
RETYPE=false
|
|
RETAGS=false
|
|
RESELINUX=false
|
|
|
|
# ---Editing default.prop---
|
|
SETDEBUGGABLE=false
|
|
SETSECURE=false
|
|
|
|
# ---Editing build.prop---
|
|
SETTYPE=false
|
|
SETTAGS=false
|
|
SETSELINUX=false
|
|
|
|
# ---Setting/Changing props---
|
|
# Set/change MagiskHide sensitive props
|
|
if [ "$PROPEDIT" == 1 ]; then
|
|
log_handler "Changing sensitive props."
|
|
if [ "$REDEBUGGABLE" == "true" ]; then
|
|
resetprop -v ro.debuggable $MODULEDEBUGGABLE 2>> $LOGFILE
|
|
fi
|
|
if [ "$RESECURE" == "true" ]; then
|
|
resetprop -v ro.secure $MODULESECURE 2>> $LOGFILE
|
|
fi
|
|
if [ "$RETYPE" == "true" ]; then
|
|
resetprop -v ro.build.type $MODULETYPE 2>> $LOGFILE
|
|
fi
|
|
if [ "$RETAGS" == "true" ]; then
|
|
resetprop -v ro.build.tags $MODULETAGS 2>> $LOGFILE
|
|
fi
|
|
if [ "$RESELINUX" == "true" ]; then
|
|
resetprop -v ro.build.selinux $MODULESELINUX 2>> $LOGFILE
|
|
fi
|
|
fi
|
|
# Set new fingerprint
|
|
if [ "$FINGERPRINTENB" == 1 ] && [ "$PRINTEDIT" == 1 ]; then
|
|
log_handler "Changing fingerprint."
|
|
resetprop -v ro.build.fingerprint $MODULEFINGERPRINT 2>> $LOGFILE
|
|
resetprop -v ro.bootimage.build.fingerprint $MODULEFINGERPRINT 2>> $LOGFILE
|
|
fi
|
|
|
|
# ---Setting custom props---
|
|
if [ "$CUSTOMEDIT" == 1 ]; then
|
|
log_handler "Writing custom props."
|
|
for ITEM in $CUSTOMPROPS; do
|
|
log_handler "Writing $(get_eq_left $ITEM)."
|
|
resetprop -v $(get_eq_left $ITEM) $(get_eq_right $ITEM) 2>> $LOGFILE
|
|
done
|
|
fi
|
|
|
|
# ---Edits default.prop---
|
|
if [ "$DEFAULTEDIT" == 1 ] && [ "$FILESAFE" == 0 ]; then
|
|
log_handler "Default.prop editing enabled."
|
|
log_handler "Editing default.prop."
|
|
mount -wo remount rootfs /
|
|
if [ "$MODULEDEBUGGABLE" ]; then
|
|
SEDDEBUGGABLE="$MODULEDEBUGGABLE"
|
|
else
|
|
SEDDEBUGGABLE="0"
|
|
fi
|
|
if [ "$SETDEBUGGABLE" == "true" ]; then
|
|
sed -i "s/ro.debuggable=$FILEDEBUGGABLE/ro.debuggable=$SEDDEBUGGABLE/" /default.prop && log_handler "ro.debuggable"
|
|
fi
|
|
if [ "$MODULESECURE" ]; then
|
|
SEDSECURE="$MODULESECURE"
|
|
else
|
|
SEDSECURE="1"
|
|
fi
|
|
if [ "$SETSECURE" == "true" ]; then
|
|
sed -i "s/ro.secure=$FILESECURE/ro.secure=$SEDSECURE/" /default.prop && log_handler "ro.secure"
|
|
fi
|
|
mount -ro remount rootfs /
|
|
else
|
|
log_handler "Default.prop editing disabled."
|
|
fi
|
|
fi
|
|
log_handler "Boot script finished.\n\n=================="
|
|
fi
|
|
else
|
|
# Cleanup
|
|
cleanup
|
|
fi
|