Browse Source

Add file checking

Remove reclist
master
Matthew Faltys 5 years ago
parent
commit
6740664fc3
  1. 7
      Makefile
  2. 2
      config.gcfg
  3. 1
      deps/Dockerfile
  4. 2
      deps/server_config.gcfg
  5. 10
      nethack-launcher.go

7
Makefile

@ -6,7 +6,7 @@ NETHACK_DIR=$(shell pwd)/savedata
IMAGE_NAME=nethack_launch
all: stat reclist
all: stat
run:
go run \
@ -16,10 +16,6 @@ stat:
mkdir -p bin/
$(CGOR) $(GOC) $(GOFLAGS) -o bin/nethack-launcher nethack-launcher.go
reclist:
mkdir -p bin/
gcc -static deps/reclist.c -o bin/reclist
dependencies:
go get github.com/gorilla/mux
@ -27,7 +23,6 @@ build_docker:
mkdir -p stage.tmp/
cp deps/Dockerfile stage.tmp/
cp deps/server_config.gcfg stage.tmp/config.gcfg
cp bin/reclist stage.tmp/
cp bin/nethack-launcher stage.tmp/
cp deps/redis.conf stage.tmp/
cp deps/run.sh stage.tmp/

2
config.gcfg

@ -1,7 +1,7 @@
[nethacklauncher]
loglevel = "debug"
serverdisplay = "unixvoid.com underground nethack server"
nethackversion = "3.6.0"
nethackversion = "3.6.1"
hackdir = "savedata/hack"
nhdatlocation = "/usr/lib/games/nethack/nhdat"
bootstrapdelay = 1

1
deps/Dockerfile vendored

@ -18,7 +18,6 @@ RUN mkdir /hack/
# copy in files
COPY config.gcfg /
COPY nethack-launcher /
COPY reclist /bin/
COPY redis.conf /
COPY run.sh /
COPY nethackrc /hack/.nethackrc

2
deps/server_config.gcfg vendored

@ -1,7 +1,7 @@
[nethacklauncher]
loglevel = "debug"
serverdisplay = "unixvoid.com underground nethack server"
nethackversion = "3.6.0"
nethackversion = "3.6.1"
hackdir = "/hack"
nhdatlocation = "/usr/lib/games/nethack/nhdat"
bootstrapdelay = 1

10
nethack-launcher.go

@ -109,6 +109,13 @@ func checkFiles() {
fmt.Printf("%s\n", err)
os.Exit(1)
}
// make sure initial rcfile exists
hackRCLoc := fmt.Sprintf("%s/.nethackrc", config.NethackLauncher.HackDir)
if _, err := os.Stat(hackRCLoc); os.IsNotExist(err) {
glogger.Info.Printf("initial config file not found at: %s\n", hackRCLoc)
fmt.Printf("%s\n", err)
os.Exit(1)
}
}
func clearScreen() {
@ -345,9 +352,6 @@ func printRegisterScreen(redisClient *redis.Client) {
secHash := sha3.Sum512([]byte(sec))
redisClient.Set(fmt.Sprintf("user:%s", username), fmt.Sprintf("%x", secHash), 0).Err()
// TODO create config file
// HackDir/user/username/<config>
// create user directories
userPath := fmt.Sprintf("%s/user/%s/ttyrec/", config.NethackLauncher.HackDir, username)
exec.Command("mkdir", "-p", userPath).Run()

Loading…
Cancel
Save