mirror of
				https://github.com/Burnett01/rsync-deployments.git
				synced 2025-11-04 09:29:04 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
	
		
			543 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
	
		
			543 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
#!/bin/sh
 | 
						|
 | 
						|
FOLDER=${1:-default}
 | 
						|
STORE_PATH="/tmp/ssh-agent/$FOLDER"
 | 
						|
mkdir -p "$STORE_PATH"
 | 
						|
 | 
						|
# Start the SSH agent if it isn't already.
 | 
						|
if [ -z "$SSH_AGENT_PID" ]; then
 | 
						|
	if [ -f "$STORE_PATH/id" ]; then
 | 
						|
		# Our auth agent is already running.
 | 
						|
		# Reload the vars, and export them.
 | 
						|
		SSH_AGENT_PID=$(cat "$STORE_PATH/id")
 | 
						|
		export SSH_AGENT_PID
 | 
						|
 | 
						|
		SSH_AUTH_SOCK=$(cat "$STORE_PATH/sock")
 | 
						|
		export SSH_AUTH_SOCK
 | 
						|
	else
 | 
						|
		eval "$(ssh-agent)" > /dev/null
 | 
						|
		echo "$SSH_AGENT_PID" > "$STORE_PATH"/id
 | 
						|
		echo "$SSH_AUTH_SOCK" > "$STORE_PATH"/sock
 | 
						|
	fi
 | 
						|
fi
 |