Skip to content
Snippets Groups Projects
Commit db565e70 authored by Kevin DeMarco's avatar Kevin DeMarco
Browse files

better ssh passphrase management

parent 407d5089
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ USAGE: ...@@ -10,7 +10,7 @@ USAGE:
OPTIONS: OPTIONS:
-h Print this usage statement -h Print this usage statement
-s Use SSH vice SSL to download -s Use SSH vice SSL to download
-d Destination directory for team repo -d Destination directory for team repo
(default: ${HOME}/scrimmage) (default: ${HOME}/scrimmage)
EXAMPLES: EXAMPLES:
...@@ -59,27 +59,32 @@ TEAM_NAME="$1" ...@@ -59,27 +59,32 @@ TEAM_NAME="$1"
URL_PREFIX="https://gitlab.nps.edu/" URL_PREFIX="https://gitlab.nps.edu/"
if [ "${USE_SSH}" = true ]; then if [ "${USE_SSH}" = true ]; then
#don't make me type my git ssh password every time:
stty -echo stty -echo
eval `ssh-agent` if [ ! -S ${HOME}/.ssh/ssh_auth_sock ]; then
eval `ssh-add` eval `ssh-agent`
ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
fi
export SSH_AUTH_SOCK=${HOME}/.ssh/ssh_auth_sock
ssh-add -l | grep "The agent has no identities" && ssh-add
stty echo stty echo
URL_PREFIX="git@gitlab.nps.edu:" URL_PREFIX="git@gitlab.nps.edu:"
fi fi
# Create a map that points team names to team repo urls # Create a map that points team names to team repo urls
# bash 4 technique (associative array) # bash 4 technique (associative array)
declare -A REPOS declare -A REPOS
REPOS=(["scrimmage-templates"]="${URL_PREFIX}sasc-itar/scrimmage-templates.git" \ REPOS=(["scrimmage-templates"]="${URL_PREFIX}sasc-itar/scrimmage-templates.git" \
["usma"]="${URL_PREFIX}todd.brick_usma.edu/scrimmage-templates.git" \ ["usma"]="${URL_PREFIX}todd.brick_usma.edu/scrimmage-templates.git" \
["usafa"]="${URL_PREFIX}C17Alexander.Fulton_usafa.edu/scrimmage-templates.git" \ ["usafa"]="${URL_PREFIX}C17Alexander.Fulton_usafa.edu/scrimmage-templates.git" \
["usna"]="${URL_PREFIX}dawkins_usna.edu/scrimmage-templates.git") ["usna"]="${URL_PREFIX}dawkins_usna.edu/scrimmage-templates.git")
# Get the team repo url and ensure that it is valid" # Get the team repo url and ensure that it is valid"
REPO_URL="${REPOS[$TEAM_NAME]}" REPO_URL="${REPOS[$TEAM_NAME]}"
if [ "$REPO_URL" = "" ]; then if [ "$REPO_URL" = "" ]; then
echo echo
echo "ERROR: Invalid team name." echo "ERROR: Invalid team name."
usage usage
exit -2 exit -2
fi fi
...@@ -97,7 +102,7 @@ pushd ${WORK_DIR} >& /dev/null ...@@ -97,7 +102,7 @@ pushd ${WORK_DIR} >& /dev/null
git remote set-url origin "${REPO_URL}" > /dev/null 2>&1 git remote set-url origin "${REPO_URL}" > /dev/null 2>&1
git fetch origin git fetch origin
git reset --hard origin/master git reset --hard origin/master
# Run cmake and "build" the project # Run cmake and "build" the project
mkdir -p ./build mkdir -p ./build
pushd ./build >& /dev/null pushd ./build >& /dev/null
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment