#!/bin/bash #============================================================================== # Copyright and license info is available in the LICENSE file included with # this package, and also available online: # https://swarm.workshop.perforce.com/view/guest/perforce_software/helix-installer/main/LICENSE #------------------------------------------------------------------------------ #============================================================================== # Declarations set -u declare Version=3.6.3 # The tar file specified here is used if the '-t' flag is used to # specify installing from a tar file, which is good for getting a known, # fixed version of the SDP to work with. The default install method # uses Helix DVCS features to get the very latest code from a branch # ('main' by default, but '-b dev' could be specified as well) by doing # a 'p4 clone' command. Alternately, the '-d' flag can be used to copy # from a loal directory. declare SDPTar="sdp.Unix.2019.2.25594.tgz" declare SDPDir="/sdp" declare SDPURL="https://swarm.workshop.perforce.com/projects/perforce-software-sdp/download/downloads/$SDPTar" declare SDPInstallMethod=DVCS declare SDPInstallBranch=Unset declare FTPURL="http://ftp.perforce.com/perforce" declare WorkshopPort="public.perforce.com:1666" declare WorkshopUser=ftp declare WorkshopRemote= declare HelixInstallerBaseURL="https://swarm.workshop.perforce.com/download/guest/perforce_software/helix-installer" declare HelixInstallerBranch="main" declare HelixInstallerURL="$HelixInstallerBaseURL/$HelixInstallerBranch" declare HelixInstallerFileURL= declare HxDepots=/hxdepots declare HelixInstallerFiles="NoTicketExpiration.group.p4s admin.user.p4s configure_sample_depot_for_sdp.sh p4broker_N.service.t p4broker_N.xml.t p4d_N.service.t p4d_N.xml.t p4p_N.service.t perforce_bash_profile perforce_bashrc protect.p4s r" declare ResetHome="$HxDepots/reset" declare HxMetadata=/hxmetadata declare HxLogs=/hxlogs declare SDPHome="$HxDepots/sdp" declare TmpFile=/tmp/tmp.reset_sdp.$$.$RANDOM declare TmpDir=/tmp/tmp.dir.reset_sdp.$$.$RANDOM declare ShelvedChange=Unset declare LocalShelvedChange=Unset declare CmdLine="${0##*/} $*" declare -i WarningCount=0 declare -i ErrorCount=0 declare InitMechanism=Unset declare PackageManager=Unset declare -A PackageList PackageList['yum']="curl gcc gcc-c++ make openssl openssl-devel rsync wget zlib zlib-devel" PackageList['apt-get']="build-essential libssl-dev make zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev" PackageList['zypper']="curl gcc gcc-c++ make openssl openssl-devel wget zlib zlib-devel" declare -A Config ConfigDoc ConfigDoc['DNS_name_of_master_server']="\\n# Specify the DNS alias to refer to he master server, e.g. by end\\n# users. This might be 'perforce' but probably not an actual host name\\n# like 'perforce01', which would be known only to admins." Config['DNS_name_of_master_server']="helix" ConfigDoc['P4AdminList']="\\n# Specify an email address to receive updates from admin scripts. This may be\\n# a distribution list or comma-separated list of addresses (with no spaces)." Config['P4AdminList']="P4AdminList@p4demo.com" ConfigDoc['MailFrom']="\\n# Specify an email address from which emails from admin scripts are sent.\\n# This must be a single email address." Config['MailFrom']="P4Admin@p4demo.com" ConfigDoc['SMTPServer']="\\n# Specify email server for the p4review script. Ignore if Helix Swarm is used." Config['SMTPServer']="smtp.p4demo.com" ConfigDoc['Password']="\\n# Set the admin password. If using this Helix Installer to bootstrap a\\n# production installation, replace this default password with your own." Config['Password']="F@stSCM!" ConfigDoc['P4_PORT']="\\n# Specify the TCP port for p4d to listen on. Typically this is 1999 if \\n# p4broker is used, or 1666 if only p4d is used." Config['P4_PORT']="1999" ConfigDoc['P4BROKER_PORT']="\\n# Specify the TCP port for p4broker to listen on. Must be different\\n# from the P4_PORT." Config['P4BROKER_PORT']="1666" ConfigDoc['SiteTag']="\\n# Specify a geographic site tag for the master server location,\\n# e.g. 'bos' for Boston, MA, USA." Config['SiteTag']="bos" ConfigDoc['SimulateEmail']="\\n# Specify '1' to avoid sending email from admin scripts, or 0 to send\\n# email from admin scripts." Config['SimulateEmail']="1" ConfigDoc['Instance']="\\n# Specify SDP instance name, e.g. '1' for /p4/1." Config['Instance']="1" ConfigDoc['CaseSensitive']="\\n# Helix Core case sensitivity, '1' (sensitive) or '0' (insensitive)." Config['CaseSensitive']="1" declare ExesDir=$HxDepots/exes declare DownloadsDir=$HxDepots/downloads declare -i BlastDownloadsAndExes=0 declare -i StopAfterReset=0 declare -i ExtremeCleanup=0 declare -i FastMode=0 declare -i LoadSampleDepot=1 declare -i PullFromWebAsNeeded=1 declare -i UseSSL=1 declare -i GenDefaultConfig=0 declare -i UseConfigFile=0 declare ConfigFile=Unset declare PreserveDirList=Unset declare P4ExeRel=r19.1 declare P4DExeRel=$P4ExeRel declare P4PExeRel=$P4ExeRel declare P4BrokerExeRel=$P4ExeRel declare P4Rel=r19.1 declare RunUser=perforce declare RunUserHomeDir= declare RunGroup= declare SudoersFile="/etc/sudoers.d/$RunUser" declare SudoersEntry="$RunUser ALL=(ALL) NOPASSWD: ALL" declare P4YumRepo="/etc/yum.repos.d/perforce.repo" declare P4AptGetRepo="/etc/apt/sources.list.d/perforce.list" # For the Perforce Package Repository, we use https for the # pubkey, and http (per docs) for the base URL. declare PerforcePackageRepoURL="http://package.perforce.com" declare PerforcePackagePubkeyURL="${PerforcePackageRepoURL/http:/https:}/perforce.pubkey" declare TmpPubKey=/tmp/perforce.pubkey declare SampleDepotTar= declare ApiArch= declare ThisArch= declare ThisHost= declare ThisOS= declare ThisOSName= declare ThisOSDistro= declare ThisOSMajorVersion= declare FirewallType= declare FirewallDir= declare ThisUser= declare RunArch="x86_64" declare CBIN="/p4/common/bin" declare CCFG="/p4/common/config" declare SDPSetupDir="$SDPHome/Server/Unix/setup" declare SDPConfigDir="$SDPHome/Server/Unix/p4/common/config" declare ThisScript="${0##*/}" declare SDPInstances="1" declare SDPDefaultInstance= declare OSTweaksScript="$SDPSetupDir/os_tweaks.sh" #------------------------------------------------------------------------------ # Function: usage (required function) # # Input: # $1 - style, either -h (for short form) or -man (for man-page like format). #------------------------------------------------------------------------------ function usage { declare style=${1:--h} msg "USAGE for $ThisScript v$Version: $ThisScript [-B|-local] [-fast] [-no_ssl] [-no_sd] [-c <cfg>] [-b <branch>[,@cl] | -t <tarfile> | -d <sdp_dir>] [-p <dir1>[,<dir2>,...]>] [-i <helix_installer_branch>] [-D] [-X|-R] or $ThisScript -C > ${ThisScript/sh/cfg} or $ThisScript [-h|-man] " if [[ $style == -man ]]; then msg " SAFETY NOTICE: This script SHOULD NEVER EXIST on a Production Perforce server. DESCRIPTION: This script simplifies the process of testing an SDP installation, repetitively blasting all process by the 'perforce' user and resetting the SDP from the ground up, blasting typical SDP folders each time. It installs the Perforce Helix Core server (P4D) with a P4Broker, and installs the Perforce Sample Depot data set used for training and PoC installations. It is helpful when bootstrapping a demo server with a sample data set, complete with broker, and optionally Perl/P4Perl and Python/P4Python. This script handles all aspects of installation. It does the following: * Creates the perforce OS user, if needed. * Creates the home directory for the perforce user, if needed. * Adds OS packages as needed for P4Perl/P4Python local builds. Following installation, it also does the following to be more convenient for demos, and also give a more production-like feel: * Grants the perforce user sudo access. * Creates default ~perforce/.bash_profile and .bashrc files. * Connects to the Perforce Package Repository (APT and YUM only). PLATFORM SUPPORT: This works on Red Hat Enterprise Linux, CentOS, and Mac OSX 10.10+ thru Mojave platforms. It works on RHEL/CentOS 6.4-7.6, SuSE Linux 12, and likely on Ubuntu 18 and other Linux distros with little or no modification. This script currently supports the bin.linux26x86_64 (Linux) and bin.maxosx1010x86_64 (Mac OSX/Darwin) architectures. This script recognizes SysV, Systemd, and Launchd init mechanisms, though does not currently support Launchd on OSX. For Mac OSX, note that this requires bash 4.x, and the default bash on Mac OSX remains 3.x as of OSX Mojave. For operating on Mac, the /bin/bash shebang line needs to be adjusted to reference a bash 4 version, e.g. /usr/local/bin/bash if installed with Homebrew. REQUIREMENTS: The following OS packages are installed (unless '-fast' is used): * Yum: ${PackageList[yum]} * AptGet: ${PackageList[apt-get]} * Zypper: ${PackageList[zypper]} Development utilities such as 'make', the 'gcc' compiler, and 'curl' must be installed and available in the PATH (unless running with '-fast'). The package installation as noted above generally ensures these dependencies are available. OPTIONS: -c <cfg> Specify a config file. By default, values for various settings such as the email to send script logs to are configure with demo values, e.g. ${Config['P4AdminList']}. Optionally, you can specify a config file to define your own values. For details on what settings you can define in this way, run: $ThisScript -C > ${ThisScript/sh/cfg} Then modify the generated config file as desired. The generated config file contains documentation on settings and values. If no changes are made to the generated file, running with '-c ${ThisScript/sh/cfg}' is the equivalent of running without using '-c' at all. -C See '-c <cfg>' above. -B Specify '-B' to blast base SDP dirs, for a clean start. Otherwise without '-B', downloaded components from earlier runs will be used (which should be fine if they were run recently). The '-B' flag also replaces files in the $ResetHome directory, where this script lives, with those downloaded from The Workshop (the versions of which are affected by the '-i <helix_installer_branch>' flag, described below). The '-B' flag also blasts the /tmp/downloads and /tmp/p4perl directories, used by install_sdp_python.sh and install_sdp_perl.sh, if they exist. -local By default, various files and executables are downloaded from the Perforce Workshop or the Perforce FTP server as needed. With '-local', any missing files are treated as an error condition. The '-B', '-R', and '-local' arguments are mutually exclusive. -fast Specify '-fast' to skip installation SDP Perl and SDP Python, to include P4Perl and P4Python. The '-fast' argument changes a check for GCC/G++ from a fatal error to a warning message. The '-fast' option typically takes just a few minutes, as compared to 20+ minutes without due to the time needed to compile and test the Perl and Python bits. The '-fast' flag should not be used if you plan to deploy or develop triggers that use P4Python or P4Perl, such as the SDP CheckCaseTrigger.py. Alternately, you can run with '-fast', and then afterward run the following as the OS user $RunUser: cd $SDPSetupDir ./install_sdp_python.sh ./install_sdp_perl.sh -no_ssl By default, the Perforce server is setup SSL-enabled. Specify '-no_ssl' to avoid using SSL feature. -no_sd By default, the Perforce Sample Depot data set is loaded. Specify '-no_sd' to skip loading the Sample Depot. -p <dir1>[,<dir2>,...]>] Specify a comma-delimited list of directories under /p4/common to preserve that would otherwise be removed. Directories must be specified as paths relative to /p4/common, and cannot contain spaces. For example, the value '-p config,bin/triggers' would preserve the /p4/common/config and /p4/common/bin/triggers directories. Directories specified are moved aside to a temporary working area before the SDP folders are removed. After installation, they are moved back via an 'rsync' command with no '--delete' option. This means any files that overlap with the stock install are replaced by ones that originally existed, but non-overlapping files are not removed. This is intended to be useful for developing test suites that install server under /p4/common/bin, e.g. Component Based Development scripts which install under /p4/common/bin/cbd would use '-p bin/cbd'. -b <branch>[,@cl] The default SDP install method is to clone the SDP from the main branch in The Workshop ($WorkshopPort). Specify '-b' to use a different branch, e.g. 'dev'. If '-b' is specified with the optional @cl syntax, where @cl specifies a changelist with files shelved on the given branch, a form of unshelving is done, enabling a workflow for testing shelved changes with the Helix Installer. So for example, specify '-b dev,@23123' to clone from the dev branch, and then followed by a fetch of shelved changelist @23123, which is expected to have files shelved in the dev branch. -t <tarfile> Specify a tarfile to use, e.g. '-t sdp.Unix.2017.3.23041.tgz', or use the special value '-t default' to use the default SDP tarfile, $SDPTar The specified tar file must exist here: https://swarm.workshop.perforce.com/projects/perforce-software-sdp/files/downloads Use '-t' to get a known version of the SDP for testing. Avoid '-t' to test with the very latest SDP from a given branch (see '-b' above for more info), even if the latest has not yet been packaged into a distribution tar file. -d <sdp_dir> Specify a directory on the local host containing the SDP to deploy. Use the special value '-d default' to use the /sdp directory (as per the Docker-based SDP Test Suite environment). If neither '-t <tarfile>' nor '-d <sdp_dir>' are specified, default install method is used instead, which is to clone the SDP from The Workshop (P4PORT=$WorkshopPort). DEBUGGING OPTIONS: -i <helix_installer_branch> Specify the branch of the Helix Installer to use. This affects the URL from which Helix Installer files in $ResetHome are pulled from The Workshop. The default is main; an alternative is '-i dev'. -D Set extreme debugging verbosity. -X Extreme reset. This removes the user accout for $RunUser and blasts all SDP-related directories at the start of script operations, including the $RunUser home directory. Using '-X' does not blast the Helix Installer downloads or exes directories, and thus is compatible with either the '-B' or '-local' options. -R Specify '-R' to reset. The cleanup logic is the same as with -X. Processing stops after the cleanup is done. HELP OPTIONS: -h Display short help message -man Display man-style help message EXAMPLES: === FAST INSTALLATION (skipping Perl, Python) === su - mkdir -p /hxdepots/reset cd /hxdepots/reset curl -k -s -O $HelixInstallerURL/src/$ThisScript curl -k -s -O $HelixInstallerURL/src/r chmod +x ${ThisScript} r ./r Note that the 'r' wrapper script calls the $ThisScript script with a pre-defined of flags optimized for fast opreration. The 'r' wapper also handles log capture, writing to the file '${ThisScript/sh/log}'. === COMPREHENSIVE INSTALLATION === su - mkdir -p /hxdepots/reset cd /hxdepots/reset curl -k -s -O $HelixInstallerURL/src/$ThisScript chmod +x $ThisScript ./$ThisScript 2>&1 | tee ${ThisScript/sh/log} === CONFIGURED INSTALLATION === su - mkdir -p /hxdepots/reset cd /hxdepots/reset curl -k -s -O $HelixInstallerURL/src/$ThisScript chmod +x $ThisScript ### Generate a default config file: ./$ThisScript -C > ${ThisScript/sh/cfg} ### Edit ${ThisScript/sh/cfg}, changing the values as desired: vi ${ThisScript/sh/cfg} ./$ThisScript -c ${ThisScript/sh/cfg} 2>&1 | tee log.reset_sdp === SDP DEV BRANCH TESTING === The Helix Installer can be used to test SDP changes shelved to the SDP dev branch in The Workshop. The following example illustrates testing a change in shelved changelist 23123: su - mkdir -p /hxdepots/reset cd /hxdepots/reset curl -k -s -O $HelixInstallerURL/src/reset_sdp.sh ./reset_sdp.sh -b dev,@23123 2>&1 | tee log.reset_sdp.CL23123 After the first test, an iterative test cycle may follow on the same shelved changelist. For each test iteration, the shelved changelist is first updated in the workspace from which the change was originally shelved, e.g. with a command like 'p4 shelve -f -c 23123'. Then a new test can be done by calling reset_sdp.sh with the same arguments. The script will re-install the SDP cleanly, and then re-apply the updated shelved changelist. === SDP TEST SUITE SUPPORT === The Helix Installer can install the SDP in the Docker-based SDP Test Suite. In that environment, the directory /sdp appears on the test VMs, shared from the host machine. To deploy that SDP, use the '-d <sdp_dir>' flag, something like this: ./reset_sdp.sh -d /sdp -fast 2>&1 | tee log.reset_sdp.test " fi exit 1 } #------------------------------------------------------------------------------ # Functions msg(), dbg(), and bail(). # Sample Usage: # bail "Missing something important. Aborting." # bail "Aborting with exit code 3." 3 function msg () { echo -e "$*"; } function warnmsg () { msg "\\nWarning: ${1:-Unknown Warning}\\n"; WarningCount+=1; } function errmsg () { msg "\\nError: ${1:-Unknown Error}\\n"; ErrorCount+=1; } function dbg () { msg "DEBUG: $*" >&2; } function bail () { errmsg "${1:-Unknown Error}"; exit "${2:-1}"; } #------------------------------------------------------------------------------ # Functions run($cmd, $desc) # # This function is similar to functions defined in SDP core libraries, but we # need to duplicate them here since this script runs before the SDP is # available on the machine (and we require dependencies for this # script). function run { cmd="${1:-echo Testing run}" desc="${2:-}" [[ -n "$desc" ]] && msg "$desc" msg "Running: $cmd" $cmd CMDEXITCODE=$? return $CMDEXITCODE } #============================================================================== # Command Line Processing declare -i shiftArgs=0 set +u while [[ $# -gt 0 ]]; do case $1 in (-B) BlastDownloadsAndExes=1;; (-local) PullFromWebAsNeeded=0;; (-fast) FastMode=1;; (-no_ssl) UseSSL=0;; (-no_sd) LoadSampleDepot=0;; (-C) GenDefaultConfig=1;; (-c) ConfigFile="$2"; UseConfigFile=1; shiftArgs=1;; (-t) SDPInstallMethod=Tarfile [[ "$2" == "default" ]] || SDPTar="$2" shiftArgs=1 ;; (-d) SDPInstallMethod=Copy [[ "$2" == "default" ]] || SDPTar="$2" shiftArgs=1 ;; (-b) if [[ "$2" == *",@"* ]]; then SDPInstallBranch=${2%%,@*}; ShelvedChange=${2##*,@} else SDPInstallBranch=$2; fi shiftArgs=1 ;; (-p) PreserveDirList=$2; shiftArgs=1;; (-h) usage -h;; (-man) usage -man;; (-D) set -x;; # Debug; use 'set -x' mode. (-X) ExtremeCleanup=1;; (-R) ExtremeCleanup=1; StopAfterReset=1;; (-i) HelixInstallerBranch="$2"; shiftArgs=1;; (*) bail "Usage Error: Unknown arg ($1).";; esac # Shift (modify $#) the appropriate number of times. shift; while [[ $shiftArgs -gt 0 ]]; do [[ $# -eq 0 ]] && bail "Usage Error: Wrong number of args or flags to args." shiftArgs=$shiftArgs-1 shift done done set -u #------------------------------------------------------------------------------ # Command Line Validation [[ "$UseConfigFile" -eq 1 && "$GenDefaultConfig" -eq 1 ]] && \ bail "The '-c <cfg>' and '-C' options are mutually exclusive." #------------------------------------------------------------------------------ # Main Program ThisUser="$(whoami)" ThisOS="$(uname -s)" ThisArch="$(uname -m)" ThisHost="$(hostname -s)" declare -i CMDEXITCODE #------------------------------------------------------------------------------ # Special Mode: Generate Default Config File # In this mode, generate a sample config file on stdout, and exit. if [[ "$GenDefaultConfig" -eq 1 ]]; then echo -e " # Config file for $ThisScript v$Version. # This file is in bash shell script syntax. # Avoid spaces before and after the '=' sign." for c in "${!Config[@]}"; do echo -e "${ConfigDoc[$c]}" echo "$c=${Config[$c]}" done exit 0 fi #------------------------------------------------------------------------------ # Regular processing mode. msg "Started $ThisScript v$Version on host $ThisHost at $(date), called as:\\n\\t$CmdLine" if [[ "$UseConfigFile" -eq 1 ]]; then [[ -r "$ConfigFile" ]] || \ bail "Config file specified with '-c $ConfigFile' is not readable." for c in "${!Config[@]}"; do value=$(grep ^$c= "$ConfigFile") value="${value#*=}" Config[$c]="$value" done SDPInstances="${Config['Instance']}" fi SDPDefaultInstance="${SDPInstances%% *}" # Get just enough detailed OS info in order to fill in # details in the Perforce pacakge repository files. if [[ "$ThisOS" == "Linux" ]]; then if [[ -r "/etc/redhat-release" ]]; then if grep ' 6\.' /etc/redhat-release > /dev/null; then ThisOSMajorVersion="6" elif grep ' 7\.' /etc/redhat-release > /dev/null; then ThisOSMajorVersion="7" fi [[ -n "$ThisOSMajorVersion" ]] || \ warnmsg "Could not determine OS Major Version from contents of /etc/redhat-release." elif [[ -r "/etc/lsb-release" ]]; then ThisOSName=$(grep ^DISTRIB_ID= /etc/lsb-release) ThisOSName=${ThisOSName#*=} ThisOSName=${ThisOSName,,} ThisOSDistro=$(grep ^DISTRIB_CODENAME= /etc/lsb-release) ThisOSDistro=${ThisOSDistro#*=} [[ -n "$ThisOSName" && -n "$ThisOSDistro" ]] || \ warnmsg "Could not determine OS Name and Distro from contents of /etc/lsb-release." fi if [[ -r "/etc/firewalld/services" ]]; then FirewallType="Firewalld" FirewallDir="/etc/firewalld/services" elif [[ -r "/etc/sysconfig/iptables" ]]; then FirewallType="IPTables" FirewallDir="/etc/sysconfig" fi fi if [[ "$ThisUser" != root ]]; then bail "Run as root, not $ThisUser." else msg "Verified: Running as root user." fi [[ "$BlastDownloadsAndExes" -eq 1 && "$PullFromWebAsNeeded" -eq 0 ]] && \ bail "The '-B/-R' and '-local' arguments are mutually exclusive." [[ "$SDPInstallBranch" != "Unset" && "$SDPInstallMethod" == "Tarfile" ]] && \ bail "The '-b <branch>' and '-t <tarfile>' arguments are mutually exclusive." [[ "$SDPInstallBranch" != "Unset" && "$SDPInstallMethod" == "Copy" ]] && \ bail "The '-b <branch>' and '-d <sdp_dir>' arguments are mutually exclusive." [[ "$SDPInstallBranch" == Unset ]] && SDPInstallBranch=main HelixInstallerURL="$HelixInstallerBaseURL/$HelixInstallerBranch" #------------------------------------------------------------------------------ # Self-update cd "$ResetHome" || bail "Could not cd to $HxDepots/ResetHome. Aborting." msg "\\nEnsuring Helix Installer files are available." for f in $HelixInstallerFiles; do HelixInstallerFileURL="$HelixInstallerURL/src/$f" if [[ ! -f "$f" ]]; then [[ "$PullFromWebAsNeeded" -eq 0 ]] && bail "Missing Helix Installer file [$f] and '-local' specified. Aborting." run "curl -k -s -O $HelixInstallerFileURL" "Getting file $f." ||\ bail "Failed to download from [$HelixInstallerFileURL]. Aborting." else if [[ "$BlastDownloadsAndExes" -eq 1 ]]; then run "curl -k -s -O $HelixInstallerFileURL" \ "Replacing Helix Installer file $f due to '-B'." ||\ bail "Failed to download file [$PWD/$f]. Aborting." else msg "Using existing Helix Installer file $PWD/$f." fi fi if [[ ! -x "$f" ]]; then if [[ "$f" == *".sh" || "$f" == r ]]; then run "chmod +x $f" "chmod +x" || bail "Failed to do: chmod +x $f. Aborting." fi fi done run "chown -R $RunUser:$RunGroup $ResetHome" "Fixing ownership of $ResetHome" ||: #------------------------------------------------------------------------------ # Extreme Cleanup with -X if [[ "$ExtremeCleanup" -eq 1 ]]; then msg "\\nStarted Extreme Cleanup due to -X." if id -u "$RunUser" > /dev/null 2>&1; then RunUserHomeDir="$(eval echo ~$RunUser)" run "pkill -9 -u $RunUser" "Blasting processes by OS user $RunUser." ||\ warnmsg "Failed to blast all processes by OS user $RunUser." sleep 1 run "userdel $RunUser" "Removing OS user $RunUser." ||\ warnmsg "Failed to remove OS user $RunUser." run "/bin/rm -rf $RunUserHomeDir" "Removing home dir $RunUserHomeDir" ||\ warnmsg "Failed to remove $RunUserHomeDir." else msg "Extreme Cleanup: OS User $RunUser does not exist." fi run "/bin/rm -rf /p4 $HxDepots/p4 $HxMetadata/p4 $HxLogs/p4" \ "Extreme Cleanup: Blasting several SDP dirs." ||\ warnmsg "Failed to blast some SDP dirs." if [[ "$StopAfterReset" -eq 0 ]]; then msg "Extreme Cleanup complete. Continuing.\\n" else msg "Extreme Cleanup complete. Stopping.\\n" exit 0 fi fi #------------------------------------------------------------------------------ # Digital asset acquisition and availability checks. [[ ! -d "$HxDepots" ]] && run "/bin/mkdir -p $HxDepots" cd "$HxDepots" || bail "Could not cd to [$HxDepots]." if command -v yum > /dev/null; then PackageManager="yum" elif command -v apt-get > /dev/null; then PackageManager="apt-get" elif command -v zypper > /dev/null; then PackageManager="zypper" fi if [[ -d "/etc/systemd/system" ]]; then InitMechanism="Systemd" elif [[ -x "/sbin/launchd" ]]; then InitMechanism="Launchd" elif [[ -d "/etc/init.d" ]]; then InitMechanism="SysV" fi if [[ "$FastMode" -eq 0 ]]; then msg "Ensuring needed packages are installed." if [[ "$ThisOS" != "Darwin" ]]; then [[ "$PackageManager" == "Unset" ]] && \ bail "Could not find one of these package managers: ${!PackageList[*]}" run "$PackageManager install -y ${PackageList[$PackageManager]}" \ "Installing these pacakges with $PackageManager: ${PackageList[$PackageManager]}" ||\ warnmsg "Not all packages installed successfully. Proceeding." msg "Skipping package dependency checks in -fast mode." if ! command -v gcc > /dev/null || ! command -v g++ > /dev/null; then msg "Warning: No gcc found in the path. You may need to install it. Please\\n check that the gcc and gcc-c++ packages are\\n installed, e.g. with:\\n\\t$PackageManager install -y gcc gcc-c++\\nIgnoring missing gcc/g++ due to '-fast'.\\n" else msg "Verified: gcc and g++ are available and in the PATH." fi else warnmsg "Skipping package handling on Mac OSX/$ThisOS." fi fi if [[ "$PullFromWebAsNeeded" -eq 1 ]]; then if ! command -v curl > /dev/null; then bail "No 'curl' found in the path. You may need to install it or adjust the PATH for the root user to find it.\\n\\n" fi fi if ! command -v su > /dev/null; then bail "No 'su' found in the path. You may need to install it or adjust the PATH for the root user to find it.\\n\\n" fi if [[ "$ThisArch" == "$RunArch" ]]; then msg "Verified: Running on a supported architecture [$ThisArch]." ApiArch=UNDEFINED_API_ARCH case $ThisOS in (Darwin) ApiArch="macosx1010x86_64" RunGroup=staff SampleDepotTar=sampledepot.mac.tar.gz ;; (Linux) ApiArch="linux26x86_64" if [[ -r "/etc/SuSE-release" ]]; then RunGroup=users else # CentOS, RHEL, and Ubuntu default group is same as user name. RunGroup=perforce fi SampleDepotTar=sampledepot.tar.gz ;; (*) bail "Unsupported value returned by 'uname -m': $ThisOS. Aborting.";; esac else bail "Running on architecture $ThisArch. Run this only on hosts with '$RunArch' architecture. Aborting." fi # In this block, we just check that directories specified to be preserved # with the '-p' flag actually exist, in which case we abort before further # processing. if [[ "$PreserveDirList" != Unset ]]; then for d in $(echo "$PreserveDirList"| tr ',' ' '); do preserveDir="$HxDepots/p4/common/$d" if [[ -d "$preserveDir" ]]; then parentDir=$(dirname "$TmpDir/$d") if [[ ! -d "$parentDir" ]]; then run "/bin/mkdir -p $parentDir" "Creating parent temp dir [$parentDir]." ||\ bail "Failed to create parent temp dir [$parentDir]." fi fi done fi if [[ "$BlastDownloadsAndExes" -eq 1 ]]; then if [[ -d "$ExesDir" ]]; then run "/bin/rm -rf $ExesDir" \ "Blasting exes dir [$ExesDir] due to '-B'." ||\ warnmsg "Failed to blast exes dir." for d in /tmp/downloads /tmp/p4perl; do if [[ -d "$d" ]]; then run "/bin/rm -rf $d" \ "Blasting $d dir due to '-B'." ||\ warnmsg "Failed to blast dir $d." fi done fi fi if [[ ! -d "$ExesDir" ]]; then [[ "$PullFromWebAsNeeded" -eq 0 ]] && bail "ExesDir [$ExesDir] is missing and '-local' specified. Aborting." run "/bin/mkdir -p $ExesDir" ||\ bail "Could not create dir [$ExesDir]." cd "$ExesDir" || bail "Could not cd to $ExesDir." msg "Working in [$PWD]." run "curl -s -O $FTPURL/$P4ExeRel/bin.$ApiArch/p4" ||\ bail "Could not get 'p4' executable." run "curl -s -O $FTPURL/$P4DExeRel/bin.$ApiArch/p4d" ||\ bail "Could not get 'p4d' executable." run "curl -s -O $FTPURL/$P4PExeRel/bin.$ApiArch/p4p" ||\ bail "Could not get 'p4p' executable." run "curl -s -O $FTPURL/$P4BrokerExeRel/bin.$ApiArch/p4broker" ||\ bail "Could not get 'p4broker' executable." run "chmod +x p4 p4d p4p p4broker" \ "Doing chmod +x for downloaded executables." else msg "Using existing exes dir [$ExesDir]." fi #------------------------------------------------------------------------------ # Services Shutdown and Cleanup. if id -u "$RunUser" > /dev/null 2>&1; then msg "Verified: User $RunUser exists." else if command -v useradd > /dev/null; then run "useradd $RunUser" "Creating user $RunUser." ||\ bail "Failed to create user $RunUser." RunUserHomeDir="$(eval echo ~$RunUser)" if [[ -d "$RunUserHomeDir" ]]; then msg "Verified: Home directory for user $RunUser exists." else run "mkdir -p $RunUserHomeDir" \ "Creating home dir for $RunUser" ||\ bail "Failed to create home directory $RunUserHomeDir for OS user $RunUser." run "chmod -R $RunUser:$RunGroup $RunUserHomeDir" \ "Ensuring $RunUser owns home dir $RunUserHomeDir." ||\ warnmsg "Failed to change ownership of home directory $RunUserHomeDir for OS user $RunUser." fi run "cp $ResetHome/perforce_bash_profile $RunUserHomeDir/.bash_profile" \ "Creating $RunUserHomeDir/.bash_profile." ||\ warnmsg "Failed to copy to $RunUserHomeDir/.bash_profile." msg "Creating $RunUserHomeDir/.bashrc." sed "s:EDITME_SDP_INSTANCE:$SDPDefaultInstance:g" \ "$ResetHome/perforce_bashrc" > "$RunUserHomeDir/.bashrc" ||\ warnmsg "Failed to copy to $RunUserHomeDir/.bashrc." run "chown $RunUser:$RunGroup $(eval echo ~$RunUser)/.bash_profile $(eval echo ~$RunUser)/.bashrc" "Adjusting perms of .bash_profile and .bashrc." ||\ warnmsg "Adjusting ownership failed." else bail "User $RunUser does not exist, and the 'useradd' utility was not found." fi fi for i in $SDPInstances; do if [[ "$ThisOS" == "Linux" || "$ThisOS" == "Darwin" ]]; then msg "Stopping Perforce-related servcies for Instance $i." for svc in p4d p4broker p4p p4web p4dtg; do processCmd="${svc}_${i}" # This 'ps' command should work on Linux and Mac (Yosemite+ at least). # shellcheck disable=SC2009 Pids=$(ps -u $RunUser -f | grep -v grep | grep "/$processCmd "| awk '{print $2}') if [[ -z "$Pids" && $svc == p4d ]]; then msg "$processCmd not found for p4d service; looking for _bin variant instead." # For the p4d service, the process command may look like 'p4d_1_bin' or just 'p4d_1', so # we check for both. processCmd="${svc}_${i}_bin" # shellcheck disable=SC2009 Pids=$(ps -u $RunUser -f | grep -v grep | grep "/$processCmd "| awk '{print $2}') fi if [[ -n "$Pids" ]]; then run "kill -9 $Pids" \ "Killing user $RunUser processes for command $processCmd." sleep 1 else msg "Verified: No processes by user $RunUser for command [$processCmd] are running." fi done fi if [[ "$InitMechanism" == "SysV" ]]; then cd /etc/init.d || bail "Could not cd to /etc/init.d." msg "Removing Perforce-related SysV services in $PWD." for svc in p4*_init; do run "chkconfig --del $svc" run "rm -f $svc" done elif [[ "$InitMechanism" == "Systemd" ]]; then cd /etc/systemd/system || bail "Could not cd to /etc/systemd/system." msg "Disabling and removing Perforce-related Systemd services in $PWD." for svcFile in p4*.service; do run "systemctl disable ${svcFile%.service}" run "rm -f $svcFile" done fi done #------------------------------------------------------------------------------ if [[ -d $DownloadsDir && $BlastDownloadsAndExes -eq 1 ]]; then run "/bin/rm -r -f $DownloadsDir" \ "Blasting downloads dir [$DownloadsDir] due to '-B'." fi if [[ ! -d $DownloadsDir ]]; then [[ $PullFromWebAsNeeded -eq 0 ]] && bail "DownloadsDir [$DownloadsDir] is missing and '-local' specified. Aborting." run "/bin/mkdir -p $DownloadsDir" cd "$DownloadsDir" || bail "Could not cd to [$DownloadsDir]." msg "Working in [$PWD]." if [[ "$FastMode" -eq 0 ]]; then run "curl -s -O $FTPURL/$P4Rel/bin.$ApiArch/p4api.tgz" ||\ bail "Could not get file 'p4api.tgz'" else msg "Skipping download of p4api.tgz due to '-fast'." fi if [[ "$SDPInstallMethod" == Tarfile ]]; then run "curl -k -s -O $SDPURL" ||\ bail "Could not get SDP tar file from [$SDPURL]." fi if [[ "$LoadSampleDepot" -eq 1 ]]; then run "curl -s -O $FTPURL/tools/$SampleDepotTar" ||\ bail "Could not get file [$SampleDepotTar]. Aborting." if [[ "$BlastDownloadsAndExes" -eq 1 && -d "PerforceSample" ]]; then run "rm -rf "PerforceSample "Blasting dir PerforceSample due to '-B'." ||\ warnmsg "Failed to cleanly remove Sample Depot dir $PWD/PerforceSample." fi if [[ ! -d PerforceSample ]]; then run "tar -xzpf $SampleDepotTar" "Unpacking $SampleDepotTar in $PWD." else msg "Using existing extracted Sample Depot dir $PWD/PerforceSample." fi run "chown -R $RunUser:$RunGroup $DownloadsDir" \ "Setting ownership on downloads dir." ||\ bail "Failed to set ownership on downloads dir [$DownloadsDir]. Aborting." else msg "Skipping download of Sample Depot due to '-no_sd'." fi else msg "Using existing downloads dir [$DownloadsDir]." cd "$DownloadsDir" || bail "Could not cd to downloads dir: $DownloadsDir" if [[ "$SDPInstallMethod" == Tarfile ]]; then if [[ -r "$SDPTar" ]]; then msg "Using existing SDP tarfile [$SDPTar]." else run "curl -k -s -O $SDPURL" ||\ bail "Could not get SDP tar file from [$SDPURL]." fi fi fi #------------------------------------------------------------------------------ # Cleanup cd "$HxDepots" || bail "Could not cd to [$HxDepots]. Aborting." msg "Working in [$PWD]." for d in $HxMetadata $HxLogs; do if [[ ! -d "$d" ]]; then run "/bin/mkdir -p $d" "Initialized empty dir [$d]." ||\ bail "Failed to create dir [$d]." else msg "Verified: Dir [$d] exists." fi done if [[ $PreserveDirList != Unset ]]; then run "/bin/mkdir -p $TmpDir" "Creating temp dir [$TmpDir]." ||\ bail "Failed to create temp dir [$TmpDir]." for d in $(echo "$PreserveDirList" | tr ',' ' '); do preserveDir="$HxDepots/p4/common/$d" if [[ -d "$preserveDir" ]]; then parentDir=$(dirname "$TmpDir/$d") if [[ ! -d "$parentDir" ]]; then run "/bin/mkdir -p $parentDir" "Creating parent temp dir [$parentDir]." ||\ bail "Failed to create parent temp dir [$parentDir]." fi run "/bin/mv $preserveDir $TmpDir/$d" \ "Moving preserved dir $preserveDir aside for safe keeping." else bail "Missing expected preserve dir [$preserveDir]. Check that paths specified with '-p' are relative to $HxDepots/p4/common." fi done fi for i in $SDPInstances; do run "/bin/rm -rf $HxDepots/p4/$i $HxMetadata/p4/$i $HxLogs/p4/$i" \ "Blasting any existing SDP structures." ||\ bail "Failed to blast existing SDP structures." if [[ -L "/p4/$i" ]]; then run "/bin/rm -f /p4/$i" "Blasting symlink /p4/$i." ||\ bail "Failed to remove SDP symlink." elif [[ -d "/p4/$i" ]]; then run "/bin/rm -rf /p4/$i" "Blasting directory /p4/$i." ||\ bail "Failed to remove SDP instance directory /p4/$i." fi done run "/bin/rm -rf $HxDepots/p4/common" \ "Blasting SDP common folder." ||\ bail "Failed to remove SDP common folder." if [[ -L /p4/common ]]; then run "/bin/rm -f /p4/common" "Removing /p4/common symlink." ||\ bail "Failed to remove /p4/common symlink." elif [[ -d /p4/common ]]; then run "/bin/rm -rf /p4/common" "Removing /p4/common directory." ||\ bail "Failed to remove /p4/common local directory." else msg "Info: /p4/common did not exist as a directory or symlink." fi run "/bin/rm -rf $SDPHome /p4/ssl" \ "Removing old SDP Home and /p4/ssl." ||\ bail "Failed to remove old $SDPHome and /p4/ssl." #------------------------------------------------------------------------------ # SDP Setup if [[ "$SDPInstallMethod" == Tarfile ]]; then run "tar -xzpf $DownloadsDir/$SDPTar" "Unpacking $DownloadsDir/$SDPTar in $PWD." ||\ bail "Failed to untar SDP tarfile." elif [[ "$SDPInstallMethod" == Copy ]]; then run "rsync -a $SDPDir/ $SDPHome" "Deploying SDP from $SDPDir" ||\ bail "Failed to rsync SDP from $SDPDir." else export PATH="$ExesDir:$PATH" export P4ENVIRO=/dev/null/.p4enviro export P4CONFIG=.p4config.local run "/bin/mkdir -p $SDPHome" "Creating dir $SDPHome" ||\ bail "Failed to create dir $SDPHome. Aborting." cd "$SDPHome" || bail "Failed to cd to [$SDPHome]." WorkshopRemote=perforce_software-sdp_${SDPInstallBranch} run "$ExesDir/p4 -s -u $WorkshopUser clone -p $WorkshopPort -r $WorkshopRemote" \ "Cloning SDP $SDPInstallBranch branch from The Workshop." ||\ bail "Failed to clone SDP from The Workshop." run "$ExesDir/p4 -s sync -f .p4ignore" \ "Force-sync .p4ignore file." if [[ "$ShelvedChange" != Unset ]]; then run "$ExesDir/p4 -s fetch -s $ShelvedChange" \ "Fetching shelved change @$ShelvedChange from The Workshop." ||\ bail "Failed to fetch shelved change @$ShelvedChange from The Workshop." LocalShelvedChange=$($ExesDir/p4 -ztag -F %change% changes -s shelved -m 1) [[ -n "$LocalShelvedChange" ]] || \ bail "Could not determine local shelved change fetched for shelved change @$ShelvedChange." run "$ExesDir/p4 -s unshelve -s $LocalShelvedChange" \ "Unshelving local shelved change @$LocalShelvedChange." ||\ bail "Failed to unshelve local shelved change @$LocalShelvedChange." fi unset P4ENVIRO unset P4CONFIG fi if [[ "${Config['SimulateEmail']}" == "1" ]]; then cd "$SDPConfigDir" ||\ bail "Could not cd to [$SDPConfigDir]." msg "Generating custom p4_vars.template to simulate email in [$PWD]." run "/bin/mv -f p4_vars.template p4_vars.template.orig" run "chmod 444 p4_vars.template.orig" sed -e "s:SDPMAIL=mailx:SDPMAIL='/bin/echo Simulated mail':g" \ -e "s:SDPMAIL=mail:SDPMAIL='/bin/echo Simulated mail':g" \ p4_vars.template.orig > p4_vars.template msg "Changes in p4_vars.template:" diff p4_vars.template.orig p4_vars.template else msg "Using standard p4_vars.template file." fi cd "$SDPSetupDir" ||\ bail "Could not cd to [$SDPSetupDir]." if [[ "${Config['SimulateEmail']}" == "1" ]]; then msg "Generating custom mkdirs.sh in $PWD." run "/bin/mv -f mkdirs.sh mkdirs.sh.orig" run "chmod 444 mkdirs.sh.orig" sed -e "s:export MAIL=mailx:export MAIL='/bin/echo Simulated mail':g" \ -e "s:export MAIL=mail:export MAIL='/bin/echo Simulated mail':g" \ mkdirs.sh.orig > mkdirs.sh else msg "Using standard mkdirs.sh script." fi run "/bin/mv -f mkdirs.cfg mkdirs.cfg.orig" \ "Generating custom mkdirs.cfg in $PWD." sed -e "s:=DNS_name_of_master_server:=${Config['DNS_name_of_master_server']}:g" \ -e "s:^MAILTO=.*:MAILTO=${Config['P4AdminList']}:g" \ -e "s:^MAILFROM=.*:MAILFROM=${Config['MailFrom']}:g" \ -e "s:mail.example.com:${Config['SMTPServer']}:g" \ -e "s:^CASE_SENSITIVE=.*:CASE_SENSITIVE=${Config['CaseSensitive']}:g" \ -e "s:^DB1=.*:DB1=${HxMetadata#/}:g" \ -e "s:^DB2=.*:DB2=${HxMetadata#/}:g" \ -e "s:^P4_PORT=.*:P4_PORT=SeeBelow:g" \ -e "s:^P4BROKER_PORT=.*:P4BROKER_PORT=SeeBelow:g" \ -e "s:# P4_PORT=1666:P4_PORT=${Config['P4_PORT']}:g" \ -e "s:# P4BROKER_PORT=1667:P4BROKER_PORT=${Config['P4BROKER_PORT']}:g" \ -e "s:=adminpass:=${Config['Password']}:g" \ -e "s:=servicepass:=${Config['Password']}:g" \ -e "s:OSGROUP=perforce:OSGROUP=$RunGroup:g" \ -e "s:REPLICA_ID=replica:REPLICA_ID=p4d_ha_bos:g" \ -e "s:SVCUSER=service:SVCUSER=svc_p4d_ha_bos:g" \ mkdirs.cfg.orig > mkdirs.cfg if [[ $UseSSL -eq 0 ]]; then msg "Not using SSL feature due to '-no_ssl'." sed "s/SSL_PREFIX=ssl:/SSL_PREFIX=/g" mkdirs.cfg > $TmpFile run "mv -f $TmpFile mkdirs.cfg" fi chmod +x mkdirs.sh msg "SDP Localizations in mkdirs.sh:" diff mkdirs.sh.orig mkdirs.sh msg "\\nSDP Localizations in mkdirs.cfg:" diff mkdirs.cfg.orig mkdirs.cfg run "cp -p $ExesDir/p4* $SDPHome/Server/Unix/p4/common/bin/." \ "Copying perforce executables." msg "Initializing SDP instances and configuring $InitMechanism services." for i in $SDPInstances; do cd "$SDPSetupDir" || bail "Could not cd to [$SDPSetupDir]." log="$PWD/mkdirs.${i}.log" msg "Initializing SDP instance [$i], writing log [$log]." "$PWD/mkdirs.sh" "$i" > "$log" 2>&1 cat "$log" if [[ "$InitMechanism" == "SysV" ]]; then msg "\\nConfiguring $InitMechanism services.\\n" cd /etc/init.d || bail "Could not cd to [/etc/init.d]." for svc in p4broker p4d; do initScript=${svc}_${i}_init if [[ -x /p4/${i}/bin/$initScript ]]; then run "ln -s /p4/${i}/bin/$initScript" run "chkconfig --add $initScript" run "chkconfig $initScript on" fi done elif [[ "$InitMechanism" == "Systemd" ]]; then msg "\\nConfiguring $InitMechanism services.\\n" cd /etc/systemd/system || bail "Could not cd to /etc/systemd/system." for exe in p4broker p4d p4p; do svcName="${exe}_${i}" svcFile="${svcName}.service" sed "s:__INSTANCE__:${i}:g" "$ResetHome/${exe}_N.service.t" > "$svcFile" ||\ bail "Failed to generate $PWD/$svcFile." # The p4p *.service file will be put in place, but not enabled. [[ "$exe" == p4p ]] && continue run "systemctl enable $svcName" "Enabling $svcName to start on boot." ||\ warnmsg "Failed to enable $svcName with $InitMechanism." done fi run "chown -R $RunUser:$RunGroup $HxDepots" \ "Adjusting ownership of $HxDepots to $RunUser:$RunGroup." ||\ bail "Failed to adjust ownership of $HxDepots." msg "\\nGenerating broker config for instance $i.\\n" su -l $RunUser -c "$CBIN/gen_default_broker_cfg.sh ${i} > $CCFG/p4_${i}.broker.cfg" done if [[ "$UseSSL" -eq 1 ]]; then msg "Generating /p4/ssl/config.txt SSL config file for autogen cert." sed -e "s/REPL_DNSNAME/helix/g" /p4/ssl/config.txt > $TmpFile ||\ bail "Failed to substitute content in /p4/ssl/config.txt." run "mv -f $TmpFile /p4/ssl/config.txt" msg "Contents of /p4/ssl/config.txt:\\n$(cat /p4/ssl/config.txt)\\n" fi if [[ "$PreserveDirList" != Unset ]]; then for d in $(echo "$PreserveDirList" | tr ',' ' '); do preserveDir=$HxDepots/p4/common/$d tempCopyDir=$TmpDir/$d run "rsync -av --exclude=.p4root --exclude=.p4ignore --exclude=.p4config $tempCopyDir/ $preserveDir" \ "Restoring $preserveDir" ||\ bail "Failed to restore $preserveDir." done run "/bin/rm -rf $TmpDir" "Cleanup: Removing temp dir [$TmpDir]." ||\ bail "Failed to remove temp dir [$TmpDir]." fi #------------------------------------------------------------------------------ # Install P4Perl and P4Python. if [[ "$FastMode" -eq 0 ]]; then msg "\\nInstalling P4Python for SDP." su -l $RunUser -c '/hxdepots/sdp/Server/Unix/setup/install_sdp_python.sh' ||\ warnmsg "Failed to install P4Python" msg "\\nInstalling P4Perl for SDP." su -l $RunUser -c '/hxdepots/sdp/Server/Unix/setup/install_sdp_perl.sh' ||\ warnmsg "Failed to install P4Perl." fi msg "Preparing to run Sample Depot configuration script." if [[ ! -d "$ResetHome" ]]; then run "/bin/mkdir -p $ResetHome" "Creating reset home dir [$ResetHome]." ||\ bail "Could not create reset home dir [$ResetHome]. Aborting." fi cd "$ResetHome" || bail "Could not cd to $HxDepots/ResetHome. Aborting." if [[ "$LoadSampleDepot" -eq 1 ]]; then for i in $SDPInstances; do msg "Configuring Sample Depot for SDP on Instance $i." if su -l $RunUser -c "$ResetHome/configure_sample_depot_for_sdp.sh -i $i -d $ResetHome"; then msg "\\nSample Depot configured successfully for instance $i.\\n" else bail "Failed to load the Sample Depot." fi done else msg "\\nSkipping configuration of Sample Depot due to '-no_sd'.\\n" fi #------------------------------------------------------------------------------ # Add sudoers to /etc/sudoers.d if the directory exists and the user file doesn't. if [[ -d "${SudoersFile%/*}" && ! -e "$SudoersFile" ]]; then msg "Adding $RunUser to sudoers." if echo -e "$SudoersEntry" > "$SudoersFile"; then run "chmod 0400 $SudoersFile" "Setting perms on sudoers file, $SudoersFile." ||\ warnmsg "Failed to set perms on $SudoersFile." else warnmsg "Failed to create $SudoersFile." fi fi #------------------------------------------------------------------------------ # Apply Package Repository if [[ -d "${P4YumRepo%/*}" ]]; then if [[ -n "$ThisOSMajorVersion" ]]; then run "rpm --import $PerforcePackagePubkeyURL" \ "Adding Perforce's packaging key to RPM keyring." ||\ warnmsg "Failed to add Perforce packaging key to RPM keyring." msg "Generating $P4YumRepo." if ! echo -e "[perforce]\\nname=Perforce\\nbaseurl=$PerforcePackageRepoURL/yum/rhel/$ThisOSMajorVersion/x86_64\\nenabled=1\\ngpgcheck=1\\n" > "$P4YumRepo"; then warnmsg "Unable to generate $P4YumRepo." fi else warnmsg "Skipping generation of $P4YumRepo due to lack of OS Major Version info." fi elif [[ -d "${P4AptGetRepo%/*}" ]]; then # /etc/apt/sources.list.d if [[ -n "$ThisOSName" && -n "$ThisOSDistro" ]]; then if run "wget -qO - $PerforcePackagePubkeyURL > $TmpPubKey" \ "Acquiring Perforce's package repository public key."; then msg "Public key for Perforce package repo acquired as: $TmpPubKey" run "apt-key add < /tmp/perforce.pubkey" \ "Adding Perforce's packaging key to APT keyring." ||\ warnmsg "Failed to add Perforce packaging key to APT keyring." else warnmsg "Failed to add acquire Perforce package repo public key." fi msg "Generating $P4AptGetRepo." if ! echo "deb $PerforcePackageRepoURL/apt/$ThisOSName $ThisOSDistro release" > "$P4AptGetRepo"; then warnmsg "Unable to generate $P4AptGetRepo." fi else warnmsg "Skipping generation of $P4AptGetRepo due to lack of OS Name and Distro info." fi else warnmsg "No Perforce supported package repository, RPM or APT, found to add. Skipping." fi if [[ "$FirewallType" == "Firewalld" ]]; then msg "\\nConfiguring $FirewallType services.\\n" cd "$FirewallDir" || bail "Could not cd to $FirewallDir." run "firewall-cmd --reload" "Baseline firewall load." ||\ warnmsg "Baseline firewall load failed." for exe in p4broker p4d; do svcName="${exe}_${i}" svcFile="${svcName}.xml" sed -e "s:__INSTANCE__:${i}:g" \ -e "s:__P4PORT__:${Config['P4_PORT']}:g" \ -e "s:__P4BROKER_PORT__:${Config['P4BROKER_PORT']}:g" \ "$ResetHome/${exe}_N.xml.t" > "$svcFile" ||\ bail "Failed to generate $PWD/$svcFile." run "firewall-cmd --permanent --zone=public --add-service $svcName" \ "Adding firewall entry for $svcName" ||\ warnmsg "Adding firewall entry for $svcName failed." done run "iptables-save" "Showing firewall rules." ||\ warnmsg "Showing firewall failed." run "firewall-cmd --reload" "Firewall reload." ||\ warnmsg "Firewall reload failed." elif [[ "$FirewallType" == "IPTables" ]]; then warnmsg "IPtables firewall detected, but not handled." fi if [[ "$ThisOS" == "Linux" ]]; then if [[ -x "$OSTweaksScript" ]]; then run "$OSTweaksScript" "Making recommended Linux OS tweaks." ||\ warnmsg "Non-zero exit code ($CMDEXITCODE) returned from $SDPSetupDir/os_tweaks.sh" else msg "Not making OS tweaks, $OSTweaksScript is missing or not executable." fi else msg "Skipping OS tweaks on non-Linux OS." fi if [[ "$ErrorCount" -eq 0 ]]; then if [[ "$WarningCount" -eq 0 ]]; then msg "\\nSUCCESS: SDP Configuration complete." else msg "\\nSUCCESS: SDP Configuration complete with $WarningCount warnings." fi run "chmod -x $ResetHome/reset_sdp.sh" \ "Removing execute permissions from $ThisScript." ||\ warnmsg "Failed to remove execute permissions from $ResetHome/reset_sdp.sh" run "mv $ResetHome/reset_sdp.sh $ResetHome/reset_sdp.sh.txt" \ "Renamed to clarify this should not be executed again." ||\ warnmsg "Failed to rename to $ResetHome/reset_sdp.sh.txt" else msg "\\nSDP Configuration completed, but with $ErrorCount errors and $WarningCount warnings." fi exit "$ErrorCount"
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#219 | 30495 | C. Thomas Tyler | Added config default in case HxCheckpoints isn't defined. | ||
#218 | 30494 | C. Thomas Tyler | Added '-m <ShallowCloneRevs>' option. | ||
#217 | 30493 | C. Thomas Tyler | Fixed issue with '-v' option to make it more reliable. | ||
#216 | 30491 | C. Thomas Tyler |
Changed so '-local' implies '-no_ppr'. #review-30492 @mzinthefer |
||
#215 | 30489 | C. Thomas Tyler |
Added sos package to yum and zypper package managers; it is not reliably available on apt. Added sysstat package to apt, yum, and zypper package managers. Note that we don't reference 'dnf' (the new 'yum' on RHEL systems) because 'yum' still works and works across versions. |
||
#214 | 30488 | C. Thomas Tyler | Added tuned as a standard package. | ||
#213 | 30487 | C. Thomas Tyler |
Avoid firewalld errors if firewalld is not running. This was done in a way as to make it easier to add support for other firewalls (ufw?) later. |
||
#212 | 30486 | C. Thomas Tyler | Pass '-no_systemd' option thru to mkdirs.sh | ||
#211 | 30470 | C. Thomas Tyler | Added logic to pass '-no_enable' option thru to mkdirs.sh. | ||
#210 | 30465 | C. Thomas Tyler | Improved auditability for getting Helix binaries. | ||
#209 | 30464 | C. Thomas Tyler | Typo. | ||
#208 | 30463 | C. Thomas Tyler |
Fixed regression in 2024.1 where specifying P4BinRel and APIBinRel in settings.cfg to older-than-default p4d versions did not work as expected; r24.1 was always pulled. |
||
#207 | 30462 | C. Thomas Tyler | Re-added accidentally deleted SDPURL setting. | ||
#206 | 30461 | C. Thomas Tyler | More URL adjustments. | ||
#205 | 30460 | C. Thomas Tyler | Adjusted URLs, fixed timestamp. | ||
#204 | 30459 | C. Thomas Tyler |
Change URLs in curl calls in docs and code to avoid Apache redirects. Also removed '-s' option from curl calls. |
||
#203 | 30404 | C. Thomas Tyler |
Added support for Rocky 9 in reset_sdp.sh. Added Rocky 9 to regression test suite. Changed from using 'yum' to 'dnf' on Rocky, to be trendy. Changed base OS template to match what SDP uses for Rocky 8. |
||
#202 | 30399 | C. Thomas Tyler | Adapted to SDP default value of 'localhost' for DNS name of commit server. | ||
#201 | 30398 | C. Thomas Tyler | Add '-no_enable' option to avoid enabling installed services. | ||
#200 | 30397 | C. Thomas Tyler |
Adjust location of generated crontab file to: /p4/common/etc/cron.d/crontab.<user>.<short_hostname>.<instance>. |
||
#199 | 30365 | C. Thomas Tyler | Added support for separate HxCheckpoints volume. | ||
#198 | 30364 | C. Thomas Tyler | Changed default Helix Core version to r24.1. | ||
#197 | 30332 | C. Thomas Tyler | Tweaked formatting of log line. | ||
#196 | 30331 | C. Thomas Tyler | Added built-in logging. | ||
#195 | 30330 | C. Thomas Tyler |
More adaptation to SDP 2024.1 changes. Now deferrring to SDP for download of derived APIs. |
||
#194 | 30325 | C. Thomas Tyler |
Adapted to SDP 2024.1, supporting multiple architectures to include aarch64 e.g. Graviton. |
||
#193 | 30322 | C. Thomas Tyler | Fixed inaccuracy in error message if running on unsupported architecture. | ||
#192 | 30225 | C. Thomas Tyler | Normalized sed statements to use '|' separator. | ||
#191 | 30213 | C. Thomas Tyler |
Added '-si <SDPInstance>' as a command line option, so there is one less reason to need to do the more complex 'Configured' installation, especially for a proxy or stand-alone broker. #review-30214 |
||
#190 | 30192 | C. Thomas Tyler | Adapated to change in SDP default password. | ||
#189 | 30191 | C. Thomas Tyler | Typo | ||
#188 | 30190 | C. Thomas Tyler | Completed apt repo update for Ubuntu. | ||
#187 | 30189 | C. Thomas Tyler | Updated APT keyging magic for Perforce Package Repository for Ubuntu. | ||
#186 | 30045 | C. Thomas Tyler | 2023.2 release; changed default version to 2023.2. | ||
#185 | 29816 | C. Thomas Tyler |
Changed preferred delimeter for sed calls from a mix of ':', '@', and '|' to always use '|', since there are no values we use for which '|' is acceptable. This fixes an issue where certain values, e.g. an SMTP server, might include a port number, e.g. smtp.p4demo.com:587 -- the ':' would break when the 'sed' was used. #review-29817 @will_kreitzmann |
||
#184 | 29814 | C. Thomas Tyler |
Fixed bug: Wrong/root ownership of 'downloads' dir if '-no_sd' used. #review-29815 |
||
#183 | 29698 | C. Thomas Tyler |
Changed 'curl' commands referencing Workshop to use '-L'. Updated stable version numbers in README.md to use new versions with corrected URLs. |
||
#182 | 29615 | C. Thomas Tyler |
Set default to r23.1. Removed '-k' from curl calls. |
||
#181 | 29447 | C. Thomas Tyler | Added 'bc' to standard package list. | ||
#180 | 29389 | C. Thomas Tyler | Add '--help' alias for '-man' option. | ||
#179 | 29362 | C. Thomas Tyler | Updated default Helix Core version from r22.1 -> r22.2. | ||
#178 | 29339 | C. Thomas Tyler | Removed superfluous error message. | ||
#177 | 28887 | C. Thomas Tyler |
reset_sdp.sh v4.11.3: Fixed bogus message regarding verify_sdp.sh when '-v' was not specified. If the '-v' was specified, the scirpt correctly executed the 'verify_sdp.sh' script with the correct "skip test" list to avoid errors. However, if '-v' was not specified, a bogus message was displayed indicating verify_sdp.sh was not available. With this change: * If '-v' is not specified, no output about verify_sdp.sh is displayed at all (as was the original intent). * If '-v' is specified and verify_sdp.sh is not avaialble, the message disaplyed about it not being there is now an error rahter than an informational message. #review-28888 @rwillyoung |
||
#176 | 28834 | C. Thomas Tyler | Updated default P4D version to r22.1. | ||
#175 | 28833 | C. Thomas Tyler |
reset_sdp.sh v4.11.2: Fixed issue where -H/-T flags worked but equivalent settings in settings.cfg did not take. |
||
#174 | 28769 | C. Thomas Tyler | Fixed issue with root ownership of mail simulator. | ||
#173 | 28721 | Andy Boutte | Adding firewalld template for p4p | ||
#172 | 28662 | C. Thomas Tyler |
Added support for SELinux in enforcing mode. Enhanced documentation, including notes about SELinux handling. |
||
#171 | 28582 | C. Thomas Tyler |
reset_sdp.sh v4.9.0: Added '-no_sudo' option. Added '-no_firewall' option. Fixed minor issue where 'systemctl' commands try to execute when systemctl isn't avail. Added test coverage in test_hi.sh. |
||
#170 | 28408 | C. Thomas Tyler | Refined Blast logic a bit further. | ||
#169 | 28407 | C. Thomas Tyler |
Minor cleanup of logic blasting 'perforce' user pids. Fixed formatting issues. |
||
#168 | 28406 | C. Thomas Tyler | Adjusted issue with ownership of /p4/ssl/config.txt file. | ||
#167 | 28405 | C. Thomas Tyler | Minor code cleanup and refinement of '-B'. | ||
#166 | 28404 | C. Thomas Tyler | Tweaked generated email simulator. | ||
#165 | 28403 | C. Thomas Tyler | Adjusted placement of email simulator logic. | ||
#164 | 28402 | C. Thomas Tyler | Fixed issues with '-B' (blast mode) not cleaning up some dirs. | ||
#163 | 28401 | C. Thomas Tyler | Rolled back removal of '-k' to curl for now. | ||
#162 | 28400 | C. Thomas Tyler | Fixed logic to generate mail simulator wrapper script. | ||
#161 | 28399 | C. Thomas Tyler | Downgraded warning to info re: using ServerType as ServerID for proxy/broker. | ||
#160 | 28396 | C. Thomas Tyler | Changed default Helix Core binaries version to r21.2. | ||
#159 | 28394 | C. Thomas Tyler |
Fail faster if CaseSensitive is set to 0 in the config file and the Sample Depot data set is to be loaded. The Sample Depot data set is not supported for a case-insensitive server. |
||
#158 | 28393 | C. Thomas Tyler |
Added error message if conditions for HI-54 are detected -- i.e. if OS is RHEL/CentOS/Rocky Linux 8.x and SELinux is enabled. |
||
#157 | 28392 | C. Thomas Tyler | Fixed cert generation issue. | ||
#156 | 28389 | C. Thomas Tyler | Dropped insecure '-k' option from curl commands. | ||
#155 | 28388 | C. Thomas Tyler | Fixed bootstrapping issue with '-ls' (limited sudo) option. | ||
#154 | 28387 | C. Thomas Tyler |
Corrected issue with generating SSL certificates on proxy-only or broker-only hosts. |
||
#153 | 28266 | C. Thomas Tyler |
Improved support for proxy-only hosts. #review-28267 @rwillyoung |
||
#152 | 28120 | C. Thomas Tyler |
Added -no_systemd option to avoid using systemd. This is useful for operating in containerized test environments where systemd is not available. |
||
#151 | 28094 | C. Thomas Tyler | Corrected package list for Ubuntu. | ||
#150 | 27985 | C. Thomas Tyler |
Added support for running Unsupported (resurrected) SDP script install_sdp_python.sh if it exists in the SDP package. |
||
#149 | 27981 | C. Thomas Tyler | Fixed doc typos. | ||
#148 | 27980 | C. Thomas Tyler | Updated default P4D to r21.1 from r20.1. | ||
#147 | 27930 | C. Thomas Tyler |
Added required 'which' package which is no longer reliably available on minimal OS installations. |
||
#146 | 27553 | C. Thomas Tyler |
Spell check only. Non-functional changes. Docs udpated. Fixed typos in comments and messages, including generated settings.cfg files. |
||
#145 | 27419 | C. Thomas Tyler |
Added '-v' option to run verify_sdp.sh with various options. Added test and doc for same. The options to verify_sdp.sh are dependent on options to reset_sdp.sh. Enabled configure_sample_depot_for_sdp.sh to work with non-default mount points. |
||
#144 | 27387 | C. Thomas Tyler |
reset_sdp.sh v4.3.3: * Updated logic for loading crontab to work with latest SDP, which changed location of generated SDP crontab files. |
||
#143 | 27377 | C. Thomas Tyler | Fixed path to sudoers file. | ||
#142 | 27376 | C. Thomas Tyler | Added removal of sudoers file to Extreme Cleanup mode. | ||
#141 | 27374 | C. Thomas Tyler | Added '-ls' (limited sudo) option. | ||
#140 | 27305 | C. Thomas Tyler | Added rsync package to all platforms. | ||
#139 | 27299 | C. Thomas Tyler | Added '-H <hostname>' and '-T <timezone>' options and cfg settings. | ||
#138 | 27283 | C. Thomas Tyler | Added '-no_tweaks' option to skip running SDP os_tweaks.sh script. | ||
#137 | 27282 | C. Thomas Tyler |
Enhanced so ServerID, ServerType, and TargetServerID only apply if mkdirs.sh is new enough to support them. Added warning message if those settings are defined and an old SDP is used. Tweaked 'chown' logic to only chown existing directories. |
||
#136 | 27259 | C. Thomas Tyler |
reset_sdp.sh v4.0.0: * Added config settings: ServerID, ServerType, TargetServerType * Enhanced internal docs. * Enhanced docs for '-local' flag. * Added '-dapi' flag to install derived APIs (P4Perl/P4Python). If this flag is used, failures to build P4Perl and/or P4Python are reported as errors. * Tweaked '-fast' to now mean "skip package installations," and documented as such. |
||
#135 | 27242 | C. Thomas Tyler | reset_sdp.sh v3.23.4: Cosmetic changes and fixed typo in config file. | ||
#134 | 27241 | C. Thomas Tyler | reset_sdp.sh v3.23.3: No functional change; code cosmetics. | ||
#133 | 27227 | C. Thomas Tyler |
Refinement for consecutive test runs where owner changes between tests. The configure_sample_depot_for_sdp.sh will fail with "Permission denied" errors in regression test suite runs after the first when ownership changes. |
||
#132 | 27225 | C. Thomas Tyler | Refined narrowing logic. | ||
#131 | 27222 | C. Thomas Tyler |
reset_sdp.sh v3.23.0: * Narrowed scope of 'chown -R' command to /hxdepots/p4 to avoid .snapshot/lost+found dirs. |
||
#130 | 27157 | C. Thomas Tyler | Adapted to use SDP 2020.1 systemd service file templates if they exist. | ||
#129 | 27136 | C. Thomas Tyler | Adjusted to not deploy the systemd unit file for p4p. | ||
#128 | 27031 | C. Thomas Tyler |
Updated adaptation to SDP r20.1 changes coming soon. This change has no impact for SDP 2019.3. |
||
#127 | 26970 | C. Thomas Tyler |
Adjustments to work with SDP r20.1: * Adapted to new stage area for exes. * Adapted to changes in mkdirs.cfg. |
||
#126 | 26969 | C. Thomas Tyler | Changed Helix Core to r20.2 default release. | ||
#125 | 26895 | C. Thomas Tyler | Corrected crontab set command to account for running as root. | ||
#124 | 26893 | C. Thomas Tyler |
Silently ignore install_sdp_p4<perl,python>.sh if they do not exist. Added systemd daemon reload. |
||
#123 | 26891 | C. Thomas Tyler |
Added loading of crontab for configured OS user. Added '-no_cron' flag to disable new default crontab loading behavior. |
||
#122 | 26890 | C. Thomas Tyler |
For '-d <sdp_dir>' flag: * Adjusted default value to '/sdp' per docs. * Changed rsync to include '--delete' flag. |
||
#121 | 26889 | C. Thomas Tyler |
Tweaks to reset_sdp.sh: * Fixed minor output bug. * Renamed SDPDir to SDPCopyDir for clarity. * Improved initialization for SDPCopyDir. |
||
#120 | 26887 | C. Thomas Tyler | Fixed typo in comment; non-functional change. | ||
#119 | 26828 | C. Thomas Tyler | Adjusted for variation in format of Hx* settings. | ||
#118 | 26821 | C. Thomas Tyler | For RHEL/CentOS family, added major OS version detection for RHEL/CentOS 8. | ||
#117 | 26817 | C. Thomas Tyler | Fixed '-B' (blast) logic bug when using multiple storage volumes. | ||
#116 | 26799 | C. Thomas Tyler |
Added '-M' multi-run option to disable the 'run once' safety feature, to simplify multiple tests. |
||
#115 | 26784 | C. Thomas Tyler |
reset_sdp.sh v3.17.0: Made /hx* mount points configurable in settings.cfg, and updated documentation accordingly. Added support for configuring /hxmetadata1 and /hxmetadata2 with different values. Added test coverage for changing /hxdepots from the default. Enhanced test suite. TEST FAIL NOTE: As of this change, tests are succeeding on all platforms except CentOS 6. Failures are in the test suite infrastructure, not related to this change. |
||
#114 | 26625 | C. Thomas Tyler |
Fixed bug installing with '-d' install method (mainly used for Battle School custom installs). |
||
#113 | 26604 | C. Thomas Tyler | Non-functional changes to maintain shellcheck compliance. | ||
#112 | 26576 | C. Thomas Tyler |
Fixed order-of-operations issue due to recent changes in SDP; the logic to implement 'sudo' as required to call 'systemd' wrappers now requires the sudo to be called before the call to configure_sample_depot.sh. Refined firewall handling logic. |
||
#111 | 26565 | C. Thomas Tyler | Set password for OSUSER to same as P4USER if OSUSER needs to be created. | ||
#110 | 26564 | C. Thomas Tyler | Bumped version id for last change. | ||
#109 | 26562 | C. Thomas Tyler | Corrected chmod to be a chown as intended. | ||
#108 | 26557 | C. Thomas Tyler |
Changed default Helix Core to r20.1. Updated docs. |
||
#107 | 26181 | C. Thomas Tyler | Corrected arg to '-d'. | ||
#106 | 26180 | C. Thomas Tyler |
Enhanced '-d <sdp_dir>' argument to use an SDP.Unix.tgz tarball in the specified directory if found, otherwise it reverts to current behavior of using a pre-extracted sdp directory tree. Added logic to display the SDP version used unless DVCS method is used (which case the Version will be unrelaible, as it s the latest from the dev branch). Corrected doc inconsistencies. |
||
#105 | 26179 | C. Thomas Tyler |
Tweaked hardcoded site tag ref to use settings.cfg. Other cosmetic fixes. |
||
#104 | 26178 | C. Thomas Tyler |
Doc updates and variable substitutions. No functional changes. |
||
#103 | 26177 | C. Thomas Tyler | Updated Helix binaries to 2019.2.1885864 (2019/11/18) | ||
#102 | 26020 | C. Thomas Tyler |
Added P4USER setting to settings.cfg to enable super user to be changed from the default. |
||
#101 | 26019 | C. Thomas Tyler | Enabled Sample Depot install with non-default OSUSER. | ||
#100 | 26016 | C. Thomas Tyler |
Tweaked logic for creation of firewalld files to enable potential future support of multi-instance handling. |
||
#99 | 26015 | C. Thomas Tyler | Follow on to change @26009, removal of bogus extra setting. | ||
#98 | 26014 | C. Thomas Tyler |
Fix issue with systemd files when OSUSER is not perforce. Also fixed issue with '-X' mode cleaning up firewalld files. |
||
#97 | 26009 | C. Thomas Tyler | Removed bogus extra setting in generated settings.cfg. | ||
#96 | 26006 | C. Thomas Tyler |
Enhanced format of config file to separate settings that must be changed, should be changed, and should not be changed for PoC and production bootstrapping installs, with comments noting that no changes is needed for demo installs. |
||
#95 | 26004 | C. Thomas Tyler |
Added more configurable options to settings.cfg: OSUSER - OS user for p4d to run as, defaults to perforce. OSGROUP - primary group for OSUSER, w/ platform-specific defaults. OSUSER_HOME - home dir for OSUSER, default /home/perforce. OSUSER_ADDITIONAL_GROUPS - Add'l groups for OSUSER, no default. |
||
#94 | 26003 | C. Thomas Tyler |
Changed default config file referenced in docs to 'settings.cfg', to better match how it is used in practice and to make things just a bit easier. |
||
#93 | 25995 | C. Thomas Tyler |
Changed to use only https (no more http). All curl commands use '-k' for robustness. Changed default install method to tarfile using the consistently named sdp.Unix.tgz file name. Eliminated '-t' flag; cloning is now done only when '-b' is used. Removed command attempting to change ownership of /hxdepots/reset dir to 'perforce' before that user exists. Better if that folder remains root-owned in any case, as only root can run it. |
||
#92 | 25992 | C. Thomas Tyler | Follow on to change @25915 fixing issue with firewalld conf. | ||
#91 | 25991 | C. Thomas Tyler |
Added 'mailx' to package list for 'yum' systems. Did not added roughly corresponding 'bsd-mailx' to apt-get systems due to interactive nature. No pacakge changes for zypper either. |
||
#90 | 25988 | C. Thomas Tyler | Updated default SDP tarball packge to install if '-t default' is used. | ||
#89 | 25915 | C. Thomas Tyler |
Fixed issue with firewalld configuration on RHEL/CentOS 7 systems. Changed '-X' extreme cleanup to now clear firewalld rules. Added missing mention of firewalld config in documentation. |
||
#88 | 25889 | C. Thomas Tyler |
Tweaked 'useradd' command to add explicit '-s /bin/bash' flag, as needed to ensure the command shell for the 'perforce' user is bash. This is to support Ubuntu 18, which seems to default to /bin/sh for new accounts. |
||
#87 | 25856 | C. Thomas Tyler |
Fixed bug with 'apt-get' keyring setup on Ubuntu. Added 'apt-get update' following addition of Perforce package repository. |
||
#86 | 25854 | C. Thomas Tyler |
Introduced new 'Static Data' internal block in the script, for configuration of static load data in associative arrays. |
||
#85 | 25818 | C. Thomas Tyler | Added '-no_ppr' flag to skip addition of Perforce Package repo. | ||
#84 | 25817 | C. Thomas Tyler | Fixed typo in error message. | ||
#83 | 25815 | C. Thomas Tyler |
Added support for configuring Sample Depot with non-default instance name. |
||
#82 | 25813 | C. Thomas Tyler | Fixed bug with firewall not working for non-default port. | ||
#81 | 25756 | C. Thomas Tyler | Minor tweaks to internal variable names. | ||
#80 | 25753 | C. Thomas Tyler |
Added code to call SDP os_tweaks.sh. Regenerated command summary file. |
||
#79 | 25752 | C. Thomas Tyler |
reset_sdp.sh v3.5.0: Enhanced to support non-default ports in systemd service files. Enhanced logic handling download of Helix Installer supplemental files. Skips download of Sample Depot if '-no_sd' is specified. (HI-9). Skips download of P4API if '-fast' is specified. (HI-9) Removed redundant check for +x on files. Enhanced '-B' processing to blast extracted Sample Depot. Added logic to disable reset_sdp.sh after successful execution. (HI-5) Tweaked REQUIREMENTS docs. |
||
#78 | 25728 | C. Thomas Tyler | Adjustment to Ubuntu public keyring handling. | ||
#77 | 25726 | C. Thomas Tyler | Fixed typo bug affecting only Ubuntu 16 distro. | ||
#76 | 25723 | C. Thomas Tyler | Updated default Helix Core software version r18.2 -> r19.1. | ||
#75 | 25638 | C. Thomas Tyler |
Cosmetic changes. Enhanced doc for password in generated config file when used to bootstrap production. |
||
#74 | 25598 | C. Thomas Tyler | Changed default SDP version for tarball installs. | ||
#73 | 25497 | C. Thomas Tyler |
Fixed bug where MAILFROM email setting wasn't taking effect. Added 'MailFrom' setting. |
||
#72 | 25496 | C. Thomas Tyler | Added '-R' reset option to stop afer doing reset logic. | ||
#71 | 25493 | C. Thomas Tyler | Fixed extra-slash issue. | ||
#70 | 25492 | C. Thomas Tyler | Fixed issues with parameterization of the instance. | ||
#69 | 25491 | C. Thomas Tyler | Corrected variable name. | ||
#68 | 25490 | C. Thomas Tyler | Parameterized case sensitivity setting. | ||
#67 | 25489 | C. Thomas Tyler | Enhanced to parameterize SDP instance name. | ||
#66 | 25488 | C. Thomas Tyler | Updated version. | ||
#65 | 25487 | C. Thomas Tyler | Updated default SDP tarfile version. | ||
#64 | 25433 | C. Thomas Tyler | Added '-d <sdp_dir>' flag. | ||
#63 | 25391 | C. Thomas Tyler | Updated default SDP release for tarball installs. | ||
#62 | 25382 | C. Thomas Tyler |
Updated default SDP release for tar installs to sdp.Unix.2019.1.25374.tgz. |
||
#61 | 25370 | C. Thomas Tyler |
Added '-c <cfg>' and '-C' flags to use (and with '-C' generate) a config file (similar to the '-C' and '-c <cfg>' flags with p4broker). Updated docs accordingly. Added missing 'chmod +x' step in man page in docs. Enabled testing on Mac OSX to get past the package manager test, since yum/apt-get/zypper aren't expected to be on Mac OSX. |
||
#60 | 25324 | C. Thomas Tyler | Changed default SDP version for taball installs. | ||
#59 | 25313 | C. Thomas Tyler | Changed default SDP version for tar installs. | ||
#58 | 25308 | C. Thomas Tyler | Added support for handling firewalld. | ||
#57 | 25303 | C. Thomas Tyler | Adjusted to use 'ftp' user for The Workshop. | ||
#56 | 25302 | C. Thomas Tyler |
Ensure perforce user owns his home directory when the account is created from scratch. |
||
#55 | 25285 | C. Thomas Tyler | Corrected path to Perforce yum repo file. | ||
#54 | 25282 | C. Thomas Tyler | Fixed order-of-operations issue for creating ~perforce/.bash* files. | ||
#53 | 25281 | C. Thomas Tyler | Updated to latest SDP release. | ||
#52 | 25277 | C. Thomas Tyler |
Removed download of Swarm tarball, to encourage use of package installer for Swarm. Added generation of sudoers file for perforce user. Added generation of Perforce Package Repository files for RHEL/CentOS and Ubuntu. |
||
#51 | 25248 | C. Thomas Tyler | Filled in SDP 2019.1 changelist number, 25238. | ||
#50 | 25247 | C. Thomas Tyler | Additional cleanup. | ||
#49 | 25240 | C. Thomas Tyler |
Simplified to use a single /hxmetadata volume, as this is the most common configuration. Small sites don't need multiple volumes, and big sites have an array of hardware options, only some of which require a two-volume solution for metadata to maintain performance. Changed default replica ServerID from p4d_fr_bos to p4d_ha_bos, to promote modern 2018.2 high availability replicas that can be created with the mkrep.sh in SDP 2019.1+. The replica is not actually created with the Helix Installer, just referenced as a sample ServerID name. Extended '-B' flag to cleanup temp dir used by install_sdp_python.sh. Changed behavior to bail on failure to cleanup temp dirs, as this could result in wasted time building outdated versions of P4Python, etc. Added '-i <helix_installer_branch>' debugging flag to support testing of Helix Installer from the dev branch. Moved this and the '-D' flag to a new doc section titled DEBUGGING OPTIONS. Added '-X' eXtreme reset debugging option. Updated some internal variable names. |
||
#48 | 25230 | C. Thomas Tyler | Added logic to install packages. | ||
#47 | 25229 | C. Thomas Tyler | Added wget to zypper package list. | ||
#46 | 25228 | C. Thomas Tyler |
Updated to generate ~perforce .bash_profile and .bashrc for fresh-from-scratch installs. Added warnings mechanism for non-fatal failures. |
||
#45 | 25226 | C. Thomas Tyler |
Updated to use SDP 2019.1.XXXXX (to be udpated later with actual value for XXXXX). Updated to ensure needed OS packages are installed with various package managers (yum, apt-get, and zypper). Added support for SuSE Linux. Updated to create the 'perforce' OS user if needed, and also create its home directory if needed. Updated to pass shellcheck v0.60 verification. |
||
#44 | 25127 | C. Thomas Tyler |
Updated platform for Mac OSX from darwin90x86_64 to macosx1010x86_64, as needed for r18.2+. |
||
#43 | 25054 | C. Thomas Tyler |
Updated SDP default tarball to 2018.1.23583.p2. Corrected Swarm release to 2018.3; there is no 2018.4! |
||
#42 | 25024 | C. Thomas Tyler |
Updated Helix Swarm to 2018.4. It's not yet used in this script other that grabbing the tarball. |
||
#41 | 25009 | C. Thomas Tyler | Changed default tarball to 2018.1.p1. | ||
#40 | 24912 | C. Thomas Tyler | Added support for sdp_reader login. | ||
#39 | 24853 | C. Thomas Tyler | Updating to r18.2 for p4/p4d/p4broker/p4p and r18.3 for Swarm. | ||
#38 | 23826 | C. Thomas Tyler |
Made more robust in resetting alternlate SDP structures with /p4/common being a local directory. Fixed typos in messages. |
||
#37 | 23825 | C. Thomas Tyler | Updated to Helix Core 2018.1. | ||
#36 | 23597 | C. Thomas Tyler | Updated default SDP to lastest patch. | ||
#35 | 23512 | C. Thomas Tyler |
Updated default SDP version. Updated default P4D version to 2017.2. Updated default Swarm to 2017.4 (though Swarm isn't installed yet). |
||
#34 | 23363 | C. Thomas Tyler |
reset_sdp.sh v2.9.11: Tweaked to simplify running a series of installs while re-using the Downloads dir, acquiring an updated SDP tarfile from the FTP server if needed. |
||
#33 | 23359 | C. Thomas Tyler |
Fixed '-t default' processing. Updated to latest SDP tar file. |
||
#32 | 23333 | C. Thomas Tyler | Updated default SDP version to latest just released. | ||
#31 | 23280 | C. Thomas Tyler | reset_sdp.sh v2.9.7: Doc enhancements only, no functional change. | ||
#30 | 23279 | C. Thomas Tyler | reset_sdp.sh v2.9.6: Doc enhancements only, no functional change. | ||
#29 | 23243 | C. Thomas Tyler | Added support for fetching a shelved changelist. | ||
#28 | 23062 | C. Thomas Tyler | Routine merge down to dev from main. | ||
#27 | 23058 | C. Thomas Tyler | Routine merge down to dev from main. | ||
#26 | 23011 | C. Thomas Tyler | Routine merge down to dev from main. | ||
#25 | 22301 | C. Thomas Tyler | Routine merge down to dev from main. | ||
#24 | 22294 | C. Thomas Tyler | Routine merge down to dev from main. | ||
#23 | 22289 | C. Thomas Tyler | Routine merge down to dev from main. | ||
#22 | 22205 | C. Thomas Tyler | Routine merge down to dev from main. | ||
#21 | 22192 | C. Thomas Tyler | Routine merge down to dev from main. | ||
#20 | 21827 | C. Thomas Tyler | Helix Installer, Routine merge down to dev from main. | ||
#19 | 21541 | C. Thomas Tyler | Merge Down to dev from main. | ||
#18 | 21538 | C. Thomas Tyler | Merge Down to dev from main. | ||
#17 | 21506 | C. Thomas Tyler | Routine merge down to dev from main. | ||
#16 | 21504 | C. Thomas Tyler | Routine merge down to dev from main. | ||
#15 | 21502 | C. Thomas Tyler | Routine merge down to dev from main. | ||
#14 | 21359 | C. Thomas Tyler | Merge down to dev from main. | ||
#13 | 21356 | C. Thomas Tyler | Merge down to dev from main. | ||
#12 | 21351 | C. Thomas Tyler | Merge Down to dev from main. | ||
#11 | 21247 | C. Thomas Tyler | Merge Down to Dev from Main. | ||
#10 | 21044 | C. Thomas Tyler | Merge Down to dev from main for helix-installer. | ||
#9 | 20655 | C. Thomas Tyler | Routine Merge Down to dev from main for the Helix Installer. | ||
#8 | 20651 | C. Thomas Tyler | Routine Merge Down to dev from main. | ||
#7 | 20484 | C. Thomas Tyler | Routine Merge Down to dev from main. | ||
#6 | 20053 | C. Thomas Tyler | Routine Merge Down to dev from main. | ||
#5 | 19901 | C. Thomas Tyler | Routine merge down to dev from main. | ||
#4 | 19894 | C. Thomas Tyler | Routine merge down to dev from main. | ||
#3 | 19417 | C. Thomas Tyler | Merge down to dev from main for Helix Installer. | ||
#2 | 19315 | C. Thomas Tyler | Routine Merge Down to dev from main for helix-installer. | ||
#1 | 19232 | C. Thomas Tyler | Populate -b perforce_software-helix-installer-dev. | ||
//guest/perforce_software/helix-installer/main/src/reset_sdp.sh | |||||
#2 | 19231 | C. Thomas Tyler |
Adjusted Swarm URL to reflect the Helix Installer move from //guest/tom_tyler to //guest/perforce_software. |
||
#1 | 19230 | C. Thomas Tyler |
Populate -o //guest/tom_tyler/helix-installer/... //guest/perforce_software/helix-installer/.... |
||
//guest/tom_tyler/helix-installer/main/src/reset_sdp.sh | |||||
#21 | 18963 | C. Thomas Tyler | Updated to latest SDP 2016.1.18958. | ||
#20 | 16837 | C. Thomas Tyler | Updated to latest SDP tarfile. | ||
#19 | 16697 | C. Thomas Tyler |
Tweaked to account for cases where 'hostname -i' call returns more than one IP address. |
||
#18 | 16671 | C. Thomas Tyler |
reset_sdp.sh v2.6.9: * Minor optimization to error message when gcc and/or gcc-c++ packages are missing. * The '-fast' flag now changes the error relating to gcc/g++ not being installed to a warning. * Added confirmation message if gcc/g++ are found. |
||
#17 | 16670 | C. Thomas Tyler |
reset_sdp.sh v2.6.8: * Now clones SDP main branch from The Workshop by default, rather than using a tar file. * Added '-b' to override default branch (main), e.g. '-b dev'. * Added '-t <tarfile>' (or '-t default') to use the old tarfile install method of using a hard-coded tarball, good for when stability is preferred over using the very latest. |
||
#16 | 16660 | C. Thomas Tyler |
Added '-p' flag to enable preserving existing directories under /p4/common. |
||
#15 | 16642 | C. Thomas Tyler | Updated default SDP version. | ||
#14 | 16624 | C. Thomas Tyler |
reset_sdp.sh v2.6.5. For Linux hosts, optimized to use 'hostname -i' rather than 'hostname -I'. Added inline comments on IP selection on Linux and OSX. |
||
#13 | 16623 | C. Thomas Tyler |
Changed order of commands to fix issue with permissions when generating SDP broker config file. |
||
#12 | 16607 | C. Thomas Tyler | Audit enhancement. | ||
#11 | 16606 | C. Thomas Tyler |
Improved handling of simulated mail from SDP scripts, so that live_checkpoint succeeds on all platforms; it had failed previosuly on Mac/Darwin due to failure sending email. Improved backup handling. |
||
#10 | 16602 | C. Thomas Tyler |
Added '-local' option; avoids pulling from Workshop/FTP server. Updated Swarm to 2015.3. |
||
#9 | 16567 | C. Thomas Tyler | Updated SDP Version. | ||
#8 | 16396 | C. Thomas Tyler | Rolled back Swarm version. | ||
#7 | 16395 | C. Thomas Tyler | Updated to 2015.2 GA for P4D and 2015.3 GA for Swarm. | ||
#6 | 16393 | C. Thomas Tyler |
Fixed issue with 'sed' call. Updated to work with new HOSTIP setting in SDP. |
||
#5 | 16377 | C. Thomas Tyler |
Updated to pick up latest SDP, and made corresponding adjustments to processing of subsitutions in mkdirs.sh. |
||
#4 | 16359 | C. Thomas Tyler | Minor code cleanlup. | ||
#3 | 16358 | C. Thomas Tyler |
Adjusted base path for Helix Installer. Updated coypright to reference LICENSE file. |
||
#2 | 16349 | C. Thomas Tyler | Updated to latest SDP version. | ||
#1 | 15829 | C. Thomas Tyler |
Moved Helix Installer to new Workshop Standard for personal projects. |
||
//guest/tom_tyler/sw/main/hi/src/reset_sdp.sh | |||||
#22 | 15629 | C. Thomas Tyler |
reset_sdp.sh v2.5.0: * Updated SDP to 2015.1.15607. * Added '-C' (clean) flag to blast /depotdata/p4/common. |
||
#21 | 15611 | C. Thomas Tyler |
reset_sdp.sh v2.4.9: * Updated default Swarm to 2015.2. * Fixed mostly harmless bug attempting to pull a non-existing file from the web. |
||
#20 | 15060 | C. Thomas Tyler | Rollback of Copy Up done with a new utility that apparently needs some work. | ||
#19 | 15051 | C. Thomas Tyler | Copy Up using 'p4 copy -r -b tom_tyler-hi-dev' | ||
#18 | 15007 | C. Thomas Tyler | Fixed expression. | ||
#17 | 14987 | C. Thomas Tyler |
Reduced excessive noise from from rsync and tar commands. Added '--delete' to rsync commands handling the Sample Depot to force a clean reset. Added clear completion messages. |
||
#16 | 14973 | C. Thomas Tyler | Added -no_ssl flag. | ||
#15 | 14956 | C. Thomas Tyler | Fixed 'ps' check. | ||
#14 | 14954 | C. Thomas Tyler | Fixed typo in case sensitivity mod. | ||
#13 | 14953 | C. Thomas Tyler |
Updated various settings to match changes in SDP. Removed generation of a duplicate broker config file. |
||
#12 | 14952 | C. Thomas Tyler |
Adjusted case sensitivitiy to be case-sensitive on Linux, the opposite of the SDP default. |
||
#11 | 14949 | C. Thomas Tyler |
Enhanced to ensure that 'reset_sdp.sh' is the only script required. It now downloads all other scripts and data files as needed. |
||
#10 | 14910 | C. Thomas Tyler |
Added initialtion of empty /depotdata /metadata and /logs dirs. |
||
#9 | 14903 | C. Thomas Tyler | Fixed issue running under Vagrant. | ||
#8 | 14902 | C. Thomas Tyler |
Changed default list of SDP instances to initialize from "1 12 abc" (illustrating ability to use named rather than number instances) to just "1", which is mostly all that's wanted for testing and pilot installations. |
||
#7 | 14901 | C. Thomas Tyler | Fixed a typo in 'chmod' call. | ||
#6 | 14188 | C. Thomas Tyler | Updated SDP version. | ||
#5 | 14120 | C. Thomas Tyler |
Moved sample depot checkpoint load to configurator script. Added '-fast' flag to speed up testing. Various minor tweaks. |
||
#4 | 14106 | C. Thomas Tyler |
Implemented Sample Depot SDP configurator script. Tightened logic around process kill statement, and made it work for Linux/Mac. |
||
#3 | 14063 | C. Thomas Tyler |
Added generation of initial live checkpoint for each instance. Adjusted permissions on downloads folder. Removed bad code fragements. Cosmetic enhancement to the password. |
||
#2 | 14033 | C. Thomas Tyler |
Added script to transform stock Sample Depot data set to be SDP compliant (mostly a stub at this point). Various improvements to reset_sdp.sh and the wrapper r.sh. |
||
#1 | 13940 | C. Thomas Tyler |
Added my personal reset_sdp test script. DO NOT DEPLOY on a live server. |