#File for setting up git-p4 correctly
#Make aptitude be fully non-interactive, so we don't get the issues with Grub trying to configure itself.
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
#Get the public key for Perforce package repo
sudo wget -qO - https://package.perforce.com/perforce.pubkey | sudo apt-key add -
#Update sources list with the Perforce Package repo.
sudo echo "deb http://package.perforce.com/apt/ubuntu xenial release" >> /etc/apt/sources.list
sudo apt-get update
sudo apt-get -y install helix-cli 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
git clone http://github.com/ermshiperete/git-p4.git
sudo cp git-p4/git-p4 /usr/bin
echo '[alias]
p4 = !//usr/bin/git-p4' > /home/vagrant/.gitconfig
cd /home/vagrant
mkdir git_ws
cd git_ws
echo P4USER=jen > .p4config
echo P4PORT=ssl:1666 >> .p4config
echo P4CLIENT=git_ws >> .p4config
#Add some data to the Helix server for test purposes
mkdir ../ws
cd ../ws
echo P4USER=super > .p4config
echo P4PORT=ssl:1666 >> .p4config
echo P4CLIENT=ws >> .p4config
p4 login < ../../hws/passwd
#Create the 'jen' user
p4 configure set security=1