#!/bin/bash
set -u
declare Version=1.0.1
#------------------------------------------------------------------------------
# See License.txt for Copyright and License.
#==============================================================================
# Declarations and Environment
function bail () { echo -e "\nError: ${1:-Unknown Error}"; exit ${2:-1}; }
if [[ -z "$MT_HOME" ]]; then
if [[ -r ../env.sh ]]; then
cd ..
source env.sh
cd - > /dev/null
else
bail "Error: Missing env.sh file, and MT_HOME variable not set. Aborting."
fi
fi
if [[ ! -f ../sd/.p4root/db.domain ]]; then
echo "Creating data from sample depot."
./load_sample_depot.sh -G
fi
export P4CONFIG=$MT_HOME/sd/.p4config
[[ ! -r $P4CONFIG ]] && bail "P4CONFIG file [$P4CONFIG] not found. Aborting."
dSpecFile=/tmp/dspec.$$.$RANDOM
echo -e "Depot: task\n\nOwner: bruno\n\nType: stream\n\nMap: task/...\n\n" > $dSpecFile
p4 -u bruno -s depot -i < $dSpecFile
cSpecFile=/tmp/cspec.$$.$RANDOM
echo -e