Skip to content

Commit

Permalink
Add install & uninstall scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
AXeL-dev committed Apr 18, 2020
1 parent 3981f7c commit 45f6007
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 18 deletions.
30 changes: 13 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,32 @@ A bot is a software that emulates a real game client in order to automate some t

## Installation

First, you need to install some dependencies using one of the following commands:
First, clone this repository using git or just [download](https://github.com/AXeL-dev/Dindo-Bot/archive/master.zip) & unzip it:

**Debian & derivatives:**
```bash
sudo apt install git python-gi gir1.2-gtk-3.0 gir1.2-wnck-3.0 python-xlib python-pil scrot
```

**Arch Linux & derivatives:**
```bash
sudo pacman -S git python-gobject gtk3 libwnck3 python-xlib python-pillow scrot
```
<details>
<summary>git installation</summary>

```bash
sudo apt install git
```
</details>

Then, clone this repository using git or just [download](https://github.com/AXeL-dev/Dindo-Bot/archive/master.zip) & unzip it:
```bash
git clone https://github.com/AXeL-dev/Dindo-Bot.git
```

To run the bot open a terminal & type:
Then, open a terminal & launch the installation script as below:
```bash
cd /path/to/bot
python bot.py
chmod +x install.sh
sudo ./install.sh
```

You could even run the bot in developer mode (which brings some additional features):
Once installed, you can run the bot from your app launcher or using the command below:
```bash
python bot.py --dev
dindo-bot
```

**Note:** the [desktop file](dindo-bot.desktop) can also be used to run the bot with a double-click.

## Tutorials

- [Farming tutorial](https://www.youtube.com/watch?v=obGDT9_AXvk)
Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions dindo-bot-dev.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Dindo Bot (dev mode)
GenericName=Dindo Bot (dev mode)
Comment=Farming bot for Dofus game
#Icon=icons/logo.png
Icon=/usr/share/icons/hicolor/128x128/apps/dindo-bot.png
#Exec=bot.py
Exec=sh -e -c "chmod +x \\"\\$(dirname \\"\\$0\\")/bot.py\\" && exec \\"\\$(dirname \\"\\$0\\")/bot.py\\" --dev" %k
Terminal=false
StartupNotify=false
Categories=Application;Game
2 changes: 1 addition & 1 deletion dindo-bot.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Name=Dindo Bot
GenericName=Dindo Bot
Comment=Farming bot for Dofus game
#Icon=icons/logo.png
Icon=applications-games
Icon=/usr/share/icons/hicolor/128x128/apps/dindo-bot.png
#Exec=bot.py
Exec=sh -e -c "chmod +x \\"\\$(dirname \\"\\$0\\")/bot.py\\" && exec \\"\\$(dirname \\"\\$0\\")/bot.py\\"" %k
Terminal=false
Expand Down
47 changes: 47 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# root detection
if [ "$(id -u)" != "0" ]; then
echo “This script must be run as root” 2>&1
exit 1
fi

# run uninstall script first
sh uninstall.sh

# package manager detection
APT_CMD=$(which apt)
PACMAN_CMD=$(which pacman)

# install dependencies
if [[ ! -z $APT_CMD ]]; then
sudo apt -y install python-gi gir1.2-gtk-3.0 gir1.2-wnck-3.0 python-xlib python3-xlib python-pil python3-pil scrot
elif [[ ! -z $PACMAN_CMD ]]; then
sudo pacman -S python-gobject gtk3 libwnck3 python-xlib python-pillow scrot
else
echo "error can't install dependencies"
exit 1
fi

# get script path
SCRIPT_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

# create symlink
ln -s $SCRIPT_PATH/bot.py /usr/local/bin/dindo-bot
chmod 755 /usr/local/bin/dindo-bot

# copy & update desktop files
cp dindo-bot.desktop /usr/share/applications/dindo-bot.desktop
sed -i 's/^Exec=.*$/Exec=dindo-bot/g' /usr/share/applications/dindo-bot.desktop
chmod 755 /usr/share/applications/dindo-bot.desktop

cp dindo-bot-dev.desktop /usr/share/applications/dindo-bot-dev.desktop
sed -i 's/^Exec=.*$/Exec=dindo-bot --dev/g' /usr/share/applications/dindo-bot-dev.desktop
chmod 755 /usr/share/applications/dindo-bot-dev.desktop

# copy icons
cp icons/logo.png /usr/share/icons/hicolor/128x128/apps/dindo-bot.png
chmod 644 /usr/share/icons/hicolor/128x128/apps/dindo-bot.png

# refresh icons cache
gtk-update-icon-cache
16 changes: 16 additions & 0 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

if [ "$(id -u)" != "0" ]; then
echo “This script must be run as root” 2>&1
exit 1
fi

# remove symlink
rm -f /usr/local/bin/dindo-bot

# remove desktop files
rm -f /usr/share/applications/dindo-bot.desktop
rm -f /usr/share/applications/dindo-bot-dev.desktop

# remove icons
rm -f /usr/share/icons/hicolor/128x128/apps/dindo-bot.png

0 comments on commit 45f6007

Please sign in to comment.