Browse Source

Add sysconf fixes

feature/nightly-build
Matthew Faltys 5 years ago
parent
commit
980ccd4ed0
  1. 2
      Makefile
  2. 3
      config.gcfg
  3. 7
      deps/Dockerfile
  4. 12
      deps/server_config.gcfg
  5. 14
      nethack-launcher/create_initial_files.go
  6. 3
      nethack-launcher/create_user_files.go
  7. 15
      nethack-launcher/nethack-launcher.go

2
Makefile

@ -38,7 +38,7 @@ dependencies:
build_docker: build_docker:
mkdir -p stage.tmp/ mkdir -p stage.tmp/
cp deps/Dockerfile stage.tmp/ cp deps/Dockerfile stage.tmp/
cp deps/server_config.gcfg stage.tmp/config.gcfg cp config.gcfg stage.tmp/config.gcfg
cp bin/nethack-launcher stage.tmp/ cp bin/nethack-launcher stage.tmp/
cp deps/redis.conf stage.tmp/ cp deps/redis.conf stage.tmp/
cp deps/run.sh stage.tmp/ cp deps/run.sh stage.tmp/

3
config.gcfg

@ -2,9 +2,10 @@
loglevel = "debug" loglevel = "debug"
serverdisplay = "unixvoid.com underground nethack server" serverdisplay = "unixvoid.com underground nethack server"
nethackversion = "3.6.3 beta1+" nethackversion = "3.6.3 beta1+"
hackdir = "savedata/hack" hackdir = "/hack"
nhdatlocation = "/NetHack/dat/nhdat" nhdatlocation = "/NetHack/dat/nhdat"
recoverbinary = "/NetHack/util/recover" recoverbinary = "/NetHack/util/recover"
sysconflocation = "/NetHack/sys/unix/sysconf"
bootstrapdelay = 1 bootstrapdelay = 1
[redis] [redis]

7
deps/Dockerfile vendored

@ -41,6 +41,11 @@ RUN cd NetHack && \
RUN find /* -name nethack RUN find /* -name nethack
RUN chmod 777 /NetHack/sys/unix/sysconf RUN chmod 777 /NetHack/sys/unix/sysconf
# update sysconf
RUN sed -i 's/.*WIZARDS=.*/#WIZARDS=/' /NetHack/sys/unix/sysconf
RUN sed -i 's/.*GENERICUSERS=.*/#GENERICUSERS=/' /NetHack/sys/unix/sysconf
RUN sed -i 's/.*MAXPLAYERS=.*/MAXPLAYERS=0/' /NetHack/sys/unix/sysconf
# make required dirs # make required dirs
RUN mkdir -p /redisbackup/ RUN mkdir -p /redisbackup/
@ -57,6 +62,8 @@ RUN echo "PermitEmptyPasswords yes" >> /etc/ssh/sshd_config
RUN useradd nethack -d / -s /nethack-launcher RUN useradd nethack -d / -s /nethack-launcher
RUN echo 'nethack:U6aMy0wojraho' | chpasswd -e RUN echo 'nethack:U6aMy0wojraho' | chpasswd -e
RUN chown -R nethack /hack/ RUN chown -R nethack /hack/
RUN chown -R nethack /NetHack/
RUN touch /.hushlogin
# build ttyrec # build ttyrec
RUN git clone https://github.com/ovh/ovh-ttyrec && \ RUN git clone https://github.com/ovh/ovh-ttyrec && \

12
deps/server_config.gcfg vendored

@ -1,12 +0,0 @@
[nethacklauncher]
loglevel = "debug"
serverdisplay = "unixvoid.com underground nethack server"
nethackversion = "3.6.3 beta1+"
hackdir = "/hack"
nhdatlocation = "/usr/lib/games/nethack/nhdat"
recoverbinary = "/usr/lib/games/nethack/recover"
bootstrapdelay = 1
[redis]
host = "localhost:6379"
password = ""

14
nethack-launcher/create_initial_files.go

@ -14,7 +14,18 @@ func createInitialFiles() {
// move in nhdat file if it does not exist // move in nhdat file if it does not exist
if _, err := os.Stat(fmt.Sprintf("%s/nhdat", config.NethackLauncher.HackDir)); os.IsNotExist(err) { if _, err := os.Stat(fmt.Sprintf("%s/nhdat", config.NethackLauncher.HackDir)); os.IsNotExist(err) {
exec.Command("cp", config.NethackLauncher.NhdatLocation, config.NethackLauncher.HackDir).Run() fmt.Printf("%s\n", err)
println("moving in initial nhdat file")
out, err := exec.Command("cp", config.NethackLauncher.NhdatLocation, fmt.Sprintf("%s/nhdat", config.NethackLauncher.HackDir)).Output()
if err != nil {
fmt.Printf("%s\n", err)
}
fmt.Printf("%s\n", out)
}
// move in sysconf file if it does not exist
if _, err := os.Stat(fmt.Sprintf("%s/sysconf", config.NethackLauncher.HackDir)); os.IsNotExist(err) {
exec.Command("cp", config.NethackLauncher.SysconfLocation, config.NethackLauncher.HackDir).Run()
} }
// make sure record file exists // make sure record file exists
@ -35,6 +46,7 @@ func createInitialFiles() {
os.Exit(1) os.Exit(1)
} else { } else {
// move nethackrc file to proper location // move nethackrc file to proper location
println("moving in initial config file")
exec.Command("cp", "/.nethackrc", config.NethackLauncher.HackDir).Run() exec.Command("cp", "/.nethackrc", config.NethackLauncher.HackDir).Run()
} }

3
nethack-launcher/create_user_files.go

@ -34,6 +34,9 @@ func createUserFiles(username string) {
// create record symlink // create record symlink
exec.Command("ln", "-s", fmt.Sprintf("%s/record", config.NethackLauncher.HackDir), fmt.Sprintf("%s/record", userpath)).Run() exec.Command("ln", "-s", fmt.Sprintf("%s/record", config.NethackLauncher.HackDir), fmt.Sprintf("%s/record", userpath)).Run()
// create sysconf symlink
exec.Command("ln", "-s", fmt.Sprintf("%s/sysconf", config.NethackLauncher.HackDir), fmt.Sprintf("%s/sysconf", userpath)).Run()
// move in nhdat file if it does not exist // move in nhdat file if it does not exist
exec.Command("cp", fmt.Sprintf("%s/nhdat", config.NethackLauncher.HackDir), userpath).Run() exec.Command("cp", fmt.Sprintf("%s/nhdat", config.NethackLauncher.HackDir), userpath).Run()
} }

15
nethack-launcher/nethack-launcher.go

@ -13,13 +13,14 @@ import (
type Config struct { type Config struct {
NethackLauncher struct { NethackLauncher struct {
Loglevel string Loglevel string
ServerDisplay string ServerDisplay string
NethackVersion string NethackVersion string
HackDir string HackDir string
NhdatLocation string NhdatLocation string
RecoverBinary string RecoverBinary string
BootstrapDelay time.Duration SysconfLocation string
BootstrapDelay time.Duration
} }
Redis struct { Redis struct {

Loading…
Cancel
Save