#!/bin/sh set -e CHROOTDIR=/opt/nethack/nethack.jerryaldrichiii.com # Copy dgldir on initial run if [ ! -d $CHROOTDIR/dgldir/userdata ]; then echo "No dgldir detected, copying from image" # Need archive here to get original attributes cp -a $CHROOTDIR/dgldir.orig/* $CHROOTDIR/dgldir/ fi # Copy nethack/var on initial run if [ ! -d $CHROOTDIR/nethack/var/save ]; then echo "No nethack_var detected, copying from image" # Need archive here to get original attributes cp -a $CHROOTDIR/nethack_var.orig/* $CHROOTDIR/nethack/var fi mkdir -p /srv/sshd/host_keys if [ ! -f /srv/sshd/host_keys/sshd_host_rsa_key ]; then echo "No SSHD host key found at /srv/sshd/host_keys/sshd_host_rsa_key" printf "Generating SSHD host key pair" ssh-keygen -N '' -t rsa -f /srv/sshd/host_keys/sshd_host_rsa_key chmod 400 /srv/sshd/host_keys/sshd_host_rsa_key echo "SSHD host key pair generated successfully" fi /usr/sbin/sshd -f /srv/sshd/sshd_config -De