Lines Matching +full:de +full:- +full:assertion
3 # Copyright (c) 1999-2024 Philip Hands <phil@hands.com>
4 # 2021 Carlos Rodríguez Gili <carlos.rodriguez-gili@upc.edu>
5 # 2020 Matthias Blümel <blaimi@blaimi.de>
8 # 2010 Adeodato =?iso-8859-1?Q?Sim=F3?= <asp16@alu.ua.es>
10 # 2009 Xr <xr@i-jeuxvideo.com>
12 # 2004 Reini Urban <rurban@x-ray.at>
37 # See the ssh-copy-id(1) man page for details
44 SANE_SH=${SANE_SH:-/usr/bin/ksh}
50 cat <<-EOF
65 DEFAULT_PUB_ID_FILE=$(ls -dt "${HOME}"/.ssh/id*.pub 2>/dev/null | grep -v -- '-cert.pub$' | head -n…
66 SSH="ssh -a -x"
71 …printf 'Usage: %s [-h|-?|-f|-n|-s|-x] [-i [identity_file]] [-t target_path] [-F ssh_config] [[-o s…
72 printf '\t-f: force mode -- copy keys without trying to check if they are already installed\n' >&2
73 printf '\t-n: dry run -- no keys are actually copied\n' >&2
74 …printf '\t-s: use sftp -- use sftp instead of executing remote-commands. Can be useful if the re…
75 printf '\t-x: debug -- enables -x in this shell, for debugging\n' >&2
76 printf '\t-h|-?: print this help\n' >&2
82 printf '%s\n' "$1" | sed -e "s/'/'\\\\''/g"
88 if [ -z "$L_ID_FILE" ] ; then
105 …D_FILE" ] && L_PRIVMSG=" (to install the contents of '$PUB_ID_FILE' anyway, look at the -f option)"
106 … file '%s': %s\\n" "$0" "$f" "$(printf '%s\n%s\n' "$ErrMSG" "$L_PRIVMSG" | sed -e 's/.*: *//')" >&2
113 if [ -n "$SSH_AUTH_SOCK" ] && ssh-add -L >/dev/null 2>&1 ; then
114 GET_ID="ssh-add -L"
124 printf '\n%s: ERROR: -i option must not be specified more than once\n\n' "$0" >&2
129 # Check for -i's optional parameter
133 if [ -r "$nextarg" ] && grep -iq ssh "$nextarg"; then
134 …printf '\n%s: ERROR: Missing hostname. Use "-i -- %s" if you really mean to use this as the hostna…
137 elif ! expr -- "$nextarg" : "-[$(echo "$OPTS" | tr -d :)-]" >/dev/null ; then
138 # when not at the last arg, and not followed by an option, -i has an argument
142 use_id_file "${OPTARG:-$DEFAULT_PUB_ID_FILE}"
145 OPTS_oF="${OPTS_oF:+$OPTS_oF }-$OPT '$(quote "${OPTARG}")'"
163 SET_X="set -x;"
164 set -x
172 shift $((OPTIND-1))
185 SSH_OPTS="${SSH_PORT:+-p $SSH_PORT }$OPTS_USER_HOST"
187 eval set -- "$SSH_OPTS"
190 if [ -z "$(eval $GET_ID)" ] && [ -r "${PUB_ID_FILE:=$DEFAULT_PUB_ID_FILE}" ] ; then
197 if [ -z "$(eval $GET_ID)" ] ; then
205 [ "$SCRATCH_DIR" ] && [ -d "$SCRATCH_DIR" ] && [ -w "$SCRATCH_DIR" ] && return 0
207 …printf 'ERROR: Assertion failure: in %s(): scratch_dir was not correctly set up (SCRATCH_DIR = "%s…
220 eval set -- "$SSH_OPTS"
222 while read -r ID || [ "$ID" ] ; do
225 # the next line assumes $PRIV_ID_FILE only set if using a single id file - this
226 # assumption will break if we implement the possibility of multiple -i options.
229 $SSH -i "${PRIV_ID_FILE:-$L_TMP_ID_FILE}" \
230 -o ControlPath=none \
231 -o LogLevel=INFO \
232 -o PreferredAuthentications=publickey \
233 -o IdentitiesOnly=yes "$@" exit >"$L_OUTPUT_FILE" 2>&1 </dev/null
242 sed -e 's/^/ERROR: /' <"$L_OUTPUT_FILE" >"$L_TMP_ID_FILE"
268 if [ -z "$NEW_IDS" ] ; then
270 printf '\t\t(if you think this is a mistake, you may want to use -f option)\n\n' >&2
273 …(s) remain to be installed -- if you are prompted now it is to install the new keys\n' "$0" "$(pri…
277 # produce a one-liner to add the keys to remote $TARGET_PATH
281 # (hence the excessive use of semi-colons (;) )
284 # the -z `tail ...` checks for a trailing newline. The echo adds one if was missing
288 INSTALLKEYS_SH=$(tr '\t\n' ' ' <<-EOF
293 [ -f /etc/openwrt_release ] && [ "\$LOGNAME" = "root" ] &&
296 mkdir -p "\${AUTH_KEY_DIR}" &&
297 { [ -z "\`tail -1c "\${AUTH_KEY_FILE}" 2>/dev/null\`" ] ||
301 restorecon -F "\${AUTH_KEY_DIR}" "\${AUTH_KEY_FILE}";
306 # to defend against quirky remote shells: use 'exec sh -c' to get POSIX;
307 printf "exec sh -c '%s'" "${INSTALLKEYS_SH}"
316 eval set -- "$SSH_OPTS"
320 L_SHARED_CON="$SCRATCH_DIR"/master-conn
321 $SSH -f -N -M -S "$L_SHARED_CON" "$@"
322 L_CLEANUP="$SSH -S '$L_SHARED_CON' -O exit 'ignored' >/dev/null 2>&1 ; $SCRATCH_CLEANUP"
325 sftp -b - -o "ControlPath='$L_SHARED_CON'" "ignored" <<-EOF || return 1
326 -get "$AUTH_KEY_FILE" "$L_KEYS"
329 [ -z "$(tail -1c "$L_KEYS" 2>/dev/null)" ] || echo >> "$L_KEYS"
332 sftp -b - -o "ControlPath='$L_SHARED_CON'" "ignored" <<-EOF || return 1
333 -mkdir "$AUTH_KEY_DIR"
344 if SCRATCH_DIR=$(mktemp -d ~/.ssh/ssh-copy-id.XXXXXXXXXX) &&
345 [ "$SCRATCH_DIR" ] && [ -d "$SCRATCH_DIR" ]
348 SCRATCH_CLEANUP="rm -rf \"$SCRATCH_DIR\""
356 REMOTE_VERSION=$($SSH -v -o PreferredAuthentications=',' -o ControlPath=none "$@" 2>&1 |
357 sed -ne 's/.*remote software version //p')
363 for KEY in $(printf "%s" "$NEW_IDS" | cut -d' ' -f2) ; do
365 printf '%s\n' "$KEY" | grep ssh-dss >/dev/null || {
366 …printf '%s: WARNING: Non-dsa key (#%d) skipped (NetScreen only supports DSA keys)\n' "$0" "$KEY_NO…
369 …[ "$DRY_RUN" ] || printf 'set ssh pka-dsa key %s\nsave\nexit\n' "$KEY" | $SSH -T "$@" >/dev/null 2…
376 if [ -z "$ADDED" ] ; then
392 ADDED=$(printf '%s\n' "$NEW_IDS" | wc -l)
397 cat <<-EOF
398 =-=-=-=-=-=-=-=
402 =-=-=-=-=-=-=-=
405 [ -z "$SFTP" ] || PORT_OPT=P
406 cat <<-EOF
410 …ing into the machine, with: "${SFTP:-ssh} ${SEEN_OPT_I:+-i${PRIV_ID_FILE:+ $PRIV_ID_FILE} }${SSH_P…
416 # =-=-=-=