Skip to content

Commit

Permalink
Easier install script
Browse files Browse the repository at this point in the history
  • Loading branch information
subins2000 committed Sep 12, 2021
1 parent d73ad91 commit f6c20da
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 37 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,23 @@ Thanks to [sarim](https://github.com/sarim/goibus) and [haunt98](https://github.

* Install and setup [IBus](https://wiki.archlinux.org/title/IBus)
* Install [GoVarnam](https://github.com/varnamproject/govarnam)
* Download a release from Releases
* Download the [latest release](https://github.com/varnamproject/govarnam-ibus/releases)
* Extract the zip file
* Run the install script in the extracted folder (need sudo):
```
sudo ./install.sh install
```
* Open the extracted folder
* Now we need to run the install script
* Double click `install.sh`, and choose "Run In Terminal"
* Or for KDE, Right click, choose "Run In Konsole"
* Or right click on folder, choose "Open In Terminal", type this and press enter:
```bash
./install.sh
```
* Type your password and press enter
* Restart ibus (no sudo)
```bash
ibus restart
```
* Go to IBus settings, add Varnam input method.
* Maybe set an easy to use switch key to switch between languages
* Maybe set an easy to use switch key to switch between languages (Default is `Meta Key (Windows Key) + Space`)

To uninstall:
```
Expand Down
56 changes: 25 additions & 31 deletions install.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,29 @@

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

if [[ "$EUID" != 0 ]]; then
echo "Run this script as root or with sudo"
exit
fi

if [ -z "$1" ]; then
echo "Specify install or uninstall"
else
if [ "$1" = "install" ]; then
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@"

echo "Installation finished. Restart ibus to add new input method."

elif [ "$1" = "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
ARG1=${1:-install}

if [ "$ARG1" == "install" ]; then
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" || 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

0 comments on commit f6c20da

Please sign in to comment.