mirror of
https://github.com/Magisk-Modules-Repo/MagiskHidePropsConf.git
synced 2024-11-16 14:09:48 +00:00
87 lines
1.5 KiB
Bash
87 lines
1.5 KiB
Bash
#!/system/bin/sh
|
|
|
|
# MagiskHide Props Config
|
|
# By Didgeridoohan @ XDA-Developers
|
|
|
|
# Variables
|
|
LATEFILE=$IMGPATH/.core/service.d/propsconf_late
|
|
LOGFILE=/cache/propsconf.log
|
|
MAGISKLOC=/data/adb/magisk
|
|
BBPATH=$MAGISKLOC/busybox
|
|
alias cat="$BBPATH cat"
|
|
alias grep="$BBPATH grep"
|
|
alias sed="$BBPATH sed"
|
|
alias tr="$BBPATH tr"
|
|
alias reboot="/system/bin/reboot"
|
|
alias resetprop="$MAGISKLOC/magisk resetprop"
|
|
|
|
# MagiskHide props
|
|
PROPSLIST="
|
|
ro.debuggable
|
|
ro.secure
|
|
ro.build.type
|
|
ro.build.tags
|
|
ro.build.selinux
|
|
"
|
|
|
|
# Safe values
|
|
SAFELIST="
|
|
ro.debuggable=0
|
|
ro.secure=1
|
|
ro.build.type=user
|
|
ro.build.tags=release-keys
|
|
ro.build.selinux=0
|
|
"
|
|
|
|
# Logs
|
|
log_handler() {
|
|
echo "" >> $LOGFILE
|
|
echo -e "$(date +"%m-%d-%Y %H:%M:%S") - $1" >> $LOGFILE
|
|
}
|
|
|
|
# Finding file values
|
|
get_file_value() {
|
|
cat $1 | grep $2 | sed 's/.*=//'
|
|
}
|
|
|
|
# Find prop type
|
|
get_prop_type() {
|
|
echo $1 | sed 's/.*\.//'
|
|
}
|
|
|
|
# Separate prop from value
|
|
safe_prop_name() {
|
|
echo $1 | sed 's/=.*//'
|
|
}
|
|
safe_prop_value() {
|
|
echo $1 | sed 's/.*=//'
|
|
}
|
|
|
|
# Check safe values
|
|
safe_props() {
|
|
SAFE=""
|
|
if [ "$2" ]; then
|
|
for P in $SAFELIST; do
|
|
if [ "$(safe_prop_name $P)" == "$1" ]; then
|
|
if [ "$2" == "$(safe_prop_value $P)" ]; then
|
|
SAFE=1
|
|
else
|
|
SAFE=0
|
|
fi
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
}
|
|
|
|
# Updates placeholders
|
|
placeholder_update() {
|
|
FILEVALUE=$(get_file_value $1 "$2=")
|
|
log_handler "Checking for '$3' in '$1'. Current value is '$FILEVALUE'."
|
|
case $FILEVALUE in
|
|
*PLACEHOLDER*) sed -i "s@$2\=$3@$2\=$4@g" $1
|
|
log_handler "Placeholder '$3' updated to '$4' in '$1'."
|
|
;;
|
|
esac
|
|
}
|