MagiskHidePropsConf/common/service.sh

75 lines
2.0 KiB
Bash
Raw Normal View History

2019-02-02 12:37:20 +00:00
#!/system/bin/sh
# MagiskHide Props Config
# Copyright (c) 2018-2019 Didgeridoohan @ XDA Developers
# Licence: MIT
2019-03-27 10:50:00 +00:00
MODPATH=${0%/*}
2019-02-02 12:37:20 +00:00
# Load functions
. $MODPATH/util_functions.sh
2019-03-27 10:50:00 +00:00
if [ "$OPTIONBOOT" == 1 ]; then
2019-02-02 12:37:20 +00:00
until [ ! -f "$POSTCHKFILE" ]; do
sleep 1
done
fi
log_script_chk "Running service.sh module script."
# Edits prop values if set for late_start service
echo -e "\n--------------------" >> $LOGFILE 2>&1
log_handler "Editing prop values in late_start service mode."
2019-03-27 10:50:00 +00:00
if [ "$OPTIONBOOT" == 2 ]; then
2019-02-02 12:37:20 +00:00
# ---Setting/Changing fingerprint---
2019-03-27 10:50:00 +00:00
if [ "$PRINTSTAGE" == 0 ]; then
print_edit
fi
2019-02-02 12:37:20 +00:00
# ---Setting device simulation props---
2019-03-27 10:50:00 +00:00
if [ "$SIMSTAGE" == 0 ]; then
dev_sim_edit
fi
2019-02-02 12:37:20 +00:00
# ---Setting custom props---
custom_edit "CUSTOMPROPS"
fi
2019-03-27 10:50:00 +00:00
# Edit fingerprint if set for late_start service
if [ "$OPTIONBOOT" != 2 ] && [ "$PRINTSTAGE" == 2 ]; then
print_edit
fi
# Edit simulation props if set for late_start service
if [ "$OPTIONBOOT" != 2 ] && [ "$SIMSTAGE" == 2 ]; then
dev_sim_edit
fi
2019-02-02 12:37:20 +00:00
# Edit custom props set for late_start service
custom_edit "CUSTOMPROPSLATE"
# Edit MagiskHide sensitive values
if [ "$PROPEDIT" == 1 ]; then
log_handler "Changing sensitive props."
for ITEM in $PROPSLIST; do
PROP=$(get_prop_type $ITEM)
REPROP=$(echo "RE${PROP}" | tr '[:lower:]' '[:upper:]')
MODULEPROP=$(echo "MODULE${PROP}" | tr '[:lower:]' '[:upper:]')
if [ "$(eval "echo \$$REPROP")" == "true" ]; then
log_handler "Changing/writing $ITEM."
resetprop -nv $ITEM $(eval "echo \$$MODULEPROP") >> $LOGFILE 2>&1
fi
done
fi
echo -e "\n--------------------" >> $LOGFILE 2>&1
# ---Edits default.prop---
if [ "$DEFAULTEDIT" == 1 ] && [ "$FILESAFE" == 0 ]; then
log_handler "Editing default.prop."
mount -wo remount rootfs /
change_prop_file "default"
mount -ro remount rootfs /
else
log_handler "Default.prop editing disabled."
fi
# Get currently saved values
log_handler "Checking current values."
curr_values
log_script_chk "service.sh module script finished.\n\n=================="