#Install P4D
sudo echo "deb http://package.perforce.com/apt/ubuntu trusty release" >> /etc/apt/sources.list
wget -qO - http://package.perforce.com/perforce.pubkey | sudo apt-key add -
sudo aptitude update
sudo aptitude -y install helix-p4d
sudo /opt/perforce/sbin/configure-helix-p4d.sh -n perforce1 -p ssl:1666 -r /opt/perforce/servers/perforce1 -u super -P REinforce --unicode
#Download P4BBI from the workshop
wget https://swarm.workshop.perforce.com/projects/perforce_software-p4bbi/download/downloads/p4bbi.tgz
tar -xvf p4bbi.tgz
sudo mkdir /p4
sudo mv p4bbi /p4
sudo cp /usr/sbin/p4d /p4/p4bbi/bin
sudo cp /usr/bin/p4 /p4/p4bbi/bin
sudo chown -R vagrant /p4/*
cd /p4/p4bbi
sudo mv /home/vagrant/hws/run.sh .
#Make a backup of tyhe test files, before doing anything to the originals
cp sample_cfg/p4config.test sample_cfg/p4config.test.old
cp sample_cfg/FGS.Classic.bbi.cfg sample_cfg/FGS.classic.bbi.cfg.old
cp sample_cfg/FGS.Classic.bbi.cfg /p4/p4bbi/bbi.cfg
chmod +x runbbi.sh
cp sample_cfg/p4config.test ./p4config.test
#Modify the config file, so it has the details for the P4D we installed using packages
echo P4PORT=ssl:localhost:1666 > p4config.test
echo P4USER=super >> p4config.test
echo P4IGNORE=ignore.bbi >> p4config.test