#!/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 iptables script
echo "Installing font"
cp cm-data/*/*.ttf ${SYSTEM}/fonts/
chown root:root ${SYSTEM}/fonts/*.ttf
chmod 644 ${SYSTEM}/fonts/*.ttf

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

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

echo "Done"

