Add instalation script for rime-cantonese support.

This commit is contained in:
Sheldon Lee 2022-12-04 23:34:38 +00:00
parent 3bffa00e0a
commit 35842c95e7

View File

@ -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