[openssh-commits] [openssh] 03/05: shellcheck tidyage
git+noreply at mindrot.org
git+noreply at mindrot.org
Tue Oct 13 12:45:49 AEDT 2020
This is an automated email from the git hooks/post-receive script.
dtucker pushed a commit to branch master
in repository openssh.
commit f7c3a39b016dd77709ecbf18da8282f967b86cd7
Author: Philip Hands <phil at hands.com>
Date: Sat Oct 3 21:45:16 2020 +0200
shellcheck tidyage
SSH-Copy-ID-Upstream: 5b08f840e78ac544288b3983010a1b0585e966fd
---
contrib/ssh-copy-id | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/contrib/ssh-copy-id b/contrib/ssh-copy-id
index d7c3a61f..6cea9935 100644
--- a/contrib/ssh-copy-id
+++ b/contrib/ssh-copy-id
@@ -262,6 +262,7 @@ EOF
printf "exec sh -c '%s'" "${INSTALLKEYS_SH}"
}
+#shellcheck disable=SC2120 # the 'eval set' confuses this
installkeys_via_sftp() {
# repopulate "$@" inside this function
@@ -269,22 +270,24 @@ installkeys_via_sftp() {
L_KEYS=$SCRATCH_DIR/authorized_keys
L_SHARED_CON=$SCRATCH_DIR/master-conn
- $SSH -f -N -M -S $L_SHARED_CON "$@"
+ $SSH -f -N -M -S "$L_SHARED_CON" "$@"
L_CLEANUP="$SSH -S $L_SHARED_CON -O exit 'ignored' >/dev/null 2>&1 ; $SCRATCH_CLEANUP"
+ #shellcheck disable=SC2064
trap "$L_CLEANUP" EXIT TERM INT QUIT
sftp -b - -o "ControlPath=$L_SHARED_CON" "ignored" <<-EOF || return 1
-get .ssh/authorized_keys $L_KEYS
EOF
# add a newline or create file if it's missing, same like above
- [ -z "$(tail -1c $L_KEYS 2>/dev/null)" ] || echo >> $L_KEYS
+ [ -z "$(tail -1c "$L_KEYS" 2>/dev/null)" ] || echo >> "$L_KEYS"
# append the keys being piped in here
- cat >> $L_KEYS
+ cat >> "$L_KEYS"
sftp -b - -o "ControlPath=$L_SHARED_CON" "ignored" <<-EOF || return 1
-mkdir .ssh
chmod 700 .ssh
put $L_KEYS .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
EOF
+ #shellcheck disable=SC2064
eval "$L_CLEANUP" && trap "$SCRATCH_CLEANUP" EXIT TERM INT QUIT
}
@@ -339,6 +342,7 @@ case "$REMOTE_VERSION" in
if ! [ "$DRY_RUN" ] ; then
printf '%s\n' "$NEW_IDS" | \
if [ "$SFTP" ] ; then
+ #shellcheck disable=SC2119
installkeys_via_sftp
else
$SSH "$@" "$(installkeys_sh)"
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list