diff --git a/.config/scripts/fcitx/install-rime-cantonese.sh b/.config/scripts/fcitx/install-rime-cantonese.sh new file mode 100755 index 0000000..eaa1637 --- /dev/null +++ b/.config/scripts/fcitx/install-rime-cantonese.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Script to install rime-cantonese based on https://github.com/rime/rime-cantonese/wiki/FreeBSD-%E5%AE%89%E8%A3%9D%E6%95%99%E7%A8%8B +rimedir="$HOME/.local/share/fcitx5/rime" +clonedir="$rimedir/repos" + +if [[ "$1" == "uninstall" ]] || [[ "$1" == "-u" ]]; then + rm -rf "$clonedir" + find "$rimedir" -type l -delete +else + mkdir -p "$rimedir/opencc" + mkdir -p "$clonedir" + + cd "$rimedir" + clonebasename="$(basename $clonedir)" + git clone https://github.com/rime/rime-cantonese.git "$clonedir/rime-cantonese" + for file in $(find "$clonebasename/rime-cantonese" -type f -name '*.yaml'); do ln -sf "$file"; done + for file in $(find "$clonebasename/rime-cantonese/opencc" -type f); do ln -sf "../$file" "opencc"; done + + git clone https://github.com/CanCLID/rime-loengfan.git "$clonedir/rime-loengfan" + for file in $(find "$clonebasename/rime-cantonese" -type f -name '*.yaml'); do ln -sf "$file"; done +fi