#Get the public key for Jenkins
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo echo "deb http://pkg.jenkins-ci.org/debian-stable binary/" >> /etc/apt/sources.list
#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
#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
sudo apt-get -y install default-jdk jenkins helix-cli helix-p4d > /dev/null 2>&1
#Configure P4D
sudo /opt/perforce/sbin/configure-helix-p4d.sh -n perforce1 -p ssl:1666 -r /opt/perforce/servers/perforce1 -u super -P REinforce --unicode
#Setup Jenkins
sudo cp hws/config/config.xml /var/lib/jenkins/
sudo cp hws/config/users/admin/config.xml /var/lib/jenkins/users/admin/
sudo chown -R jenkins:jenkins /var/lib/jenkins/users/
#Setup the Jenkins cli, so we can install the plugins without needing the GUI
#java -jar jenkins-cli.jar -s http://host-ip:8080/ -remoting install-plugin ./plugin.hpi
#--username my-user --password my-pass -restart