sdp_info.sh #3

  • //
  • p4-sdp/
  • dev_rebrand/
  • Server/
  • Unix/
  • p4/
  • common/
  • bin/
  • triggers/
  • sdp_info.sh
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/bin/bash
#------------------------------------------------------------------------------
# Copyright and license info is available in the LICENSE file included with
# the Server Deployment Package (SDP), and also available online:
# https://workshop.perforce.com/view/p4-sdp/main/LICENSE
#------------------------------------------------------------------------------
set -u

# Version ID Block. Relies on +k filetype modifier.
#------------------------------------------------------------------------------
# shellcheck disable=SC2016
declare VersionID='$Id: //p4-sdp/dev_rebrand/Server/Unix/p4/common/bin/triggers/sdp_info.sh#3 $ $Change: 31617 $'
declare VersionStream=${VersionID#*//}; VersionStream=${VersionStream#*/}; VersionStream=${VersionStream%%/*};
declare VersionCL=${VersionID##*: }; VersionCL=${VersionCL%% *}
declare Version=${VersionStream}.${VersionCL}
[[ "$VersionStream" == r* ]] || Version="${Version^^}"

#------------------------------------------------------------------------------
# Install in the Triggers table like so:
# Triggers:
# 	SDPInfo command post-user-info "/p4/common/bin/triggers/sdp_info.sh %clientprog%"
#
# This script appends the content of the SDP Version file, /p4/sdp/Version, to
# the 'p4 info' output.
#
# This also appends the content of an optional message-of-the-day (motd) file
# to 'p4 info' output.

declare ThisScript=${0##*/}
declare SDPVersionFile="/p4/sdp/Version"
declare SDPMessageOfTheDayFile="/p4/common/site/config/motd.txt"
declare ClientProg="${1:-}"

if [[ "$@" =~ -V ]]; then
   echo "$ThisScript version $Version"
   exit 0
fi

if [[ "${ClientProg:-}" == "p4" ]]; then
   if [[ -r "$SDPVersionFile" ]]; then
      echo "SDP Version: $(cat "$SDPVersionFile")"
   else
      echo "SDP Version: Unknown; missing SDP Version File: $SDPVersionFile"
   fi

   if [[ -r "$SDPMessageOfTheDayFile" ]]; then
      cat "$SDPMessageOfTheDayFile"
   fi
fi

exit 0
# Change User Description Committed
#3 31617 C. Thomas Tyler Merged work from dev_c2s (development) stream to sibling dev_rebrand (sparsedev) stream.
#2 31615 C. Thomas Tyler First pass at rebranding changes, including:
* Changes to remove 'swarm.' from Workshop URLS, so swarm.workshop -> workshop.
* Changed URL for Copyright.
* Renamed get_helix_binaries.sh -> get_p4_binaries.sh, with associated directory and doc changes.
* Accounted for rename of HAS -> P4AS.
* Changed HMS references to P4MS.
* Replaced "Helix" and "Helix Core" references.
* Renamed variables to reduce tech debt buildup induced by rebranding.
* Changed default mount points:
/hxdepots[-1,N] -> /p4depots[-1,N]
/hxmetadata[1,2] -> /p4db[-1,2]
/hxlogs -> /p4logs

Also made some changes related to rebranding going out with r25.1.
#1 31591 C. Thomas Tyler Populate stream //p4-sdp/dev_rebrand from //p4-sdp/dev.
//p4-sdp/dev/Server/Unix/p4/common/bin/triggers/sdp_info.sh
#1 31397 C. Thomas Tyler Populate -b SDP_Classic_to_Streams -s //guest/perforce_software/sdp/...@31368.
//guest/perforce_software/sdp/dev/Server/Unix/p4/common/bin/triggers/sdp_info.sh
#3 31108 C. Thomas Tyler Changed the SDPInfo trigger to display the additional output
only if the client program calling the trigger is 'p4'.

This fixes an issue where installing the trigger causes a
Swarm crash.
#2 30819 C. Thomas Tyler Added prefix 'SDP Version:'
#1 30802 C. Thomas Tyler Added sdp_info.sh script to the SDP.
It appends contents of /p4/sdp/Version to 'p4 info' output.
If that file does not exist, a message is displayed indicating it is missing.
It also displays the contents of an optional Message of the Day file.

#review-30803