#! /bin/bash

#
# Automate some installation steps for the Sexton Multicamera Application.
# Run this from the project root directory, e.g.
# sexton-multicamera> ./install/INSTALL.sh
#
# Original author: Mark Zvilius, 20-July-2019
# For: The Sexton Corp
#

PIPENV=~/.local/bin/pipenv
E2DIR=e2/
INSTALLDIR=install/
AUTOSTART_FILE=autostart

echo "performing installation activities for Sexton Multicamera Application"
echo

if [ ! -r ${INSTALLDIR}${AUTOSTART_FILE} ]; then
    echo "${INSTALLDIR}${AUTOSTART_FILE} does not exist"
    exit 1
fi

if [ -d ${E2DIR} ]; then
    cd ${E2DIR}
else
    echo "directory ${E2DIR} does not exist .. maybe you are in the wrong place?"
    exit 1
fi

# Make e2/config/ subdirectory and create config files.
${PIPENV} run python make_configs.py
echo "remember to create config/ip_addresses.json"
echo "its format is approximately:"
echo "[ \"10.6.10.162\", \"10.6.10.163\", ...]"
echo


