Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
truefriend-cz committed Oct 22, 2020
1 parent 6e89205 commit c7db759
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Boot/01_Init
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/system/bin/sh

mount -o remount,rw /cache
mount -o remount,rw /data
mount -o remount,rw /sdcard
mount -o remount,rw /system

#

rm -f /sdcard/0_initd.txt;
rm -f /sdcard/0_Packages.txt;

# Instead of disabling fsync remount with higher fsync interval
mount -o remount,rw,commit=300 /data


echo "Init - OK" >> /sdcard/0_initd.txt

# Done
133 changes: 133 additions & 0 deletions Boot/05_Clean
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
#!/system/bin/sh

mount -o remount,rw /cache
mount -o remount,rw /data
mount -o remount,rw /sdcard
mount -o remount,rw /system

#

# Disable / stop system logging (logd) daemon;
stop logd

# Clean shit
rm -Rf /cache/*.apk;
rm -f /data/*.log;
rm -f /data/*.txt;
rm -f /data/anr/*;
rm -f /data/backup/pending/*.tmp;
rm -f /data/cache/*.*;
rm -f /data/data/*.log;
rm -f /data/data/*.txt;
rm -f /data/log/*.log;
rm -f /data/log/*.txt;
rm -f /data/local/*.apk;
rm -f /data/local/*.log;
rm -f /data/local/*.txt;
rm -f /data/local/tmp/*;
rm -f /data/last_alog/*.log;
rm -f /data/last_alog/*.txt;
rm -f /data/last_kmsg/*.log;
rm -f /data/last_kmsg/*.txt;
rm -f /data/mlog/*;
rm -f /data/system/*.log;
rm -f /data/system/*.txt;
rm -f /data/system/dropbox/*;
rm -Rf /data/system/usagestats/*;
rm -f /data/system/shared_prefs/*;
rm -f /data/tombstones/*;
rm -Rf /sdcard/LOST.DIR;
rm -Rf /sdcard/found000;
rm -Rf /sdcard/LazyList;
rm -Rf /sdcard/albumthumbs;
rm -Rf /sdcard/kunlun;
rm -Rf /sdcard/.CacheOfEUI;
rm -Rf /sdcard/.bstats;
rm -Rf /sdcard/.taobao;
rm -Rf /sdcard/Backucup;
rm -Rf /sdcard/MIUI/debug_log;
rm -Rf /sdcard/wlan_logs;
rm -Rf /sdcard/ramdump;
rm -Rf /sdcard/UnityAdsVideoCache;
rm -f /sdcard/*.log;
rm -f /sdcard/*.CHK;

# Cleaning Apps Cache
# Disabled:
# /data/dalvik-cache
# /system/app
# /system/priv-app
folders="
/data/data
/cache
/storage/emulated/0
"

for dirname in $folders
do
for path in `find $dirname -type d -iname "*cache*"`
do
rm -Rf -f $path/*;
done
done

# File list to cleanup
# Disabled:
# /data/dalvik-cache
filelist="
/cache
/data/anr
/data/backup
/data/cache
/data/lineageos_updates
/data/local/tmp
/data/lost+found
/data/ota
/data/ota_package
/data/resource-cache
/data/system/batterystats.bin
/data/system/dropbox
/data/system/graphicsstats
/data/system/install_sessions.xml
/data/system/last-fstrim
/data/system/package_cache
/data/system/procstats
/data/system/syncmanager-log
/data/system/uiderrors.txt
/data/system/usagestats/0/monthly
/data/system/usagestats/0/weekly
/data/system/usagestats/0/yearly
/data/system/usagestats/daily
/data/tombstones
/sdcard/DCIM/.thumbnails
/system/bin/bootanimation
/system/media/bootanimation.zip
"

for filename in $filelist
do
if [ -d $filename ]; then
chmod -R 777 $filename
rm -Rf -f $filename/*
fi
if [ -f $filename ]; then
chmod 777 $filename
rm -f $filename
fi
done

# Remove bak, log and tmp files
find /data -iname "*.bak" -type f -exec rm -f {} +
find /data -iname "*.log" -type f -exec rm -f {} +
find /data -iname "*.tmp" -type f -exec rm -f {} +
#find /data -iname "*.odex" -type f -exec rm -f {} +
#find /data -iname "*.vdex" -type f -exec rm -f {} +

find /system -iname "*.bak" -type f -exec rm -f {} +
find /system -iname "*.log" -type f -exec rm -f {} +
find /system -iname "*.tmp" -type f -exec rm -f {} +


echo "Clean - OK" >> /sdcard/0_initd.txt

# Done
24 changes: 24 additions & 0 deletions Boot/06_ForceStop
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/system/bin/sh

mount -o remount,rw /cache
mount -o remount,rw /data
mount -o remount,rw /sdcard
mount -o remount,rw /system

#

# 1. Get packages
#pm list packages -3 | awk -F ":" '{print "grep -v \""$2"\" |"}' | xargs echo > /sdcard/0_Packages.txt
#echo '\r' >> /sdcard/0_Packages.txt
#pm list packages -3 | awk -F ":" '{print $2}' | xargs echo | tr ' ' '\n' >> /sdcard/0_Packages.txt

# 1. Force Stop packages
for package in `pm list packages -3 |grep -v "com.touchtype.swiftkey"|grep -v "com.teslacoilsw.launcher"|grep -v "com.lonelycatgames.Xplore"|grep -v "com.topjohnwu.magisk"|grep -v "cz.covid19cz.erouska"|grep -v "com.csipsimple.plugins.codecs.pack1"|grep -v "com.ryosoftware.initd"|grep -v "com.csipsimple.plugins.codecs.g729"|grep -v "com.csipsimple"| awk -F ":" '{print $2}'`
do
am force-stop $package
done


echo "Force Stop - OK" >> /sdcard/0_initd.txt

# Done
36 changes: 36 additions & 0 deletions Boot/07_Tweaks
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/system/bin/sh

mount -o remount,rw /cache
mount -o remount,rw /data
mount -o remount,rw /sdcard
mount -o remount,rw /system

#

# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 "$i" "VACUUM;" 2>/dev/null
sqlite3 "$i" "REINDEX;" 2>/dev/null
done

for i in $(find /sdcard -iname "*.db" -type f)
do
sqlite3 "$i" "VACUUM;" 2>/dev/null
sqlite3 "$i" "REINDEX;" 2>/dev/null
done

# Disable Doze
dumpsys deviceidle disable

# Defrag
fstrim -v /data;
fstrim -v /system;
fstrim -v /cache;
fstrim -v /vendor;
fstrim -v /product;


echo "Tweaks - OK" >> /sdcard/0_initd.txt

# Done

0 comments on commit c7db759

Please sign in to comment.