add lua support

This commit is contained in:
Brian Seymour 2020-10-06 23:40:14 -05:00
parent 9d04f1929d
commit c2904a8e14
5 changed files with 20 additions and 0 deletions

View File

@ -77,6 +77,7 @@ func Execute(res http.ResponseWriter, req *http.Request) {
"java", "java",
"julia", "jl", "julia", "jl",
"kotlin", "kotlin",
"lua",
"nasm", "asm", "nasm", "asm",
"node", "javascript", "js", "node", "javascript", "js",
"perl", "pl", "perl", "pl",

View File

@ -75,6 +75,9 @@ case "$lang" in
"kotlin") "kotlin")
bin=kotlin bin=kotlin
;; ;;
"lua")
bin=lua
;;
"nasm" | "asm") "nasm" | "asm")
bin=nasm bin=nasm
;; ;;

2
lxc/executors/lua Normal file
View File

@ -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"

View File

@ -33,6 +33,9 @@ echo '---'
echo 'kotlin' echo 'kotlin'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "kotlinc -version 2>&1 | grep kotlin" lxc-attach --clear-env -n piston -- /bin/bash -l -c "kotlinc -version 2>&1 | grep kotlin"
echo "---" echo "---"
echo 'lua'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "lua -v"
echo "---"
echo 'nasm' echo 'nasm'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "nasm -version" lxc-attach --clear-env -n piston -- /bin/bash -l -c "nasm -version"
echo '---' echo '---'

View File

@ -207,6 +207,17 @@ make
echo 'export PATH=$PATH:/opt/emacs/emacs-26.3/src' >> /opt/.profile echo 'export PATH=$PATH:/opt/emacs/emacs-26.3/src' >> /opt/.profile
source /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 # create runnable users and apply limits
for i in {1..150}; do for i in {1..150}; do
useradd -M runner$i useradd -M runner$i