Much easier installation
This commit is contained in:
parent
0277d3bab7
commit
6ae038e6b7
20
README.md
20
README.md
@ -468,23 +468,15 @@ Installation
|
|||||||
------------
|
------------
|
||||||
```bash
|
```bash
|
||||||
# Tested on Ubuntu 14.04, for other OSs check out https://github.com/vysheng/tg#installation
|
# Tested on Ubuntu 14.04, for other OSs check out https://github.com/vysheng/tg#installation
|
||||||
$ sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev unzip git
|
sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev make unzip git
|
||||||
$ cd /tmp
|
|
||||||
$ wget http://luarocks.org/releases/luarocks-2.2.0.tar.gz
|
|
||||||
$ tar -xzvf luarocks-2.2.0.tar.gz
|
|
||||||
$ cd luarocks-2.2.0/
|
|
||||||
$ ./configure
|
|
||||||
$ make && sudo make install
|
|
||||||
$ sudo luarocks install oauth
|
|
||||||
$ sudo luarocks install luasocket
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# After those dependencies, lets install the bot
|
# After those dependencies, lets install the bot
|
||||||
$ cd $HOME
|
cd $HOME
|
||||||
$ git clone https://github.com/yagop/telegram-bot.git --recursive
|
git clone https://github.com/yagop/telegram-bot.git
|
||||||
$ cd telegram-bot/tg
|
./launch.sh install
|
||||||
$ ./configure && make && cd ..
|
./launch.sh # Will ask you for a phone number & confirmation code.
|
||||||
$ ./launch.sh # Will ask you for a phone number & confirmation code.
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Enable more [`plugins`](https://github.com/yagop/telegram-bot/tree/master/plugins)
|
Enable more [`plugins`](https://github.com/yagop/telegram-bot/tree/master/plugins)
|
||||||
|
89
launch.sh
89
launch.sh
@ -1,17 +1,78 @@
|
|||||||
#!/bin/sh
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
cd "$(dirname "$0")"
|
THIS_DIR=$(cd $(dirname $0); pwd)
|
||||||
|
|
||||||
if [ ! -f ./tg/telegram.h ]; then
|
update() {
|
||||||
echo "Download tg first:"
|
git pull
|
||||||
echo "git submodule update --init --recursive"
|
git submodule update --init --recursive
|
||||||
exit
|
install_rocks
|
||||||
|
}
|
||||||
|
|
||||||
|
# Will install luarocks on THIS_DIR/.luarocks
|
||||||
|
install_luarocks() {
|
||||||
|
git clone https://github.com/keplerproject/luarocks.git
|
||||||
|
cd luarocks
|
||||||
|
git checkout tags/v2.2.1 # Current stable
|
||||||
|
|
||||||
|
PREFIX="$THIS_DIR/.luarocks"
|
||||||
|
|
||||||
|
./configure --prefix=$PREFIX --sysconfdir=$PREFIX/luarocks --force-config
|
||||||
|
|
||||||
|
RET=$?; if [ $RET -ne 0 ];
|
||||||
|
then echo "Error. Exiting."; exit $RET;
|
||||||
|
fi
|
||||||
|
|
||||||
|
make build && make install
|
||||||
|
RET=$?; if [ $RET -ne 0 ];
|
||||||
|
then echo "Error. Exiting.";exit $RET;
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
rm -rf luarocks
|
||||||
|
}
|
||||||
|
|
||||||
|
install_rocks() {
|
||||||
|
./.luarocks/bin/luarocks install luasocket
|
||||||
|
RET=$?; if [ $RET -ne 0 ];
|
||||||
|
then echo "Error. Exiting."; exit $RET;
|
||||||
|
fi
|
||||||
|
|
||||||
|
./.luarocks/bin/luarocks install oauth
|
||||||
|
RET=$?; if [ $RET -ne 0 ];
|
||||||
|
then echo "Error. Exiting."; exit $RET;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install() {
|
||||||
|
cd tg && ./configure && make
|
||||||
|
RET=$?; if [ $RET -ne 0 ];
|
||||||
|
then echo "Error. Exiting."; exit $RET;
|
||||||
|
fi
|
||||||
|
cd ..
|
||||||
|
install_luarocks
|
||||||
|
install_rocks
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$1" = "install" ]; then
|
||||||
|
update
|
||||||
|
install
|
||||||
|
elif [ "$1" = "update" ]; then
|
||||||
|
update
|
||||||
|
else
|
||||||
|
if [ ! -f ./tg/telegram.h ]; then
|
||||||
|
echo "tg not found"
|
||||||
|
echo "Run $0 install"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f ./tg/bin/telegram-cli ]; then
|
||||||
|
echo "tg binary not found"
|
||||||
|
echo "Run $0 install"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
PREFIX="$THIS_DIR/.luarocks"
|
||||||
|
export LUA_CPATH=";;${PREFIX}/lib/lua/5.2/?.so"
|
||||||
|
export LUA_PATH=";;${PREFIX}/share/lua/5.2/?.lua;${PREFIX}/share/lua/5.2/?/init.lua"
|
||||||
|
./tg/bin/telegram-cli -k tg/tg-server.pub -s ./bot/bot.lua -l 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f ./tg/bin/telegram-cli ]; then
|
|
||||||
echo "Compile telegram first:"
|
|
||||||
echo "cd tg && ./configure && make"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
./tg/bin/telegram-cli -k tg/tg-server.pub -s ./bot/bot.lua -l 1
|
|
||||||
|
Reference in New Issue
Block a user