From 743cd717e350eced61725f0b2c926432c45ff83b Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Wed, 7 Sep 2016 15:55:57 +0200 Subject: [PATCH] =?UTF-8?q?Entfernte=20Unterst=C3=BCtzung=20f=C3=BCr=20Lua?= =?UTF-8?q?=205.3,=20da=20OAuth=20damit=20nicht=20funktioniert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install-dependencies.sh | 23 +++++++---------------- otouto/utilities.lua | 6 ++---- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/install-dependencies.sh b/install-dependencies.sh index 2180fc3..2b93546 100755 --- a/install-dependencies.sh +++ b/install-dependencies.sh @@ -1,19 +1,11 @@ -# Install Lua, Luarocks, and otouto dependencies. Works in Ubuntu, maybe Debian. -# Installs Lua 5.3 if Ubuntu 16.04. Otherwise, 5.2. - #!/bin/sh +# Installiert Lua, Luarocks und andere Abhängigkeiten. Sollte auch auf Debian funktionieren. -if [ $(lsb_release -r | cut -f 2) == "16.04" ]; then - luaver="5.3" - rocklist="luasocket luasec multipart-post lpeg dkjson redis-lua fakeredis oauth xml feedparser serpent" -else - luaver="5.2" - rocklist="luasocket luasec multipart-post lpeg dkjson redis-lua fakeredis oauth xml feedparser serpent luautf8" -fi +rocklist="luasocket luasec multipart-post lpeg dkjson redis-lua fakeredis oauth xml feedparser serpent luautf8" echo "Dieses Skript ist für Ubuntu, es wird wahrscheinlich auch für Debian funktionieren." echo "Dieses Skript benötigt Root-Rechte, um folgende Pakete zu installieren:" -echo "lua$luaver liblua$luaver-dev git libssl-dev fortune-mod fortunes redis-server unzip make" +echo "lua5.2 liblua5.2-dev git libssl-dev fortune-mod fortunes redis-server unzip make" echo "Es werden auch Root-Rechte benötigt, um LuaRocks in /usr/local/" echo "mit den folgenden Rocks zu installieren:" echo $rocklist @@ -21,18 +13,17 @@ echo "Drücke ENTER, um fortzufahren, oder Strg-C zum Beenden." read sudo apt-get update -sudo apt-get install -y lua$luaver liblua$luaver-dev git libssl-dev fortune-mod fortunes redis-server unzip make +sudo apt-get install -y lua5.2 liblua5.2-dev git libssl-dev fortune-mod fortunes redis-server unzip make git clone http://github.com/keplerproject/luarocks cd luarocks -./configure --lua-version=$luaver --versioned-rocks-dir --lua-suffix=$luaver +./configure --lua-version=5.2 --versioned-rocks-dir --lua-suffix=5.2 make build sudo make install for rock in $rocklist; do - sudo luarocks-$luaver install $rock + sudo luarocks-5.2 install $rock done sudo -k cd .. -cp config.lua.example config.lua echo "Vorgang beendet! Nutze ./launch.sh, um den Bot zu starten." -echo "Setze vorher dein Bot-Token in der config.lua." +echo "Setze vorher dein Bot-Token in der config.lua.example und kopiere sie nach config.lua." diff --git a/otouto/utilities.lua b/otouto/utilities.lua index 91a9416..733e0d3 100644 --- a/otouto/utilities.lua +++ b/otouto/utilities.lua @@ -20,6 +20,7 @@ local utilities = {} +utf8 = require('lua-utf8') ltn12 = require('ltn12') http = require('socket.http') https = require('ssl.https') @@ -32,9 +33,6 @@ redis = (loadfile "./otouto/redis.lua")() mime = (loadfile "./otouto/mimetype.lua")() OAuth = require "OAuth" helpers = require "OAuth.helpers" - -- Lua 5.2 compatibility. - -- If no built-in utf8 is available, load the library. -local utf8 = utf8 or require('lua-utf8') http.timeout = 5 https.timeout = 5 @@ -1107,4 +1105,4 @@ function utilities.fix_utf8(str) end -return utilities \ No newline at end of file +return utilities