#!/usr/bin/env bash
set -euo pipefail

# This process is PID 1 for an Learnitive sandbox. Keep startup checks
# here rather than embedding a shell program in a JavaScript string so quoting
# and newline escapes cannot silently turn a successful `docker run -d` into a
# container that exits before the PTY attaches.
test "$(id -un)" = developer
test "$(id -gn)" = developer
test -n "${HOME:-}"
test -n "${NPM_CONFIG_CACHE:-}"
test -w "$HOME"
test -w "$NPM_CONFIG_CACHE"

umask 077
printf '%s\n' "alias ll='ls -alF'" > /tmp/learnitive-bashrc
test -s /tmp/learnitive-bashrc

exec sleep infinity
