#!/bin/bash #============================================================================== # Copyright and license info is available in the LICENSE file included with # the P4BBI tool, and also available online: # https://swarm.workshop.perforce.com/view/p4bbi/main/LICENSE #------------------------------------------------------------------------------ # Usage: # cd /p4/p4bbi/test # ./start_p4d.sh [reset] set -u set -e export P4BBI_HOME=${P4BBI_HOME:-Undefined} Version=1.1.3 echo -e "Starting $(basename $0) v$Version at $(date).\n" if [[ $P4BBI_HOME == Undefined ]]; then if [[ -r ../env.sh ]]; then cd .. source "$PWD/env.sh" cd - > /dev/null || exit 1 else echo -e "\nError: The environment is not defined and the env.sh is not available. Aborting.\n" exit 1 fi fi export P4BIN=$P4BBI_BIN/p4 export P4DBIN=$P4BBI_BIN/p4d export P4CONFIG=Undefined export P4ENVIRO=/tmp/FileThatDoesNotExist.$$.$RANDOM # Environment isolation: Clear Perforce environment settings. unset P4AUDIT P4AUTH P4CHANGE P4CONFIG P4DEBUG P4DESCRIPTION P4JOURNAL \ P4LOG P4NAME P4PORT P4ROOT P4SSLDIR P4TARGET P4TICKETS P4TRUST if [[ -z "$P4BIN" || ! -x "$P4BIN" || -z "$P4DBIN" || ! -x "$P4DBIN" ]]; then echo -e "\n\nThe p4d and p4d binaries are missing or are not executable.\nPlease put 'p4' and 'p4d' binaries appropriate to this platform in $P4BBI_BIN.\n\nYou may be able to get them with commands like these samples:\n\n\tcd $P4BBI_BIN\n\twget ftp://ftp.perforce.com/perforce/r15.2/bin.linux26x86_64/p4\n\twget ftp://ftp.perforce.com/perforce/r15.2/bin.linux26x86_64/p4d\n\tchmod +x p4 p4d\n\nAborting.\n\n" exit 1 fi P4BinRev=$($P4BIN -V|grep ^Rev) P4DBinRev=$($P4DBIN -V|grep ^Rev) echo -e "Using these p4/p4d executables:\n$P4BIN: $P4BinRev\n$P4DBIN: $P4DBinRev\n" export P4PORT=$TestP4PORT if [[ -z "$P4DBIN" || -z "$P4BIN" ]]; then echo -e "\nError: P4BIN and/or P4DBIN not defined. Aborting.\n" exit 1 fi P4="$P4BIN -u p4import -p $P4PORT" export TestP4ROOT=$P4BBI_HOME/test/.p4root export P4USER=p4import # The user may specify 'reset' mode on the command line. declare mode=${1:-regular} [[ ! -d "$TestP4ROOT" ]] && mode=reset if [[ $mode == "reset" ]]; then echo "Resetting." $P4 admin stop > /dev/null 2>&1 ||: sleep 1 /bin/rm -rf "$TestP4ROOT" if [[ -d "$TestP4ROOT" ]]; then echo -e "\nError: Could not remove $TestP4ROOT. Aborting." exit 1 fi mkdir "$TestP4ROOT" if [[ ! -d "$TestP4ROOT" ]]; then echo -e "\nError: Could not create $TestP4ROOT. Aborting." exit 1 fi elif [[ -n "$($P4 info -s 2>/dev/null)" ]]; then echo -e "\nError: A Perforce server already running on port $P4PORT. Add 'reset' flag to BLAST and replace it.\n" exit 1 fi Cmd="$P4DBIN -r $TestP4ROOT -p $P4PORT -q -d -v server=4 -L log -J journal" echo -e "Starting p4d:\n$Cmd\n" $Cmd if [[ $mode == "reset" ]]; then echo -e "Initializing the protections table." $P4 protect -o | $P4 protect -i fi Cmd="$P4 configure set net.parallel.max=10" echo -e "Running: $Cmd" $Cmd
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 30973 | C. Thomas Tyler |
Adapting to new home in //p4bbi stream depot. Mostly minor changes to doc links. More significant changes we needed for package_downloads.sh. |
||
#1 | 30968 | C. Thomas Tyler |
Migration from Classic to Streams with: p4 copy -b P4BBI_Classic_to_Streams |
||
//guest/perforce_software/p4bbi/main/test/start_p4d.sh | |||||
#2 | 18506 | C. Thomas Tyler | Released P4BBI/MultiArch/2016.2/18504 (2016/03/04). | ||
#1 | 18412 | C. Thomas Tyler | Released P4BBI. | ||
//guest/perforce_software/p4bbi/dev/test/start_p4d.sh | |||||
#2 | 18402 | C. Thomas Tyler |
bbi.sh v3.5.1: Added support for BRANCH_SPEC, DEPOT_SPEC, and STREAM_SPEC actions, which allow imports to use hand-crafted spec files during imports. This allows the BBI import process to simulate the evolution of stream specs over time, e.g. to reflect reparenting, and to account for things like non-branching files and CBD workflows that use sophisticated, hand-crafted stream specs. The required BBI Config file version has been updated from 3.2 to 3.5. Test suite has been updated to test new functionality. |
||
#1 | 18400 | C. Thomas Tyler |
Related test suit support script start_p4d.sh to test directory, and made modest improvements. |
||
//guest/perforce_software/p4bbi/dev/sample_cfg/start_p4d.sh | |||||
#8 | 16438 | C. Thomas Tyler |
Removed '-special' editions. A bit more copyright cleanup. No functional changes. |
||
#7 | 12497 | C. Thomas Tyler |
Fixed shebang line to explicitly reference /bin/bash rather than /bin/sh. This is safe on Linux and necessary on Mac (at least with 10.10.3 and earlier). |
||
#6 | 12373 | C. Thomas Tyler |
Bug fix: start_p4d.sh reset mode failed unless a p4d was already running. Minor cosmet tweaks. |
||
#5 | 11957 | C. Thomas Tyler | Merge Down using 'p4 merge -b perforce-software-p4bbi-dev' | ||
#4 | 11804 | C. Thomas Tyler | Enhanced error handling. | ||
#3 | 11802 | C. Thomas Tyler | Enhanced environment handling for start_p4d.sh. | ||
#2 | 11773 | C. Thomas Tyler |
Enhanced start_p4d.sh test script. Added P4IGNORE setting to sample P4CONFIG file. |
||
#1 | 11764 | C. Thomas Tyler | Populate -b perforce-software-p4bbi-dev. | ||
//guest/perforce_software/p4bbi/main/sample_cfg/start_p4d.sh | |||||
#1 | 9147 | C. Thomas Tyler | Added inital version of P4BBI to The Perforce Workshop. |