MinMicroG/conf/microgcleanup.txt
FriendlyNeighborhoodShane 98d7881631 Run shellcheck on confs
2020-07-08 13:48:32 +05:30

53 lines
2.3 KiB
Plaintext

# A little bit of copied methods to try to prevent MicroG dirty flash problems
# For MinMicroG (FriendlyNeighborhoodShane)
microg_cleanup() {
if echo "$stuff" | grep -q "MicroG"; then
ui_print " ";
ui_print "Doing MicroG preparations...";
if [ "$bootmode" != "true" ]; then
# Kanged from NanoDroid
# Thanks Setialpha
cleanup_folders="BlankStore GmsCore GmsCore_update GmsCoreSetupPrebuilt GoogleServicesFramework GsfProxy Phonesky PlayStore PrebuiltGmsCorePi PrebuiltGmsCorePix PrebuiltGmsCore Vending";
cleanup_packages="com.android.vending com.google.android.feedback com.google.android.gms com.google.android.gsf com.google.android.gsf.login com.mgoogle.android.gms";
for app in $cleanup_folders; do
for file in /data/dalvik-cache/*/system"@priv-app@$app"[@\.]*@classes.* /data/dalvik-cache/*/system"@app@$app"[@\.]*@classes.*; do
[ -e "$file" ] && { log "PREPPER: Removing $file"; rm -rf "$file"; }
done;
done;
if [ ! -f "$root/system/etc/.mmg" ]; then
log "Doing the clean install treatment";
for app in $cleanup_packages; do
for file in "/data/data/$app" "/data/user/*/$app" "/data/user_de/*/$app" "/data/app/$app"-* "/mnt/asec/$app"-* "/data/media/0/Android/data/$app"; do
[ -e "$file" ] && { log "PREPPER: Removing $file"; rm -rf "$file"; }
done;
done;
for file in /data/system/users/*/runtime-permissions.xml; do
[ -e "$file" ] && { log "PREPPER: Removing $file"; rm -rf "$file"; }
done;
if [ -f /data/system/packages.list ]; then
for app in $cleanup_packages; do
if grep -q "$app" "/data/system/packages.list"; then
log "PREPPER: de-registering app: $app";
sed -i "s/.*${app}.*//g" /data/system/packages.list;
fi;
done;
else
log "PREPPER: This is a clean flash";
fi;
if [ "$(which sqlite3)" ]; then
find /data/system* -type f -name "accounts*db" 2>/dev/null | while read -r database; do
log "PREPPER: deleting Google Accounts from $database";
sqlite3 "$database" "DELETE FROM accounts WHERE type='com.google';";
done
else
log "PREPPER: sqlite3 not found";
fi;
fi;
touch "$root/system/etc/.mmg";
fi;
fi;
}