bootstrap-sdp-setup.sh #9

  • //
  • guest/
  • perforce_software/
  • cbd/
  • dev/
  • test/
  • bootstrap-sdp-setup.sh
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/bin/bash
declare Version=1.1.4
declare Password=4F@stSCM

echo "Running ${0##*/} v$Version."

# Installing Helix Swarm and Git Fusion packages.
sudo yum install perforce-git-fusion -y
sudo yum install perforce-swarm -y
sudo yum install perforce-cli -y

# Note: Installing the 'perforce-server' package creates the 'perforce' user with a home dir
# of /opt/perforce/servers.  We change the home directory below to the SDP standard.
sudo yum install perforce-server -y

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 "Creating initial SDP dirs."
declare DirList="/p4 /depotdata/reset /depotdata/p4/common/bin/cbd /metadata /logs"

mkdirCmd="sudo /bin/mkdir -p $DirList"
echo "Running: $mkdirCmd"
$mkdirCmd

chownCmd="sudo chown -R perforce:perforce $DirList"
echo "Running: $chownCmd"
$chownCmd

echo "Setting home directory for 'perforce' user to /p4."
usermod -d /p4 perforce

echo "Setting up environment niceties for perforce user."
BASH_PROFILE=/tmp/.bash_profile.perforce
echo '[[ -f /etc/bashrc ]] && source /etc/bashrc' > $BASH_PROFILE
echo '[[ -f ~/.bashrc ]] && source ~/.bashrc' >> $BASH_PROFILE
sudo chown perforce:perforce $BASH_PROFILE
sudo mv -f $BASH_PROFILE ~perforce/.bash_profile

BASHRC=/tmp/.bashrc.perforce
echo '[[ -f /p4/common/bin/p4_vars ]] && source /p4/common/bin/p4_vars 1'> $BASHRC
echo "export PS1='\$USER@\${HOSTNAME%%.*}:\$PWD '" >> $BASHRC
echo "alias md='/bin/mkdir -p'" >> $BASHRC
echo "alias rd=/bin/rmdir" >> $BASHRC
echo "alias o='p4 opened ...'" >> $BASHRC
echo 'set -o vi' >> $BASHRC
sudo chown perforce:perforce $BASHRC
sudo mv -f $BASHRC ~perforce/.bashrc

echo "Setting password for perforce user to $Password."
echo perforce:$Password | sudo chpasswd

exit 0
# 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.