-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh.in
executable file
·35 lines (28 loc) · 1.23 KB
/
install.sh.in
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
#!/bin/bash
# TODO change govarnam to varnam
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
ARG1=${1:-install}
if [ "$ARG1" == "install" ]; then
if [ -f "@INSTALL_PREFIX@/bin/varnam-ibus-engine" ]; then
sudo rm "@INSTALL_PREFIX@/bin/varnam-ibus-engine"
fi
sudo cp "$SCRIPT_DIR/varnam-ibus-engine" "@INSTALL_PREFIX@/bin/varnam-ibus-engine"
sudo mkdir -p "@INSTALL_PREFIX@/share/varnam/ibus/icons"
sudo cp "$SCRIPT_DIR/icons/"*.png "@INSTALL_PREFIX@/share/varnam/ibus/icons/"
sudo cp "$SCRIPT_DIR/component/"*.xml "@IBUS_COMPONENT_INSTALL_LOC@"
msg="Installation finished. Restart ibus to add new input method."
echo "$msg"
notify-send "$msg" &> /dev/null || true
elif [ "$ARG1" == "uninstall" ]; then
sudo rm "@INSTALL_PREFIX@/bin/varnam-ibus-engine"
for XML in $(find "$SCRIPT_DIR/component/"*.xml -printf "%f\n"); do
sudo rm "@IBUS_COMPONENT_INSTALL_LOC@/$XML"
done
for ICON in $(find "$SCRIPT_DIR/icons/"*.png -printf "%f\n"); do
sudo rm "@INSTALL_PREFIX@/share/varnam/ibus/icons/$ICON"
done
sudo rmdir "@INSTALL_PREFIX@/share/varnam/ibus/icons"
sudo rmdir "@INSTALL_PREFIX@/share/varnam/ibus"
sudo rmdir "@INSTALL_PREFIX@/share/varnam"
echo "Uninstallation finished"
fi