diff --git a/deps/Dockerfile b/deps/Dockerfile index 874fe63..d53a964 100644 --- a/deps/Dockerfile +++ b/deps/Dockerfile @@ -3,11 +3,12 @@ FROM debian # install needed packages RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ - ttyrec \ - termrec \ nethack-console \ redis-server \ openssh-server \ + g++ \ + make \ + git \ vim # make required dirs @@ -27,6 +28,17 @@ RUN useradd hack -d / -s /nethack-launcher RUN echo 'hack:U6aMy0wojraho' | chpasswd -e RUN chown -R hack /hack/ +# build ttyrec +RUN git clone https://github.com/ovh/ovh-ttyrec && \ + cd ovh-ttyrec && \ + ./configure && make && make install + +# remove ttyrec artifacts +RUN rm -rf ovh-ttyrec/ +RUN DEBIAN_FRONTEND=noninteractive apt-get remove -y\ + make \ + git + # copy in files COPY config.gcfg / COPY nethack-launcher / diff --git a/nethack-launcher.go b/nethack-launcher.go index dd0523d..9ffff97 100644 --- a/nethack-launcher.go +++ b/nethack-launcher.go @@ -441,8 +441,8 @@ func printProgressScreen(redisClient *redis.Client, username string) { // restart display exec.Command("stty", "-F", "/dev/tty", "echo", "-cbreak").Run() clearScreen() - //nh := exec.Command("ttyplay", "-p", ttyrecPath) - nh := exec.Command("termplay", "-f", "live", ttyrecPath) + nh := exec.Command("ttyplay", "-p", ttyrecPath) + //nh := exec.Command("termplay", "-f", "live", ttyrecPath) nh.Stdout = os.Stdout nh.Stdin = os.Stdin nh.Stderr = os.Stderr @@ -458,14 +458,14 @@ func printProgressScreen(redisClient *redis.Client, username string) { } func runGame(username, timestamp string) { + exec.Command("stty", "-F", "/dev/tty", "echo", "-cbreak").Run() + clearScreen() + // put together users home dir homeDir := fmt.Sprintf("%s/user/%s/", config.NethackLauncher.HackDir, username) ttyrecPath := fmt.Sprintf("%s/user/%s/ttyrec/%s.ttyrec", config.NethackLauncher.HackDir, username, timestamp) - exec.Command("stty", "-F", "/dev/tty", "echo", "-cbreak").Run() - clearScreen() - //nh := exec.Command("ttyrec", ttyrecPath, "-e", "nethack") - nh := exec.Command("termrec", ttyrecPath, "-e", "nethack") - //nh := exec.Command("termrec", ttyrecPath, "-e", "nethack") + + nh := exec.Command("ttyrec", "-f", ttyrecPath, "--", "nethack") nh.Env = os.Environ() nh.Env = append(nh.Env, fmt.Sprintf("HOME=%s", homeDir)) nh.Env = append(nh.Env, fmt.Sprintf("USER=%s", username)) @@ -477,9 +477,6 @@ func runGame(username, timestamp string) { if err != nil { fmt.Print(err) } - fmt.Printf("%v\n", nh.Stdout) - fmt.Printf("%v\n", nh.Stdin) - fmt.Printf("%v\n", nh.Stderr) exec.Command("exit").Run() wg.Done() }