diff options
Diffstat (limited to 'usr.bin/ssh-copy-id/ssh-copy-id.sh')
-rwxr-xr-x | usr.bin/ssh-copy-id/ssh-copy-id.sh | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/usr.bin/ssh-copy-id/ssh-copy-id.sh b/usr.bin/ssh-copy-id/ssh-copy-id.sh index 94429de..e16cfaa 100755 --- a/usr.bin/ssh-copy-id/ssh-copy-id.sh +++ b/usr.bin/ssh-copy-id/ssh-copy-id.sh @@ -28,7 +28,7 @@ # $FreeBSD$ usage() { - echo "usage: ssh-copy-id [-l] [-i keyfile] [-o option] [-p port] [user@]hostname" >&2 + echo "usage: ssh-copy-id [-lv] [-i keyfile] [-o option] [-p port] [user@]hostname" >&2 exit 1 } @@ -46,6 +46,9 @@ sendkey() { printf "$alg $key $comment\n" >> "$keyfile" ; \ fi ; \ done \ + if [ -x /sbin/restorecon ]; then \ + /sbin/restorecon -F "$HOME/.ssh/" "$keyfile" >/dev/null 2>&1 || true ; \ + fi '\' } @@ -64,11 +67,13 @@ options="" IFS=$nl -while getopts 'i:lo:p:' arg; do +while getopts 'i:lo:p:v' arg; do case $arg in i) hasarg="x" - if [ -r "$OPTARG" ]; then + if [ -r "${OPTARG}.pub" ]; then + keys="$(cat -- "${OPTARG}.pub")$nl$keys" + elif [ -r "$OPTARG" ]; then keys="$(cat -- "$OPTARG")$nl$keys" else echo "File $OPTARG not found" >&2 @@ -85,6 +90,9 @@ while getopts 'i:lo:p:' arg; do o) options=$options$nl-o$nl$OPTARG ;; + v) + options="$options$nl-v" + ;; *) usage ;; |