1
1
#! /bin/bash
2
- set -e
2
+ set -eEuo pipefail
3
3
4
4
# This line will be replaced by the release script with the correct version
5
5
VERSION=.*
@@ -9,29 +9,65 @@ ARCHIVE="fcitx5-lekhika-${VERSION}.tar.gz"
9
9
URL=" https://github.com/${REPO} /releases/download/${VERSION} /${ARCHIVE} "
10
10
11
11
TMPDIR=$( mktemp -d)
12
- INSTALL_DIR=" /usr/lib/fcitx5"
12
+ INSTALL_DIR=" /usr/lib/x86_64-linux-gnu/ fcitx5"
13
13
DATA_DIR=" /usr/share/fcitx5/fcitx5-lekhika"
14
14
ICON_DIR=" /usr/share/icons/hicolor/48x48/apps"
15
15
16
+ # Cleanup on error
17
+ trap ' echo "β οΈ Installation failed. Cleaning up..."; rm -rf "$TMPDIR"; exit 1' ERR
18
+
16
19
echo " π₯ Downloading prebuilt engine version $VERSION ..."
17
20
cd " $TMPDIR "
18
- curl -sL " $URL " -o " $ARCHIVE "
21
+ if ! curl -sL " $URL " -o " $ARCHIVE " ; then
22
+ echo " β Failed to download $ARCHIVE from $URL "
23
+ echo " Ensure the version number is correct and the release exists."
24
+ exit 1
25
+ fi
26
+ echo " β
Archive downloaded: $ARCHIVE "
19
27
20
28
echo " π¦ Extracting archive..."
21
- tar -xzf " $ARCHIVE "
29
+ if ! tar -xzf " $ARCHIVE " ; then
30
+ echo " β Failed to extract $ARCHIVE "
31
+ echo " The archive may be corrupt or missing expected files."
32
+ exit 1
33
+ fi
34
+ echo " β
Extraction complete"
35
+
36
+ echo " π§© Installing engine binary..."
37
+ sudo install -Dm755 fcitx5lekhika.so " $INSTALL_DIR /fcitx5lekhika.so" && \
38
+ echo " β
Installed: $INSTALL_DIR /fcitx5lekhika.so"
39
+
40
+ echo " π οΈ Installing configuration files..."
41
+ sudo install -Dm644 config/fcitx5lekhika.addon.conf /usr/share/fcitx5/addon/fcitx5lekhika.conf && \
42
+ echo " β
Installed: /usr/share/fcitx5/addon/fcitx5lekhika.conf"
22
43
23
- echo " π§© Installing shared object and configuration files..."
24
- sudo install -Dm755 fcitx5lekhika.so " $INSTALL_DIR /fcitx5lekhika.so"
25
- sudo install -Dm644 config/fcitx5lekhika.addon.conf /usr/share/fcitx5/addon/fcitx5lekhika.conf
26
- sudo install -Dm644 config/fcitx5lekhika.conf /usr/share/fcitx5/inputmethod/fcitx5lekhika.conf
44
+ sudo install -Dm644 config/fcitx5lekhika.conf /usr/share/fcitx5/inputmethod/fcitx5lekhika.conf && \
45
+ echo " β
Installed: /usr/share/fcitx5/inputmethod/fcitx5lekhika.conf"
27
46
28
47
echo " ποΈ Installing transliteration data..."
29
48
sudo install -d " $DATA_DIR "
30
- sudo install -m644 data/* .toml " $DATA_DIR "
49
+ sudo install -m644 data/* .toml " $DATA_DIR " && \
50
+ echo " β
Installed TOML files to: $DATA_DIR "
31
51
32
52
echo " π¨ Installing icon..."
33
- sudo install -Dm644 icons/48x48/apps/lekhika.png " $ICON_DIR /lekhika.png"
53
+ sudo install -Dm644 icons/48x48/apps/lekhika.png " $ICON_DIR /lekhika.png" && \
54
+ echo " β
Installed icon: $ICON_DIR /lekhika.png"
34
55
35
- echo " β
Installation complete! Launch 'fcitx5-configtool' to enable fcitx5-lekhika."
56
+ echo " π¨ Updating font cache..."
57
+ sudo fc-cache -fv > /dev/null && echo " β
Font cache updated"
58
+
59
+ echo " "
60
+ echo " π Summary of installed components:"
61
+ echo " - Engine: $INSTALL_DIR /fcitx5lekhika.so"
62
+ echo " - Configs:"
63
+ echo " β’ /usr/share/fcitx5/addon/fcitx5lekhika.conf"
64
+ echo " β’ /usr/share/fcitx5/inputmethod/fcitx5lekhika.conf"
65
+ echo " - Transliteration data: $DATA_DIR "
66
+ echo " - Icon: $ICON_DIR /lekhika.png"
67
+ echo " "
68
+
69
+ echo " β
Installation complete! Use 'fcitx5-configtool' to enable fcitx5-lekhika."
36
70
37
71
rm -rf " $TMPDIR "
72
+
73
+ echo " β
Temporary files cleaned"
0 commit comments