44 lines
1.2 KiB
Bash
44 lines
1.2 KiB
Bash
china_links=(
|
|
"environment.conf /etc/environment.d/90-omarchy-china.conf"
|
|
"cargo.toml /.cargo/config.toml"
|
|
"gemrc /etc/gemrc"
|
|
)
|
|
|
|
case ${OMARCHY_REGION:-global} in
|
|
global)
|
|
rm -f /etc/omarchy/region
|
|
sed -i 's/^LANG=zh_CN\.UTF-8$/LANG=en_US.UTF-8/' /etc/locale.conf
|
|
for link in "${china_links[@]}"; do
|
|
read -r _ target <<<"$link"
|
|
if [[ -L $target && $(readlink "$target") == */default/region/china/* ]]; then
|
|
rm "$target"
|
|
fi
|
|
done
|
|
;;
|
|
china)
|
|
mkdir -p /etc/omarchy
|
|
echo china >/etc/omarchy/region
|
|
for link in "${china_links[@]}"; do
|
|
read -r source target <<<"$link"
|
|
if [[ -e $target && ! -L $target ]]; then
|
|
echo "Refusing to replace $target, which Omarchy did not create" >&2
|
|
exit 1
|
|
fi
|
|
mkdir -p "${target%/*}"
|
|
ln -sfn "$OMARCHY_PATH/default/region/china/$source" "$target"
|
|
done
|
|
omarchy-pkg-add fcitx5-configtool fcitx5-rime librime opencc rime-ice-installer
|
|
sed -i 's/^#\(zh_CN\.UTF-8 UTF-8\)/\1/' /etc/locale.gen
|
|
locale-gen
|
|
if grep -q '^LANG=' /etc/locale.conf; then
|
|
sed -i 's/^LANG=.*/LANG=zh_CN.UTF-8/' /etc/locale.conf
|
|
else
|
|
echo LANG=zh_CN.UTF-8 >>/etc/locale.conf
|
|
fi
|
|
;;
|
|
*)
|
|
echo "Unknown OMARCHY_REGION: $OMARCHY_REGION" >&2
|
|
exit 1
|
|
;;
|
|
esac
|