From a7eafa5899ad7a4ec91fcf2b240fa108fe605b6b Mon Sep 17 00:00:00 2001 From: Matthew Faltys Date: Thu, 7 Nov 2019 18:08:23 +0000 Subject: [PATCH] Add score api --- Makefile | 13 +++++++++++++ deps/Dockerfile | 4 +++- deps/run.sh | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 636f28e..403d945 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ run: savedata $(OS_PERMS) docker run \ -d \ -p 23:23 \ + -p 8080:8080 \ -v $(NETHACK_DIR)/var:/opt/nethack/nethack.alt.org/nh343/var:rw \ -v $(NETHACK_DIR)/dgldir:/opt/nethack/nethack.alt.org/dgldir:rw \ --name=nethack \ @@ -20,12 +21,24 @@ build: cp deps/chowner.sh stage.tmp/ cp deps/dgamelaunch.conf stage.tmp/ cp deps/Dockerfile stage.tmp/ + cp deps/reclist stage.tmp/ + cp deps/nethack-score stage.tmp/ cp deps/run.sh stage.tmp/ cd stage.tmp/ && \ $(OS_PERMS) docker build -t $(IMAGE_NAME) . +generate_api_binaries: + git clone https://git.unixvoid.com/mfaltys/nethack-score-api + cd nethack-score-api && \ + make dependencies && \ + make stat reclist + cp nethack-score-api/bin/nethack-score deps/ + cp nethack-score-api/bin/reclist deps/ + rm -rf nethack-score-api + savedata: tar -xzf deps/initial_savedata.tar.gz clean: rm -rf stage.tmp/ + rm -rf nethack-score-api/ diff --git a/deps/Dockerfile b/deps/Dockerfile index 49a911b..af0bccf 100644 --- a/deps/Dockerfile +++ b/deps/Dockerfile @@ -9,7 +9,7 @@ RUN \ RUN locale-gen en_US.UTF-8 -RUN git clone git://github.com/paxed/dgamelaunch.git && \ +RUN git clone https://github.com/paxed/dgamelaunch && \ cd dgamelaunch && \ sed -i \ -e "s/-lrt/-lrt -pthread/" \ @@ -65,6 +65,8 @@ RUN ( \ #VOLUME ["/opt/nethack/nethack.alt.org/nh343/var", "/opt/nethack/nethack.alt.org/dgldir"] COPY dgamelaunch.conf /opt/nethack/nethack.alt.org/etc/dgamelaunch.conf COPY chowner.sh / +COPY reclist /bin/ +COPY nethack-score /bin/ COPY run.sh / EXPOSE 23 diff --git a/deps/run.sh b/deps/run.sh index 5546ce7..c94a3ef 100755 --- a/deps/run.sh +++ b/deps/run.sh @@ -1,4 +1,9 @@ #!/bin/bash +# start chown script /chowner.sh & + +# start high score api +nethack-score -reclistlocation /bin/reclist -recordlocation /opt/nethack/nethack.alt.org/nh343/var/record & + xinetd -dontfork