bootstrap-sdp-setup.sh #4

  • //
  • guest/
  • perforce_software/
  • cbd/
  • dev/
  • test/
  • bootstrap-sdp-setup.sh
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/bin/bash

# This sript calls the Helix Installer to laod the SDP and sample SDP data.
declare HelixInstallerScriptURL="https://swarm.workshop.perforce.com/downloads/guest/tom_tyler/sw/main/hi/src/reset_sdp.sh"
declare HelixInstallerScript=/tmp/reset_sdp.sh

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

echo "Creating perforce user."
sudo groupadd perforce
sudo useradd -s /bin/bash -m perforce -g perforce
echo perforce:4F@stSCM | sudo chpasswd

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:4F@stSCM | sudo chpasswd

echo "Setting up environment niceties for perforce user."
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
cat $BASHRC >> ~perforce/.bashrc
sudo chown perforce:perforce ~perforce/.bashrc

GET_SDP_RESET_SCRIPT=/tmp/get_reset_sdp.sh
echo '#!/bin/bash'> $GET_SDP_RESET_SCRIPT
echo 'cd /tmp' >> $GET_SDP_RESET_SCRIPT
echo "wget -q $HelixInstallerScriptURL" >> $GET_SDP_RESET_SCRIPT
echo "chmod +x $HelixInstallerScript" >> $GET_SDP_RESET_SCRIPT
sudo chmod +x $GET_SDP_RESET_SCRIPT
sudo $GET_SDP_RESET_SCRIPT
echo "Running Helix Installer script acquired from: $HelixInstallerScriptURL"
sudo $HelixInstallerScript
cat /tmp/reset_sdp.log

echo "Setup done."
# 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.