diff options
Diffstat (limited to 'scripts/props.sh')
| -rwxr-xr-x | scripts/props.sh | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/scripts/props.sh b/scripts/props.sh new file mode 100755 index 0000000..fd1bd0c --- /dev/null +++ b/scripts/props.sh @@ -0,0 +1,115 @@ +#!/bin/bash + +if [ "$#" -ne 1 ]; then + echo "[x] Incorrect arguments!" + echo " Using: $0 <BASE_DIR>" + exit 1 +fi + +source .config + +BASE_DIR=$1 +BUILD_PROP="${BASE_DIR}/system_a/system/build.prop" + +ADD_PROP_LIST=( + "persist.camera.HAL3.enabled=1" + + "debug.hwui.render_dirty_regions=false" + "debug.sf.skip_dirty_regions=1" + "debug.sf.nobootanimation=1" + "ro.max.fling_velocity=18000" + "ro.min.fling_velocity=12000" + "debug.sf.hw=1" + + "ro.telephony.call_ring.delay=0" + "ro.media.enc.jpeg.quality=100" + "ro.audio.silent=0" + + # Skip SetupWizard (required without GAPPS) + "ro.setupwizard.enable_bypass=1" + "ro.setupwizard.enterprise_mode=0" + "ro.setupwizard.mode=DISABLED" + "ro.setupwizard.network_required=false" + "ro.setupwizard.wifi_required=false" +) + +EDIT_PROP_LIST=( + "persist.sys.zram_wb_enabled=false" + "persist.sys.zram_wb_ai_enabled=false" + "ro.zygote.preload.enable=1" + "ro.moto.general.feature.ota=false" + "ro.moto.general.clientid=false" + "ro.moto.general.motosecure=false" + "ro.moto.general.motofeedback=false" + "ro.moto.general.motohelp=false" + "ro.moto.general.time_weather=false" + "ro.moto.general.feature.ironsource=false" +) + +append_prop() { + if ! grep -q "${1}" "$BUILD_PROP"; then + echo -e "\t[+] Adding prop '${1}' to '${2}'" + sed -i "$ a ${1}" "$BUILD_PROP" + else + echo -e "\t[i] Prop '${1}' is already present in '${2}'" + fi +} + +remove_prop() { + if grep -q "^${1}" "${2}"; then + echo -e "\t[-] Removing prop '${1}' from '${2}'" + sed -i "/^${1}/d" "${2}" + else + echo -e "\t[i] Prop '${1}' is not present in '${2}'" + fi +} + +edit_prop() { + prop_name="${1%%=*}" + new_value="${1#*=}" + if grep -q "${prop_name}=" "${2}"; then + current_value=$(grep "^${prop_name}=" "${2}" | cut -d'=' -f2) + if [ "$current_value" != "$new_value" ]; then + echo "[=] Editing prop '${prop_name}' in '${2}'" + sed -i "s/${prop_name}=.*/${prop_name}=${new_value}/" "${2}" + else + echo "[*] Prop '${prop_name}' already has the desired value (${new_value}) in '${2}'" + fi + else + echo "[i] Prop '${prop_name}' is not present in '${2}'" + fi +} + + +if [[ $ENABLE_INSECURE_ADB == 1 ]]; then + ADD_PROP_LIST+=( + "persist.adb.notify=0" + "persist.service.adb.enable=1" + "persist.service.debuggable=1" + "persist.sys.usb.config=mtp,adb" + "ro.adb.secure=0" + "ro.debuggable=1" + "ro.force.debuggable=1" + "ro.control_privapp_permissions=log" + ) +fi + +if [[ $DISABLE_MOTO_HELLO_UI == 1 ]]; then + EDIT_PROP_LIST+=("ro.moto.general.feature.enable_systemui_hello_ui=false") +else + if [[ $DISABLE_MOTO_HELLO_UI_BLUR == 1 ]]; then + ADD_PROP_LIST+=( + "ro.sf.blurs_are_expensive=1" + "ro.surface_flinger.supports_background_blur=0" + "persist.sysui.disableBlur=true" + ) + fi +fi + +for prop in "${EDIT_PROP_LIST[@]}"; do + edit_prop "$prop" "${BUILD_PROP}" +done + +for prop in "${ADD_PROP_LIST[@]}"; do + append_prop "$prop" "${BUILD_PROP}" +done |
