bootstrap-sdp-setup.sh #1

  • //
  • guest/
  • perforce_software/
  • cbd/
  • dev/
  • test/
  • bootstrap-sdp-setup.sh
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/usr/bin/env bash
# This bootstraps a new CentOS server with the Perforce SDP.
# This script sets up:
# - SDP filesystems
# - perforce account
# - Loads SDP with the Sample Depot

DataDir=/shared/cbd/test/data
SDPFile=sdp.Unix.2014.2.10464.tgz
SDPURL=http://swarm.workshop.perforce.com/files/guest/perforce_software/sdp/dist/$SDPFile

echo "Making sdp directories"
sudo mkdir /depotdata
sudo mkdir /metadata
sudo mkdir /logs

echo "Creating perforce user"
sudo groupadd perforce
sudo useradd -d /p4 -s /bin/bash -m perforce -g perforce

echo "Allowing user 'perforce' sudo privileges"
echo 'perforce ALL=(ALL) NOPASSWD:ALL'>/tmp/perforce
sudo chmod 0700 /tmp/perforce
sudo chown root:root /tmp/perforce
sudo mv /tmp/perforce /etc/sudoers.d/.
echo perforce:cbd4me2day | sudo chpasswd

# Setup a few things to make life easier as the Perforce user
BASH_PROF=/tmp/.bash_profile
echo '[[ -r /p4/common/bin/p4_vars ]] && source /p4/common/bin/p4_vars 1'> $BASH_PROF
echo 'export P4CONFIG=.p4config'>> $BASH_PROF
sudo chown perforce:perforce $BASH_PROF
sudo mv $BASH_PROF /p4/.

RESET_SDP=/tmp/reset_sdp.sh
echo '#!/bin/bash'> $RESET_SDP
echo 'sudo cp -p /sdp/dist/$SDPFile /depotdata/.'>> $RESET_SDP
echo 'cd /depotdata'>> $RESET_SDP
echo 'sudo tar -xzvpf $SDPFile'>> $RESET_SDP
echo 'sudo chown -R perforce:perforce /depotdata'>> $RESET_SDP
sudo chmod +x $RESET_SDP
sudo chown perforce:perforce $RESET_SDP
sudo mv $RESET_SDP /p4
sudo /p4/reset_sdp.sh

echo "Setup done."

#sudo ln -s /sdp/Server/test/test_SDP.py /p4/test_SDP.py
#sudo chown perforce:perforce /p4/test_SDP.py
# Change User Description Committed
#13 22188 C. Thomas Tyler Fixed logic creating suders file for perforce user.
#12 21805 C. Thomas Tyler Routine merge down to dev from main.
#11 19285 C. Thomas Tyler Added niceties for users 'perforce' and 'vagrant', mainly a 'go'
for each.  So you can now get set up for testing by doing:
vagrant ssh
go
go

The first call to 'go' executes as the vagrant user.  It just does
a 'sudo su - perforce' to change you to the perforce user.

The second call to 'go' executes as the perforce user.  It sets up
the shell environment for CBD testing.

Added a ReadMe.md documenting this and describing files in this
directory.
#10 19253 C. Thomas Tyler Routine merge-down from main to dev.
#9 15152 C. Thomas Tyler Routine Merge Down to dev from main for CBD, using:
p4 merge -b perforce_software-cbd-dev
#8 15039 C. Thomas Tyler Merge Down CBD to dev from main to pick up test suite improvements and
an exception bug fix in Cbd.py.
#7 14997 C. Thomas Tyler Enhanced dir boostrapping.
#6 14990 C. Thomas Tyler Removed call to Helix Installer; it now belongs in test_sdp.sh,
where it is easier to re-use in frequent iterations, and keeping
this script restricted to one-time bootstrap steps.
#5 14907 C. Thomas Tyler Moved test data files into 'shared' folder to make them available
on the 'helix-01' text VM, and tweaked test_cbd.sh to reference them
there.
#4 14904 C. Thomas Tyler Prepared CentOS VM, initialized by Vagrant (command-line virtual machine
management) for ground-up test environment building, starting from the
vanilla CentOS OS installation.

Modified startup scripts to use the Helix Installer to simpfliy the bulk of
the installation.

Added test config file for testing on Vagrant-initialized 'helix-01' box.
#3 14851 C. Thomas Tyler Enhanced to use Helix Installer ("HI") project's SDP reset script.

Changed CBD password to one less likey to be rejected on systems with
stringent password requirements.

This is a WIP change.
#2 11359 C. Thomas Tyler chmod +x for bootstrap=*.sh scripts.
#1 11354 C. Thomas Tyler Started work on Vagrant test harness.