mirror of
https://github.com/qingjian-team/qingjian.git
synced 2026-11-13 08:15:43 +00:00
Server、Fcitx5 插件与设置程序与 Linux 共用,差异按 target_os 分开:对端身份用 getpeereid、快捷键缺省走 Linux 那套、字体补 /usr/local 路径、安装脚本不用 GNU 独有的 realpath -m;mio 升到 1.2.4。
29 lines
1.7 KiB
Bash
Executable File
29 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# //! 预编译包的安装脚本(package.sh 放到包根目录的 install.sh):解开产品数据,装到用户目录;Server 由用户手动启动。
|
||
set -euo pipefail
|
||
here=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
|
||
install_prefix="$HOME/.local"
|
||
while (($#)); do
|
||
case "$1" in
|
||
--prefix) install_prefix=${2:?--prefix 需要路径}; shift 2 ;;
|
||
--help) echo '用法:install.sh [--prefix 绝对用户目录]'; exit 0 ;;
|
||
*) echo "未知参数:$1" >&2; exit 2 ;;
|
||
esac
|
||
done
|
||
[[ "$install_prefix" = /* && "$install_prefix" != / ]] || { echo '需要非根绝对安装路径' >&2; exit 2; }
|
||
missing=()
|
||
for tool in python3 fcitx5; do
|
||
command -v "$tool" >/dev/null 2>&1 || missing+=("$tool")
|
||
done
|
||
if ((${#missing[@]})); then
|
||
echo "缺少依赖:${missing[*]}" >&2
|
||
echo 'Debian / Ubuntu:sudo apt install python3 fcitx5 fcitx5-frontend-gtk3 fcitx5-frontend-gtk4 fcitx5-frontend-qt6 fcitx5-config-qt' >&2
|
||
exit 1
|
||
fi
|
||
install_prefix=$(python3 -c 'import os, sys; print(os.path.realpath(sys.argv[1]))' "$install_prefix")
|
||
mkdir -p "$here/data"
|
||
# 数据包在 macOS 上打,带 LIBARCHIVE.xattr 扩展头,GNU tar 会逐个警告
|
||
tar --warning=no-unknown-keyword -xzf "$here/target/release-data/qingjian-data.tar.gz" -C "$here"
|
||
python3 "$here/files.py" install "$install_prefix" "$here" "$here/bin/qingjian-linux-server" "$here/bin/qingjian-settings" "$here/lib/qingjian.so" false
|
||
printf '已安装。手动启动:%s/bin/qingjian-linux-server\n重启 Fcitx5,在配置工具取消“仅显示当前语言”后添加“青简”。\n设置:应用菜单里的“青简设置”,或 %s/bin/qingjian-settings\n' "$install_prefix" "$install_prefix"
|