Skip to content

Instantly share code, notes, and snippets.

@woodie
Last active February 15, 2021 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save woodie/6aaa1b200fcab510df9569316359706b to your computer and use it in GitHub Desktop.
Save woodie/6aaa1b200fcab510df9569316359706b to your computer and use it in GitHub Desktop.
#!/bin/bash
# Keep this associative array up-to-date based on perforce packages
declare -A releases=( ["12.04"]="precise" ["14.04"]="trusty" ["16.04"]="xenial")
# https://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.install.html#install.linux.packages
os_name=`grep ^NAME= /etc/os-release | cut -c6- | tr -d '"'`
if [[ $os_name != "Ubuntu" ]] ; then
echo 'Sorry, only for Ubuntu.'
exit 1
fi
version_id=`grep ^VERSION_ID= /etc/os-release | cut -c12- | tr -d '"'`
if [[ ${releases[$version_id]} == "" ]] ; then
echo 'Sorry, unsupported Ubuntu release.'
exit 1
fi
plist="deb http://package.perforce.com/apt/ubuntu/ ${releases[$version_id]} release"
sudo bash -c "echo '$plist' > /etc/apt/sources.list.d/perforce.list"
echo '#### Importing Perforce package signing key.'
wget -q http://package.perforce.com/perforce.pubkey -O- | sudo apt-key add -
sudo apt-get update
echo '#### Installing Perforce helix-cli service package.'
sudo apt-get install helix-cli
# helix-p4d helix-p4dctl helix-proxy helix-broker helix-cli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment