MagiskHidePropsConf/common/propsconf_late

169 lines
4.1 KiB
Plaintext
Raw Normal View History

2018-03-18 15:39:43 +00:00
#!/system/bin/sh
# MagiskHide Props Config
2018-04-15 22:05:33 +00:00
# By Didgeridoohan @ XDA Developers
2018-03-18 15:39:43 +00:00
# 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
2018-04-15 22:05:33 +00:00
SCRIPTV=2
2018-03-18 15:39:43 +00:00
SETTRANSF=1
# Variables
IMGPATH=IMG_PLACEHOLDER
MODPATH=$IMGPATH/MagiskHidePropsConf
2018-04-15 22:05:33 +00:00
2018-03-18 15:39:43 +00:00
FINGERPRINTENB=1
PRINTEDIT=0
BUILDPROPENB=1
FILESAFE=1
BUILDEDIT=0
DEFAULTEDIT=0
PROPCOUNT=0
PROPEDIT=0
2018-04-15 22:05:33 +00:00
CUSTOMEDIT=0
2018-03-18 15:39:43 +00:00
REBOOTCHK=0
2018-04-15 22:05:33 +00:00
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
}
2018-03-18 15:39:43 +00:00
# Checks if the module is installed. Deletes itself if it isn't.
2018-04-15 22:05:33 +00:00
if [ -d "$MODPATH" ]; then
2018-03-18 15:39:43 +00:00
# Checks if the module is set for removal
2018-04-15 22:05:33 +00:00
if [ -f "$MODPATH/remove" ]; then
# Cleanup
cleanup
2018-03-18 15:39:43 +00:00
else
# Load functions
. $MODPATH/util_functions.sh
log_handler "Running boot script."
2018-04-15 22:05:33 +00:00
if [ -f "$MODPATH/disable" ]; then
log_handler "Module disabled."
else
2018-03-18 15:39:43 +00:00
# ---Original values---
# default.prop
2018-04-15 22:05:33 +00:00
FILEDEBUGGABLE=""
FILESECURE=""
2018-03-18 15:39:43 +00:00
# build.prop
2018-04-15 22:05:33 +00:00
FILETYPE=""
FILETAGS=""
FILESELINUX=""
2018-03-18 15:39:43 +00:00
# Prop values
2018-04-15 22:05:33 +00:00
ORIGDEBUGGABLE=""
ORIGSECURE=""
ORIGTYPE=""
ORIGTAGS=""
ORIGSELINUX=""
ORIGFINGERPRINT=""
2018-03-18 15:39:43 +00:00
# ---Module values---
2018-04-15 22:05:33 +00:00
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
2018-03-18 15:39:43 +00:00
# ---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
2018-04-15 22:05:33 +00:00
log_handler "Changing fingerprint."
resetprop -v ro.build.fingerprint $MODULEFINGERPRINT 2>> $LOGFILE
resetprop -v ro.bootimage.build.fingerprint $MODULEFINGERPRINT 2>> $LOGFILE
2018-03-18 15:39:43 +00:00
fi
2018-04-15 22:05:33 +00:00
# ---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---
2018-03-18 15:39:43 +00:00
if [ "$DEFAULTEDIT" == 1 ] && [ "$FILESAFE" == 0 ]; then
log_handler "Default.prop editing enabled."
log_handler "Editing default.prop."
mount -wo remount rootfs /
if [ "$MODULEDEBUGGABLE" ]; then
2018-04-15 22:05:33 +00:00
SEDDEBUGGABLE="$MODULEDEBUGGABLE"
2018-03-18 15:39:43 +00:00
else
2018-04-15 22:05:33 +00:00
SEDDEBUGGABLE="0"
2018-03-18 15:39:43 +00:00
fi
if [ "$SETDEBUGGABLE" == "true" ]; then
sed -i "s/ro.debuggable=$FILEDEBUGGABLE/ro.debuggable=$SEDDEBUGGABLE/" /default.prop && log_handler "ro.debuggable"
fi
if [ "$MODULESECURE" ]; then
2018-04-15 22:05:33 +00:00
SEDSECURE="$MODULESECURE"
2018-03-18 15:39:43 +00:00
else
2018-04-15 22:05:33 +00:00
SEDSECURE="1"
2018-03-18 15:39:43 +00:00
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
2018-04-15 22:05:33 +00:00
# Cleanup
cleanup
2018-03-18 15:39:43 +00:00
fi