Changeset - 10c0cde7f869
[Approved]
0 1 0
Dennis Fink - 3 years ago 2022-06-08 22:25:22
dennis.fink@c3l.lu
Add shebang to init.sh
1 file changed with 2 insertions and 0 deletions:
2 comments (0 inline, 2 general)
init.sh
Show inline comments
 
#!/usr/bin/env bash
 

	
 
generateKey() {
 
	touch sshKey
 
	touch sshKey.pub
 
	rm sshKey
 
	rm sshKey.pub
 
	ssh-keygen -t ed25519 -f ./sshKey -q -N "" -C ""
 
}
 

	
 
deployKey() {
 
	sshpass -p alarm ssh-copy-id -i ./sshKey.pub -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PubkeyAuthentication=false alarm@$1
 
}
 

	
 
# If keys are present, we just need to deploy it and destroy the SSH Agent
 
# Otherwise, we genrate a key and then deploy it
 
# The key can be present on the remote host multiple times,
 
# -> not a big issue, just not clean, but it works
 
[ -e sshKey ] && [ -e sshKey.pub ] || generateKey
 

	
 

	
 
for remoteHost in "$@"
 
do
 
    echo "$remoteHost"
 
    deployKey "$remoteHost"
 
done
 

	
 
export SSH_AUTH_SOCK=/dev/null
Dennis Fink (metalgamer) 2 years and 10 months ago comment on pull request "Fixed some shellcheck warnings"

Status change: Under review

x 2 years and 10 months ago comment on pull request "Fixed some shellcheck warnings"

Status change: Approved

Answer is "ok" (via Matrix chat)
2 comments (0 inline, 2 general)