# hms_exe_versions.sh
Version=1.0.1
declare ExeVersionsDataURL="https://updates.perforce.com/static/P4D/P4D.json"
declare ExeVersionsDataFile="${P4TMP:-/tmp}/P4D.json"
declare -i ExeVersionsDownloaded=0
declare -i ExeVersionsDataLoaded=0
#==============================================================================
# Copyright and license info is available in the LICENSE file included with
# the Server Deployment Package (SDP), and also available online:
# https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE
#------------------------------------------------------------------------------
#==============================================================================
# HMS Library Functions.
#------------------------------------------------------------------------------
# get_latest_exe_version (Exe, Platform)
#
# Input:
# $1 - Exe name, e.g. 'p4d', 'p4broker', etc.
# $2 - Platform (optional), e.g. 'linux2x6x86_64'; this value is the default.
#------------------------------------------------------------------------------
function get_latest_exe_version () {
vvmsg "CALL: get_latest_exe_version ($*)"
declare Exe="${1:-Unset}"
declare Platform="${2:-linux26x86_64}"
}
#------------------------------------------------------------------------------
# get_latest_exe_minor_version (Exe, MajorVersion, Platform)
#
# Input:
# $1 - Exe name, e.g. 'p4d', 'p4broker', etc.
# $2 - MajorVersion, e.g. 'r20'
# $3 - Platform (optional), e.g. 'linux2x6x86_64'; this value is the default.
#------------------------------------------------------------------------------
function get_latest_exe_patch_version () {
vvmsg "CALL: get_latest_exe_patch_version ($*)"
declare Exe="${1:-Unset}"
declare MajorVersion="${2:-Unset}"
declare Platform="${3:-linux26x86_64}"
}
#------------------------------------------------------------------------------
# get_latest_exe_patch_version (Exe, MajorVersion, MinorVersion, Platform)
#
# Input:
# $1 - Exe name, e.g. 'p4d', 'p4broker', etc.
# $2 - MajorVersion, e.g. 'r20'
# $3 - MinorVersion, e.g. '1' (the '1' in 'r20.1').
# $4 - Platform (optional), e.g. 'linux2x6x86_64'; this value is the default.
#------------------------------------------------------------------------------
function get_latest_exe_patch_version () {
vvmsg "CALL: get_latest_exe_patch_version ($*)"
declare Exe="${1:-Unset}"
declare MajorVersion="${2:-Unset}"
declare MinorVersion="${3:-Unset}"
declare Platform="${4:-linux26x86_64}"
}
#------------------------------------------------------------------------------
function download_versions_data () {
if [[ -r "$ExeVersionsDataFile" ]]; then
msg "Using existing versions data file: $ExeVersionsDataFile"
return
fi
cd "${P4TMP:-/tmp}" || return 1
if curl -s -k -O "$ExeVersionsDataURL"; then
msg "Downloaded $PWD/${ExeVersionsDataFile##*/}"
else
errmsg "Failed to download from URL: $ExeVersionsDataURL"
cd - /dev/null 2>&1 ||:
return 1
fi
cd - > /dev/null 2>&1 ||:
}
#------------------------------------------------------------------------------
function load_exe_versions () {
declare -i Force="${1:-0}"
if [[ "$Force" -eq 1 || ! -r "$ExeVersionsDataFile" ]]; then
download_versions_data
fi
}
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #6 | 29182 | C. Thomas Tyler |
Moved HMS files from /p4/common/bin -> /p4/common/site/bin. Moved HMS files from /p4/common/lib -> /p4/common/site/lib. Removed dependency on SDP libs so that HMS can be deployed with a wider variety of SDP versions. |
||
| #5 | 27748 | C. Thomas Tyler |
First pass at "outer to inner" implementation, adding a new test for same. Removed some DEMO HACK code; more to be removed. |
||
| #4 | 27694 | C. Thomas Tyler | Copyright Update; non-functional change. | ||
| #3 | 27310 | C. Thomas Tyler | Enhanced assignment per shellcheck. | ||
| #2 | 26713 | C. Thomas Tyler |
WIP. Logic now supports downloading version data files published to updates.perforce.com. |
||
| #1 | 26538 | C. Thomas Tyler | Added preliminary files contributing to "hms upgrade", etc. |