Kill Apps from mounted AOSP

Getestet mit Android 11 und 12.

Mit diesem Skript werden alle Apps von einem gemounteten AOSP Android gelöscht.
Es wird Trebuchet und F-Droid installiert.
Voraussetzung:

  • OEM Unlock af dem Mobil
  • Recovery wie z.B. TWRP auf dem Mobil
  • Original GSI-Image von AOSP
    Als Loop eingebunden z.B. mit dem Skript: Android-GSI mounten.
#!/bin/bash

#Usage:
#sudo bash kill_AppsFromImage.sh

if [ "$DEVICES" = "" ]; then
	echo "No Devices over adb detected"
fi
echo ""
echo "Detected $DEVICES on adb"
echo ""


if [ -d "Image" ]; then
	if [ ! "$(ls -A Image)" ]; then
		echo ""
		echo "------------------------------"
		echo "Image is empty!"
		echo "Mount Image."
		echo "------------------------------"
		exit
	fi
fi

if [ "$(whoami)" != "root" ]; then
	echo  "You are not root!!!"
	echo "Usage:"
	echo "sudo bash kill_AppsFromImage.sh"
	exit
fi

echo "remove google apps? y/n"
read
if [ "${REPLY}" = "y" ]; then 
	rm -rf Image/system/app/EasterEgg ; echo "remove Easteregg";
	rm -rf Image/system/app/HTMLViewer ; echo "remove HTMLViewer";
	rm -rf Image/system/app/PrintSpooler ; echo "remove Printspooler";
	rm -rf Image/system/priv-app/AudioFX ; echo "remove AudioFX";
	rm -rf Image/system/system_ext/priv-app/AudioFX ;
	rm -rf Image/system/product/app/Etar ; echo "remove Etar";
	rm -rf Image/system/product/app/Jelly ; echo "remove Jelly";
	rm -rf Image/system/product/app/Recorder ; echo "remove Recorder";
	rm -rf Image/system/product/app/messaging ; echo "remove messaging";
	rm -rf Image/system/product/priv-app/Eleven ; echo "remove Eleven";
	rm -rf Image/system/product/priv-app/Contacts ; echo "remove Contacts";
	rm -rf Image/system/product/app/ExactCalculator ; echo "remove ExactCalculator";
	rm -rf Image/system/product/app/Camera2 ; echo "remove Camera2";
	rm -rf Image/system/product/app/QuickSearchBox; echo "remove fucking QuicksearchBox"
	rm -rf Image/system/product/app/DeskClock; echo "remove DeskClock"
	rm -rf Image/system/system_ext/priv-app/Camera2 ;
	rm -rf Image/system/product/app/Calendar ; echo "remove Calendar";
	rm -rf Image/system/product/app/Gallery2 ; echo "remove Gallery2";
	rm -rf Image/system/product/app/Browser2 ; echo "remove Browser2";
	rm -rf Image/system/system_ext/priv-app/Gallery2 ; echo "remove Gallery";
fi

echo "Install F-Droid"
adb install ./preApps/F-Droid.apk

echo ""
echo "remove 'Launcher'? y/n"
read
if [ "${REPLY}" = "y" ]; then 
	echo "Install Light Android Launcher for safety!"
	adb install ./com.github.postapczuk.lalauncher_19.apk
	adb install ./preApps/Trebuchet\ 8.1.0.22\ UNIVERSAL.apk
	rm -rf Image/system/system_ext/priv-app/Launcher3QuickStep; echo "remove Launcher3QuickStep"
fi

echo ""
echo "remove 'bootanimation'? y/n"
read
if [ "${REPLY}" = "y" ]; then  
	rm -rf Image/system/product/media/bootanimation*.zip
fi

echo "Install 'bootanimation'? y/n"
read
if [ "${REPLY}" = "y" ]; then  
	cp -f mybootanimation/bootanimation.zip Image/system/product/media/bootanimation.zip
fi


echo "fine"