USAGE for get_p4_binaries.sh version DEV_REBRAND.31788: get_p4_binaries.sh [-r ] [-b ,,...] [-api] [-sbd ] [-p ] [-n] [-d|-D] or get_p4_binaries.sh -h|-man DESCRIPTION: This script acquires Perforce P4 binaries from the Perforce FTP server. The four P4 binaries that can be acquired are: * p4, the command line client * p4d, the P4 Server * p4p, the P4 Proxy * p4broker, the P4 Broker In addition, P4API, the C++ client API, can be downloaded. This script gets the latest patch of binaries for the current major P4 version. It is intended to acquire the latest patch for an existing install, or to get initial binaries for a fresh new install. It must be run from the /p4/sdp/p4_binaries directory in order for the upgrade.sh script to find the downloaded binaries. The p4_binaries directory is used for staging binaries for later upgrade with the SDP 'upgrade.sh' script (documented separately). This p4_binaries directory is used to stage binaries on the current machine, while the 'upgrade.sh' script uses the downloaded binaries to upgrade a single SDP instance (of which there might be several on a machine). The p4_binaries directory must NOT be in the PATH. As a safety feature, the 'verify_sdp.sh' will report an error if the 'p4d' binary is found outside /p4/common/bin in the PATH. The SDP 'upgrade.sh' check uses 'verify_sdp.sh' as part of its preflight checks, and will refuse to upgrade if any 'p4d' is found in the PATH outside /p4/common/bin. When a newer major version of P4 binaries is needed, this script should not be modified directly. Instead, get the latest version of SDP first, which will included a newer version of this script, as well as the latest 'upgrade.sh' The 'upgrade.sh' script is updated with each major SDP version to be aware of any changes in the upgrade procedure for the corresponding p4d version. Upgrading SDP first ensures you have a version of the SDP that works with newer versions of p4d and other P4 binaries. PLATFORM DETECTION The 'uname' command is used to determine the architecture for the current machine on which this script is run. This script and supporting P4*.json release list files know what platforms for which builds are available for each P4 binary (p4, p4d, p4broker, p4p). If the 'jq' utility is available, this script uses the P4*.json files to verify that a build is available for the current platform, and in some cases selects an alternate compatible platform if needed. For example, if the detected platform is for OSX 12+ for the x86_64 architecture, no build is available for binaries such as p4d for that platform, so a compatible alternative is used instead, in this case macosx1015x86_64. This script handles only the UNIX/Linux platforms (to include OSX). RELEASE LIST FILES: For each binary, there is a corresponding release list file (in json format) that indicates the platforms available for the given binary. These files are: P4.json (for the 'p4' binary) P4D.json (for the 'p4d' binary) P4Broker.json (for the 'p4broker' binary) P4Proxy.json (for the 'p4p' binary) These P4*.json release list files are aware of a wide list of supported platforms for a range of P4 binaries. These release list files are packaged with the SDP, and updated for each major release. OPTIONS: -r Specify the P4 Version, using the short form. The form is rYY.N, e.g. r21.2 to denote the 2021.2 release. The default: is r25.1 The form of 'rYY.N', e.g. 'r25.1', is the default form of the version, matching what is used in URLS on the Perforce P4 FTP server. For flexibility, similar forms that clearly convent the intended version are also accepted. For example: '-r 23.1' is implicitly converted to '-r r23.1'. '-r 2023.1' is implicitly converted to ' -r r23.1'. -b [,,...] Specify a comma-delimited list of P4 binaries. The default is: p4 p4d p4broker p4p Alternately, specify '-b none' in conjunction with '-api' to download only APIs and none of the p4* binaries. -api Specify '-api' to download P4API, the C++ client API. This will acquire one or more client API tarballs, depending on the current platform. The API files will look something like these examples: * p4api-glibc2.3-openssl1.1.1.tgz * p4api-glibc2.3-openssl3.tgz * p4api-glibc2.12-openssl1.1.1.tgz * p4api-glibc2.12-openssl3.tgz * p4api-openssl1.1.1.tgz * p4api-openssl3.tgz All binaries that match 'p4api*tgz' in the relevant directory on the Perforce FTP server for the current architecture and P4 version are downloaded. Unlike binary downloads, the old versions are not checked, because file names are fixed as they are with binaries. APIs are not needed for normal operations, and are only downloaded if requested with the '-api' option. They may be useful for developing custom automation such as custom triggers. Be warned, custom triggers are not supported by Perforce Support. -sbd Specify the staging directory to install downloaded binaries. By default, this script downloads files into the current directory, which is expected and required to be /p4/sdp/p4_binaries. Documented workflows for using this script involve first cd'ing to that directory. Using this option disables the expected directory check and allows binaries to be installed in any directory, which may be useful if this script is used as a standalone script outside the SDP (e.g. for setting up test environments or enabling P4 native DVCS features by installing binaries into /usr/local/bin on a non-SDP machine. This option also sets the location in which this script searches for the P4*.json release list files. -p Specify the platform in the format used on the Perforce FTP server, e.g. linux26x86_64 or macosx12arm64. This option is typically unnecessary, as the current platform is reliably detected by the script. This option is used if running on one platform (e.g. a Mac) and and pulling binaries for another platform (say linux26x86_64). If '-p' is omitted, the platform will be detected separately for each binary based on available binaries (per the *.json files). -n Specify the '-n' (No Operation) option to show the commands needed to fetch the P4 binaries from the Perforce FTP server without attempting to execute them. -d Set debugging verbosity. -D Set extreme debugging verbosity using bash 'set -x' mode. Implies '-d'. HELP OPTIONS: -h Display short help message -man Display this manual page EXAMPLES: Example 1 - Typical Usage with no arguments: cd /p4/sdp/p4_binaries ./get_p4_binaries.sh This acquires the latest patch of all 4 binaries for the r25.1 release (aka 2025.1). This will not download APIs, which are not needed for general operation. Example 2 - Specify the major version: cd /p4/sdp/p4_binaries ./get_p4_binaries.sh -r r24.2 This gets the latest patch of for the 2021.2 release of all 4 binaries. Note: Only supported P4 binaries are guaranteed to be available from the Perforce FTP server. Note: Only the latest patch for any given major release is available from the Perforce FTP server. Example 3 - Get r22.2 and skip the proxy binary (p4p): cd /p4/sdp/p4_binaries ./get_p4_binaries.sh -r r22.2 -b p4,p4d,p4broker Example 4 - Download r23.1 binaries in a non-default directory. cd /any/directory/you/want ./get_p4_binaries.sh -r r23.1 -sbd . or: ./get_p4_binaries.sh -r r23.2 -sbd /any/directory/you/want Example 5 - Download C++ client API only: ./get_p4_binaries.sh -r r24.1 -b none -api DEPENDENCIES: This script requires outbound internet access. Depending on your environment, it may also require HTTPS_PROXY to be defined, or may not work at all. If this script doesn't work due to lack of outbound internet access, it is still useful illustrating the locations on the Perforce FTP server where P4 binaries can be found. If outbound internet access is not available, use the '-n' flag to see where on the Perforce FTP server the files must be pulled from, and then find a way to get the files from the Perforce FTP server to the correct directory on your local machine, /p4/sdp/p4_binaries by default. EXIT CODES: An exit code of 0 indicates no errors were encountered. An non-zero exit code indicates errors were encountered.