From c2904a8e14b09e4c054ff186f1274b89b0f11e25 Mon Sep 17 00:00:00 2001 From: Brian Seymour Date: Tue, 6 Oct 2020 23:40:14 -0500 Subject: [PATCH] add lua support --- api/main.go | 1 + lxc/execute | 3 +++ lxc/executors/lua | 2 ++ lxc/versions | 3 +++ readme.md | 11 +++++++++++ 5 files changed, 20 insertions(+) create mode 100644 lxc/executors/lua diff --git a/api/main.go b/api/main.go index 3ca388d..21cb1f9 100644 --- a/api/main.go +++ b/api/main.go @@ -77,6 +77,7 @@ func Execute(res http.ResponseWriter, req *http.Request) { "java", "julia", "jl", "kotlin", + "lua", "nasm", "asm", "node", "javascript", "js", "perl", "pl", diff --git a/lxc/execute b/lxc/execute index 248caee..0bca774 100755 --- a/lxc/execute +++ b/lxc/execute @@ -75,6 +75,9 @@ case "$lang" in "kotlin") bin=kotlin ;; +"lua") + bin=lua + ;; "nasm" | "asm") bin=nasm ;; diff --git a/lxc/executors/lua b/lxc/executors/lua new file mode 100644 index 0000000..b412013 --- /dev/null +++ b/lxc/executors/lua @@ -0,0 +1,2 @@ +cd /tmp/$2 +runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 lua code.code" diff --git a/lxc/versions b/lxc/versions index f23f467..1e36ea3 100755 --- a/lxc/versions +++ b/lxc/versions @@ -33,6 +33,9 @@ echo '---' echo 'kotlin' lxc-attach --clear-env -n piston -- /bin/bash -l -c "kotlinc -version 2>&1 | grep kotlin" echo "---" +echo 'lua' +lxc-attach --clear-env -n piston -- /bin/bash -l -c "lua -v" +echo "---" echo 'nasm' lxc-attach --clear-env -n piston -- /bin/bash -l -c "nasm -version" echo '---' diff --git a/readme.md b/readme.md index 0bfb7e4..b3bc4ca 100644 --- a/readme.md +++ b/readme.md @@ -207,6 +207,17 @@ make echo 'export PATH=$PATH:/opt/emacs/emacs-26.3/src' >> /opt/.profile source /opt/.profile +# install lua +# final binary: /opt/lua/lua54/src/lua +# get version: /opt/lua/lua54/src/lua -v +cd /opt && mkdir lua && cd lua +wget https://sourceforge.net/projects/luabinaries/files/5.4.0/Docs%20and%20Sources/lua-5.4.0_Sources.tar.gz/download +tar -xzf download +cd lua54 +make +echo 'export PATH=$PATH:/opt/lua/lua54/src' >> /opt/.profile +source /opt/.profile + # create runnable users and apply limits for i in {1..150}; do useradd -M runner$i