Move to Lua 5.3.

Also new shell script to install Luarocks (for Lua5.3) (on Ubuntu 16.04) and all
necessary rocks.
Updated tg-install.sh to not include all the needless dependencies.
This commit is contained in:
topkecleon 2016-09-04 00:50:51 -04:00
parent caff204c71
commit 1063ee8729
7 changed files with 44 additions and 13 deletions

View File

@ -18,7 +18,7 @@ otouto (including all plugins and documentation) is free software; you are free
| [List of plugins](#list-of-plugins) | [Contributors](#contributors) |
## Setup
You _must_ have Lua (5.2+), luasocket, luasec, multipart-post, and dkjson installed. You should also have lpeg, though it is not required. It is recommended you install these with LuaRocks.
You _must_ have Lua 5.3, luasocket, luasec, multipart-post, and dkjson installed. You should also have lpeg, though it is not required. It is recommended you install these with LuaRocks.
To get started, clone the repository and set the following values in `config.lua`:

22
install-dependencies.sh Normal file
View File

@ -0,0 +1,22 @@
# This script will attempt to install Lua 5.3, Luarocks (pointed at 5.3), and
# the rocks necssary to run otouto. This script targets Ubuntu 16.04; it will
# probably not work on any earlier version of Ubuntu.
#!/bin/sh
echo 'Requesting root privileges to install necessary packages:'
echo 'lua5.3 liblua5.3-dev git libssl-dev fortune-mod fortunes'
sudo apt-get update
sudo apt-get install -y lua5.3 liblua5.3-dev git libssl-dev fortune-mod fortunes
git clone http://github.com/keplerproject/luarocks
cd luarocks
./configure --lua-version=5.3 --versioned-rocks-dir --lua-suffix=5.3
make build
sudo make install
sudo luarocks-5.3 install luasocket
sudo luarocks-5.3 install luasec
sudo luarocks-5.3 install multipart-post
sudo luarocks-5.3 install lpeg
sudo luarocks-5.3 install dkjson
cd ..
echo 'Finished. Use ./launch to start otouto.'
echo 'Be sure to set your bot token in config.lua.'

View File

@ -1,7 +1,13 @@
#!/bin/sh
while true; do
lua main.lua
echo 'otouto has stopped. ^C to exit.'
sleep 5s
done
# Ubuntu 16.04 seems to not link "lua" to lua5.3.
if type lua5.3 >/dev/null 2>/dev/null; then
while true; do
lua5.3 main.lua
echo 'otouto has stopped. ^C to exit.'
sleep 5s
done
else
echo 'Lua 5.3 was not found.'
exit
fi

View File

@ -27,6 +27,8 @@ bot.version = '3.13'
-- Function to be run on start and reload.
function bot:init(config)
assert(config.bot_api_key, 'You didn\'t set your bot token in config.lua!')
bindings = require('otouto.bindings').init(config.bot_api_key)
utilities = require('otouto.utilities')

View File

@ -1066,7 +1066,7 @@ function administration.init_command(self_, config_)
command = 'alist',
privilege = 3,
interior = true,
interior = false,
doc = 'Returns a list of administrators. Owner is denoted with a star character.',
action = function(self, msg, group, config)

View File

@ -36,7 +36,7 @@ function luarun:action(msg, config)
end
local output, success =
loadstring("local bot = require('otouto.bot')\n\z
load("local bot = require('otouto.bot')\n\z
local bindings = require('otouto.bindings')\n\z
local utilities = require('otouto.utilities')\n\z
local drua = require('otouto.drua-tg')\n\z

View File

@ -5,11 +5,12 @@
# alternative), figure it out yourself.
echo 'Requesting root privileges to install necessary packages:'
echo 'libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev make'
sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev make
echo 'Compiling tg, test branch.'
echo 'git libreadline-dev libssl-dev libevent-dev make'
sudo apt-get update
sudo apt-get install -y git libreadline-dev libssl-dev libevent-dev make
git clone http://github.com/vysheng/tg --recursive -b test
cd tg
./configure
./configure --disable-libconfig --disable-liblua --disable-json
make
echo 'All done! Use ./tg-launch.sh to launch tg. Be sure to log in with your Telegram account.'
echo 'All done! Use ./tg-launch.sh to launch tg.'
echo 'Be sure to log in with your Telegram account.'