#!/bin/bash --login
# This script runs the same sequence as the CircleCI build
# Run this as:
# bin/setup


# Fail on the first error; killable by SIGINT
set -e
trap "exit" INT

read -p "
------------------------------------------------

Welcome to the SLM Lab setup script;
This will invoke sudo; alternatively,
inspect bin/setup_ubuntu or bin/setup_macOS and run the lines manually.

Press enter to continue, Ctrl+c to quit:

------------------------------------------------
"

# copy config file if not already exist
BIN_DIR=`pwd`/bin
$BIN_DIR/copy_config

# Run setup by OS
if [ $(uname) == "Darwin" ]; then
  $BIN_DIR/setup_macOS
elif [ -f '/etc/arch-release' ]; then
  $BIN_DIR/setup_arch
else
  $BIN_DIR/setup_ubuntu
fi

echo "
------------------------------------------------

Installation complete.

------------------------------------------------
"
