0% found this document useful (0 votes)
11 views

update-binary

This shell script is designed for system initialization and maintenance on Android devices, including functions for writing settings, trimming partitions, and deleting unnecessary logs. It reads configuration properties from a specified file and applies them, while also managing game performance settings based on the device's manufacturer. The script includes error handling and ensures that operations are executed in the background to avoid user interruption.

Uploaded by

kp8486196
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

update-binary

This shell script is designed for system initialization and maintenance on Android devices, including functions for writing settings, trimming partitions, and deleting unnecessary logs. It reads configuration properties from a specified file and applies them, while also managing game performance settings based on the device's manufacturer. The script includes error handling and ensures that operations are executed in the background to avoid user interruption.

Uploaded by

kp8486196
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

#!

/sbin/sh

#################
# Initialization
#################

# echo before loading util_functions


ui_print() { echo "$1"; }

# Generalized function to handle system, secure, and global settings


write() {
case "$1" in
system)
settings put system "$2" "$3"
;;
secure)
settings put secure "$2" "$3"
;;
global)
settings put global "$2" "$3"
;;
*)
echo "Invalid type: $1. Use 'system', 'secure', or 'global'."
;;
esac
}

MODDIR=/sdcard/Kazu/common/
ANDROIDVERSION=$(getprop ro.build.version.release)
DEVICES=$(getprop ro.product.board)
MANUFACTURER=$(getprop ro.product.manufacturer)
API=$(getprop ro.build.version.sdk)
FPS=$(dumpsys display | grep -oE 'fps=[0-9]+' | awk -F '=' '{print $2}' | head -n
1)
GAME=/sdcard/kazu/system/etc/gamelist.txt
MIUI="grep miui"

# trimming
trim_partition () {
fstrim -v /system
sleep 0.1
fstrim -v /vendor
sleep 0.1
fstrim -v /data
sleep 0.1
fstrim -v /cache
sleep 0.1
fstrim -v /metadata
sleep 0.1
fstrim -v /odm
sleep 0.1
fstrim -v /system_ext
sleep 0.1
fstrim -v /product
sleep 0.1
sm fstrim
}

# delete trash & log by @Bias_khaliq


delete_trash_logs () {
# Clear trash on /data/data
for DIR in /data/data/*; do
if [ -d "${DIR}" ]; then
rm -rf ${DIR}/cache/*
rm -rf ${DIR}/no_backup/*
rm -rf ${DIR}/app_webview/*
rm -rf ${DIR}/code_cache/*
fi
done

# Delete Logs
rm -rf /data/{anr,log,tombstones,log_other_mode}/* \
/cache/*.{apk,tmp} \
/dev/log/* \
/data/system/{dropbox,usagestats,package_cache}/* \
/sys/kernel/debug/* \
/data/local/tmp* \
/data/dalvik-cache \
/data/media/0/{DCIM,Pictures,Music,Movies}/.thumbnails \
/data/media/0/{mtklog,MIUI/Gallery,MIUI/.debug_log,MIUI/BugReportCache} \
/data/vendor/thermal/{config,*.dump,*_history*.dump}
}

settingsproperties() {
# Path to the configuration file
CONFIG_FILE="/sdcard/kazu/common/system.prop"

# Read the configuration file line by line


while IFS= read -r line || [ -n "$line" ]; do
# Skip empty lines or comments
[ -z "$line" ] && continue
[ "${line:0:1}" = "#" ] && continue

# Parse key and value


key="${line%%=*}"
value="${line#*=}"

# Apply the property using setprop


setprop "$key" "$value"
done < "$CONFIG_FILE"
}

install_script() {
nohup sh /$MODDIR/post-fs-data.sh &>/dev/null
nohup sh /$MODDIR/service.sh &>/dev/null
nohup sh /$MODDIR/system.prop &>/dev/null
settingsproperties &>/dev/null
}

cleanup_tweak() {
game_manager() {
if [ -z "$GAME" ] || [ ! -f "$GAME" ]; then
ui_print "File GAME tidak ditemukan atau tidak ditentukan."
return 1
fi

while IFS= read -r game; do


[ -z "$game" ] && continue
cmd game mode standard "$game" set --fps "$FPS"

done < "$GAME"


}
if ( getprop | $MIUI ); then
write system POWER_BALANCED_MODE_OPEN 1
write system POWER_PERFORMANCE_MODE_OPEN 0
write system POWER_SAVE_MODE_OPEN 0
write system power_mode middle
write system POWER_SAVE_PRE_HIDE_MODE enhance
write system POWER_SAVE_PRE_SYNCHRONIZE_ENABLE 1
else
sleep 0.0
fi
am memory-factor reset
write global activity_manager_constants 0
write global activity_starts_logging_enabled 1
write secure high_priority 0
cmd display ab-logging-enable
cmd display dwb-logging-enable
cmd looper_stats reset
cmd power set-adaptive-power-saver-enabled true
cmd power set-fixed-performance-mode-enabled false
cmd thermalservice reset
settings delete system peak_refresh_rate
settings delete system user_refresh_rate
settings delete system max_refresh_rate
settings delete system min_refresh_rate
game_manager
}

You might also like