From 35842c95e7405301b0f4199b50f80a60f59947db Mon Sep 17 00:00:00 2001 From: Sheldon Lee Date: Sun, 4 Dec 2022 23:34:38 +0000 Subject: [PATCH] Add instalation script for rime-cantonese support. --- .../scripts/fcitx/install-rime-cantonese.sh | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 .config/scripts/fcitx/install-rime-cantonese.sh 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