#!/bin/sh

INPUTMETHOD="/Library/Input Methods"
PWD=`pwd`

echo "Remove old version"
rm -rf "$INPUTMETHOD/Baram.app"
echo "Copy new version"
cp -r "$PWD/Baram.app" "$INPUTMETHOD"
echo "Install launchd script"
cp "$PWD/kr.or.baram.BaramRemapper.plist" /Library/LaunchAgents
chmod +x "$INPUTMETHOD/Baram.app/Contents/SharedSupport/BaramRemapper.sh"
echo "Install Dictionaries"
mkdir -p /Library/Dictionaries/Baram
cp "$PWD/hanja.all" /Library/Dictionaries/Baram
cp "$PWD/mswin.all" /Library/Dictionaries/Baram
