-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·46 lines (39 loc) · 952 Bytes
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/zsh
set -xeu
date 1>&2
setopt NULL_GLOB
user="$1"
Resources="$2"
ARCH="$(uname -m)"
INSTALL_DIR="/Library/Input Methods"
APP_DIR="$INSTALL_DIR/Fcitx5.app"
DATA_DIR="/Users/$user/Library/fcitx5"
CONFIG_DIR="/Users/$user/.config/fcitx5"
cd "$Resources"
mkdir -p "$INSTALL_DIR"
rm -rf "$APP_DIR/Contents/*"
tar xjvf "Fcitx5-$ARCH.tar.bz2" -C "$INSTALL_DIR"
xattr -dr com.apple.quarantine "$APP_DIR"
codesign --force --sign - --deep "$APP_DIR"
mkdir -p "$DATA_DIR"
for plugin_path in plugins/*-{$ARCH,any}.tar.bz2; do
tar xjvf "$plugin_path" -C "$DATA_DIR"
done
chown -R "$user" "$DATA_DIR"
mkdir -p "$CONFIG_DIR"
if [[ -d config ]]; then
pushd config
for file_name in *; do
if [[ ! -f "$CONFIG_DIR/$file_name" ]]; then
cp "$file_name" "$CONFIG_DIR"
fi
done
popd
fi
chown -R "$user" "$CONFIG_DIR"
if killall Fcitx5; then
echo killed previously-installed Fctix5
exit 0
fi
./register_im
su -m "$user" -c ./enable_im