#Set p4config
export P4CONFIG=.p4config
echo P4CONFIG=.p4config >> /etc/bash.bashrc
#Install the package
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-git-connector
sudo aptitude -y install helix-p4d
sudo /opt/perforce/sbin/configure-helix-p4d.sh -n perforce1 -p ssl:192.168.2.72:1666 -r /opt/perforce/servers/perforce1 -u super -P REinforce --unicode
#Create a workspace on the gconn machine
echo REinforce > hws/passwd
mkdir ws
cd ws
cp ../hws/p4_config ./.p4config
p4 login < ../hws/passwd
p4 client -i < ../hws/client
#Configure gconn
sudo /opt/perforce/git-connector/bin/configure-git-connector.sh -n --p4port ssl:192.168.2.72:1666 --super super --superpassword REinforce --graphdepot graph --gcuserp4password REinforce --https --gconnhost 192.168.2.72 --forcehttps --ssh --sshuser git --croninterval 5 --serverid gconn1
#Export the location of the gconn configuration file, necessary for enabling mirroring
sudo -u git -i
export GCONN_CONFIG=/opt/perforce/git-connector/gconn.conf
echo GCONN_CONFIG=/opt/perforce/git-connector/gconn.conf >> ~/.bashrc
#setup the mirror hook.
gconn --mirrorhooks add graph/testrepo https://root:REinforce@172.16.100.12/root/testrepo.git > secret
#As we are using a self-signed cert for HTH, tell Git not to verify the certs
git config --global http.sslverify false
#Add an SSH key for user 'jen'.
sudo -u vagrant -i
cd /home/vagrant/ws
p4 trust -y
p4 login < /home/vagrant/hws/passwd
#Create the public key for user jen.
#We do not want the private key in the workspace.
cd /home/vagrant/hws
rm jen_key*
ssh-keygen -t rsa -f jen_key
p4 -u super -p ssl:192.168.2.72:1666 user -f -i < helix_user
p4 -u super -p ssl:192.168.2.72:1666 pubkey -u jen -i < /home/vagrant/hws/jen_key.pub
#Give user jen admin permissions to the depot graph
p4 -u super -p ssl:192.168.2.72:1666 grant-permission -u jen -p admin -d graph
#set the password for jen
p4 -u super -p ssl:192.168.2.72:1666 configure set security=1
p4 -u super -p ssl:192.168.2.72:1666 passwd -P Reinforce jen
p4 -u super -p ssl:192.168.2.72:1666 configure set security=3
#Add some data to the graph depot
p4 -u super -p ssl:192.168.2.72:1666 repo -i < orca_repo
cd /home/vagrant
mkdir testrepos
cd testrepos
git clone https://github.com/GNOME/orca.git
cd orca
git remote rename origin upstream
git remote add origin https://jen:REinforce@192.168.2.72/graph/orca
git push -u --all origin