Browse Source

Add score api

master
Matthew Faltys 5 years ago
parent
commit
a7eafa5899
  1. 13
      Makefile
  2. 4
      deps/Dockerfile
  3. 5
      deps/run.sh

13
Makefile

@ -8,6 +8,7 @@ run: savedata
$(OS_PERMS) docker run \ $(OS_PERMS) docker run \
-d \ -d \
-p 23:23 \ -p 23:23 \
-p 8080:8080 \
-v $(NETHACK_DIR)/var:/opt/nethack/nethack.alt.org/nh343/var:rw \ -v $(NETHACK_DIR)/var:/opt/nethack/nethack.alt.org/nh343/var:rw \
-v $(NETHACK_DIR)/dgldir:/opt/nethack/nethack.alt.org/dgldir:rw \ -v $(NETHACK_DIR)/dgldir:/opt/nethack/nethack.alt.org/dgldir:rw \
--name=nethack \ --name=nethack \
@ -20,12 +21,24 @@ build:
cp deps/chowner.sh stage.tmp/ cp deps/chowner.sh stage.tmp/
cp deps/dgamelaunch.conf stage.tmp/ cp deps/dgamelaunch.conf stage.tmp/
cp deps/Dockerfile stage.tmp/ cp deps/Dockerfile stage.tmp/
cp deps/reclist stage.tmp/
cp deps/nethack-score stage.tmp/
cp deps/run.sh stage.tmp/ cp deps/run.sh stage.tmp/
cd stage.tmp/ && \ cd stage.tmp/ && \
$(OS_PERMS) docker build -t $(IMAGE_NAME) . $(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: savedata:
tar -xzf deps/initial_savedata.tar.gz tar -xzf deps/initial_savedata.tar.gz
clean: clean:
rm -rf stage.tmp/ rm -rf stage.tmp/
rm -rf nethack-score-api/

4
deps/Dockerfile vendored

@ -9,7 +9,7 @@ RUN \
RUN locale-gen en_US.UTF-8 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 && \ cd dgamelaunch && \
sed -i \ sed -i \
-e "s/-lrt/-lrt -pthread/" \ -e "s/-lrt/-lrt -pthread/" \
@ -65,6 +65,8 @@ RUN ( \
#VOLUME ["/opt/nethack/nethack.alt.org/nh343/var", "/opt/nethack/nethack.alt.org/dgldir"] #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 dgamelaunch.conf /opt/nethack/nethack.alt.org/etc/dgamelaunch.conf
COPY chowner.sh / COPY chowner.sh /
COPY reclist /bin/
COPY nethack-score /bin/
COPY run.sh / COPY run.sh /
EXPOSE 23 EXPOSE 23

5
deps/run.sh vendored

@ -1,4 +1,9 @@
#!/bin/bash #!/bin/bash
# start chown script
/chowner.sh & /chowner.sh &
# start high score api
nethack-score -reclistlocation /bin/reclist -recordlocation /opt/nethack/nethack.alt.org/nh343/var/record &
xinetd -dontfork xinetd -dontfork

Loading…
Cancel
Save