#!/sbin/sh

set -e

# $SYSTEM set by the caller
# $PRODUCT set by the caller
# $SYSTEM_EXT set by the caller

cd "$(dirname $0)"

export PATH="${PATH}:${SYSTEM}/bin:${SYSTEM}/xbin"

# install restore script
echo "Installing restore script"
cp cm-data/99-perso-google-clean.sh.addon ${SYSTEM}/addon.d/99-perso-google-clean.sh
chown root:root ${SYSTEM}/addon.d/99-perso-google-clean.sh
chmod 755 ${SYSTEM}/addon.d/99-perso-google-clean.sh

# call restore script post to remove bloat
export SYSTEM
export PRODUCT
export SYSTEM_EXT
${SYSTEM}/addon.d/99-perso-google-clean.sh post-restore

echo "Done"
echo "Do not forget to WIPE Cache/Dalvik"

