android-custom/dist-std/cm-data/99-perso.sh.addon

146 lines
5.4 KiB
Bash
Executable File

#!/sbin/sh
#
# ADDOND_VERSION=3
#
# /system/addon.d/99-perso.sh
#
# we partially use the script at install, if so, $SYSTEM, $PRODUCT, $SYSTEM_EXT are defined
if [ -z $SYSTEM ]; then
. /tmp/backuptool.functions
# build missing $PRODUCT and $SYSTEM_EXT from $S. Keep them inside system, real path is computed after using the get_output_path function
# see https://github.com/LineageOS/android_vendor_lineage/commit/c63fa8441bb5ad1fc4fb68155a5e5166aa25cac0#diff-9cf467ef8562a8e65ef885b33fe3f29cee408bb251fb05aed28661f08bfe0c64
SYS=$S
PRODUCT="$S/product"
SYSTEM_EXT="$S/system_ext"
else
# install in recovery, script assume $S and $SYS defined
S=$SYSTEM
SYS=$SYSTEM
# PRODUCT AND SYSTEM_EXT defined from recovery
get_output_path() {
# In recovery we mounted all partitions in the right place, so we can rely on symlinks
echo "$1"
}
fi
# path is needed when running from recovery (at install)
export PATH="${PATH}:$S/bin:$S/xbin"
list_files() {
cat <<EOF
bin/oem-iptables-init.sh
EOF
}
case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/"$FILE"
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
done
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# mute camera
chmod 000 $(get_output_path $SYS/media/audio/ui/camera_*.ogg)
chmod 000 $(get_output_path $PRODUCT/media/audio/ui/camera_*.ogg)
chmod 000 $(get_output_path $PRODUCT/media/audio/ui/Video*.ogg)
# remove bloat
rm -rf $(get_output_path $SYS/priv-app/AudioFX)
rm -rf $(get_output_path $SYS/priv-app/CMAccount)
rm -rf $(get_output_path $SYS/priv-app/CMBugReport)
rm -rf $(get_output_path $SYS/priv-app/CMUpdater)
rm -rf $(get_output_path $SYS/priv-app/LiveLockScreenService)
rm -rf $(get_output_path $SYS/priv-app/ThemeChooser)
rm -rf $(get_output_path $SYS/priv-app/ThemesProvider)
rm -rf $(get_output_path $SYS/priv-app/Trebuchet)
rm -rf $(get_output_path $SYS/priv-app/TrebuchetQuickStep)
rm -rf $(get_output_path $SYS/app/BasicDreams)
rm -rf $(get_output_path $SYS/app/CMWallpapers)
rm -rf $(get_output_path $SYS/app/Camera2)
rm -rf $(get_output_path $SYS/app/Email)
rm -rf $(get_output_path $SYS/app/Exchange2)
rm -rf $(get_output_path $SYS/app/Galaxy4)
rm -rf $(get_output_path $SYS/app/HoloSpiralWallpaper)
rm -rf $(get_output_path $SYS/app/HexoLibre)
rm -rf $(get_output_path $SYS/app/Jelly)
rm -rf $(get_output_path $SYS/app/LiveWallpapers)
rm -rf $(get_output_path $SYS/app/LiveWallpapersPicker)
rm -rf $(get_output_path $SYS/app/LockClock)
rm -rf $(get_output_path $SYS/app/NoiseField)
rm -rf $(get_output_path $SYS/app/PhaseBeam)
rm -rf $(get_output_path $SYS/app/PhotoPhase)
rm -rf $(get_output_path $SYS/app/PhotoTable)
rm -rf $(get_output_path $SYS/app/Profiles)
rm -rf $(get_output_path $SYS/app/Stk)
rm -rf $(get_output_path $SYS/app/Terminal)
rm -rf $(get_output_path $SYS/app/TimeService)
rm -rf $(get_output_path $SYS/app/VisualizationWallpapers)
rm -rf $(get_output_path $SYS/app/WAPPushManager)
rm -rf $(get_output_path $SYS/app/WhisperPush)
# lineageos 17
rm -rf $(get_output_path $PRODUCT/priv-app/Eleven)
rm -rf $(get_output_path $PRODUCT/priv-app/Gallery2)
rm -rf $(get_output_path $PRODUCT/app/Email)
rm -rf $(get_output_path $PRODUCT/app/Exchange2)
rm -rf $(get_output_path $PRODUCT/app/Jelly)
rm -rf $(get_output_path $PRODUCT/app/PhotoTable)
rm -rf $(get_output_path $PRODUCT/app/Recorder)
# lineageos 18
rm -rf $(get_output_path $SYSTEM_EXT/priv-app/Gallery2)
# omnirom
rm -rf $(get_output_path $SYS/priv-app/Launcher3)
rm -rf $(get_output_path $SYS/priv-app/OmniBrain)
rm -rf $(get_output_path $SYS/priv-app/OmniStyle)
rm -rf $(get_output_path $SYS/priv-app/OmniSwitch)
rm -rf $(get_output_path $SYS/priv-app/MatLog)
rm -rf $(get_output_path $SYS/priv-app/OpenDelta)
rm -rf $(get_output_path $SYS/app/OmniTorch)
rm -rf $(get_output_path $SYS/app/OmniJaws)
rm -rf $(get_output_path $SYS/app/OmniClockOSS)
rm -rf $(get_output_path $SYS/app/OmniChange)
rm -rf $(get_output_path $SYS/app/Chromium)
rm -rf $(get_output_path $SYS/app/MusicFX)
rm -rf $(get_output_path $SYS/app/EggGame)
rm -rf $(get_output_path $SYS/app/EasterEgg)
rm -rf $(get_output_path $SYS/app/MonthCalendarWidget)
# omnirom sustratum stuff
rm -rf $(get_output_path $SYS/overlay)
# arrow
rm -rf $(get_output_path $SYS/priv-app/AsusCamera)
rm -rf $(get_output_path $SYS/priv-app/Camera2)
rm -rf $(get_output_path $SYS/app/Browser)
rm -rf $(get_output_path $SYS/app/Simple-Gallery)
rm -rf $(get_output_path $SYS/app/SoundPickerPrebuilt)
rm -rf $(get_output_path $SYS/vendor/app/DTVPlayer)
rm -rf $(get_output_path $SYS/vendor/app/DTVService)
# qualcomm service tha constantly monitor 3/4G and wifi
# https://www.qualcomm.com/news/onq/2013/07/02/qualcomms-cne-bringing-smarts-3g4g-wi-fi-seamless-interworking
# smart is crap
rm -rf $(get_output_path $SYS/priv-app/CNEService)
# Fix ownership/permissions
for i in $(list_files); do
f=$(get_output_path "$SYS/$i")
chown root:root $f
chmod 644 $f
chmod 755 $(dirname $f)
done
;;
esac