#!/bin/bash #------------------------------------------------------------------------------ # test_sc_with_root.sh: Scrpt for testing snapclone.sh. # Requires Perforce Sample Depot configured with the Helix Installer default, # with p4d server running locally with P4PORT ssl:1999, and passwords for # users quinn, earl, and bruno all set to: F@stSCM! # # This scripts sets up three DVCS repos, each copied from a template # with rsync, simulating use of a NetApp snapshot to clone the user # workspace. # The user must have enough sudo access to do a 'chown -R' command on # the .p4root directory after the copy. This is not simulated in this # version set -u function msg () { echo -e "$*"; } function bail () { msg "Error: $1"; exit ${2:-1}; } function cmd () { msg "Executing: $*"; $*; return $?; } function usage () { prog=${0##/*}; msg "Usage:\n\t$prog 2>&1 | tee ${prog/.sh/.log}\n"; exit 1; } H1="==============================================================================" H2="------------------------------------------------------------------------------" declare Version=1.1.1 declare -a TestUsers declare User declare -i i=0 TestUsers[0]=quinn TestUsers[1]=earl TestUsers[2]=bruno #------------------------------------------------------------------------------ # Environment control, including environment hijacking defense. source /p4/common/bin/p4_vars 1 export P4ENVIRO=/dev/null/.p4enviro export P4CONFIG=${P4CONFIG:-.p4config} export P4CONFIG=${P4CONFIG##*/} export P4TICKETS=/netapp/p4/ws/.p4tickets.tsc export P4TRUST=/netapp/tmp/u/.p4trust.tsc [[ $* == *"-h"* ]] && usage ThisUser=$(whoami) if [[ $ThisUser == "perforce" ]]; then exec sudo su root -c "$0 $*" elif [[ $ThisUser != "root" ]]; then bail "Run as root (or perforce)." fi msg "Verified: Running as: $ThisUser." TestPassword='F@stSCM!' while [[ $i -lt ${#TestUsers[@]} ]]; do User=${TestUsers[$i]} msg "Executing as $User: snapclone.sh -u $User -p jam -F -P 'F@stSCM!'" su - $User -c "snapclone.sh -u $User -p jam -F -P 'F@stSCM!'" i=$((i+1)) done
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 20214 | Perforce maintenance |
snapclone.sh v1.1.8: * Changed old '-f' to '-F' * Added new '-f' (fetch); changed default behavior to not fetch. * Updated usage(). * Updated test suite accordingly. |
||
#1 | 20119 | Perforce maintenance | Renamed test script to indicate that it needs root access. | ||
//guest/tom_tyler/snapclone/main/test_sc.sh | |||||
#4 | 20113 | Perforce maintenance |
Modified test_sc.sh to run as root. Coordinated with this change: * Created earl, bruno, and quinn OS accounts on this machine. * Changed ownership of snapclone.sh to perforce:users. * Changed perms of snapclone.sh to 750, allowing group execution. * Changed ownership of /netapp/p4 to perforce:users, with 750 perms. * Changed ownership of /netapp/p4/ws to perforce:users, with 770 perms. * Added /etc/profile.d/snapclone.sh file, which just appends /netapp/p4/bin (where snapclone.sh is) to PATH for all users. |
||
#3 | 20112 | Perforce maintenance | Tweaked var def'n. | ||
#2 | 20090 | Perforce maintenance | Adjusted storage location. | ||
#1 | 19956 | Perforce maintenance | Refactored. | ||
//guest/tom_tyler/snapclone/main/tflex.sh | |||||
#2 | 19954 | Perforce maintenance | Added notes. | ||
#1 | 19953 | Perforce maintenance |
flexclone.sh is taking shape. Added test script. |