sdp_info.sh #2

  • //
  • guest/
  • perforce_software/
  • sdp/
  • main/
  • Server/
  • Unix/
  • p4/
  • common/
  • bin/
  • triggers/
  • sdp_info.sh
  • View
  • Commits
  • Open Download .zip Download (1 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://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE
#------------------------------------------------------------------------------
set -u

#------------------------------------------------------------------------------
# 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 SDPVersionFile="/p4/sdp/Version"
declare SDPMessageOfTheDayFile="/p4/common/site/config/motd.txt"
declare ClientProg="${1:-}"

echo "$@" >> /tmp/foolog

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
#2 31204 Will Kreitzmann Released SDP 2024.2.31193 (2025/01/17).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
#1 30915 C. Thomas Tyler Released SDP 2024.1.30913 (2024/11/20).
Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'.
//guest/perforce_software/sdp/dev/Server/Unix/p4/common/bin/triggers/sdp_info.sh
#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