-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch.sh
114 lines (92 loc) · 2.33 KB
/
launch.sh
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/usr/bin/env bash
THIS_DIR=$(cd $(dirname $0); pwd)
cd $THIS_DIR
update() {
git pull
git submodule update --init --recursive
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
./.luarocks/bin/luarocks install redis-lua
RET=$?; if [ $RET -ne 0 ];
then echo "Error. Exiting."; exit $RET;
fi
./.luarocks/bin/luarocks install lua-cjson
RET=$?; if [ $RET -ne 0 ];
then echo "Error. Exiting."; exit $RET;
fi
./.luarocks/bin/luarocks install fakeredis
RET=$?; if [ $RET -ne 0 ];
then echo "Error. Exiting."; exit $RET;
fi
./.luarocks/bin/luarocks install xml
RET=$?; if [ $RET -ne 0 ];
then echo "Error. Exiting."; exit $RET;
fi
./.luarocks/bin/luarocks install feedparser
RET=$?; if [ $RET -ne 0 ];
then echo "Error. Exiting."; exit $RET;
fi
./.luarocks/bin/luarocks install serpent
RET=$?; if [ $RET -ne 0 ];
then echo "Error. Exiting."; exit $RET;
fi
}
install() {
git pull
git submodule update --init --recursive
cd tg && ./configure && make
RET=$?; if [ $RET -ne 0 ]; then
echo "Trying without Python...";
./configure --disable-python && make
RET=$?
fi
if [ $RET -ne 0 ]; then
echo "Error. Exiting."; exit $RET;
fi
cd ..
install_luarocks
install_rocks
}
if [ "$1" = "install" ]; then
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
./tg/bin/telegram-cli -k ./tg/tg-server.pub -s ./bot/bot.lua -l 1 -E
fi