#!/bin/sh

ON_START_UP_FILE="/deadlock/startup.sh"
TAG="[DEADLOCK]"

# Start docker in docker
dockerd-entrypoint.sh $@ &

# setup ssh key for root user
# must be installed by the API first within /tmp/.ssh
mkdir ~/.ssh
cp /tmp/.ssh/* ~/.ssh/

# start init mission script if exists
if [ -f "$ON_START_UP_FILE" ]; then
    echo
    echo "$TAG Startup your script.."
    echo
    /bin/bash $ON_START_UP_FILE &
else
    echo
    echo "$TAG No startup script found."
    echo
fi


su deadlock -c "sudo python /setup_trace.py"


# start command recorder
node deadlock/recorder.js






