From 9bc4a2692679e274c7be30459e1c1eb9935828b3 Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Sat, 18 Jul 2009 22:48:19 +0200 Subject: runmirrors change the runmirrors.mirror format. We keep compatibility with the old format, so if one uses them they should continue to do so. If one uses the new style, one is able to add all possible ssh options one wants. They just have to start with -. All that in there will be passed as-is to ssh. Signed-off-by: Joerg Jaspert --- etc/common | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'etc') diff --git a/etc/common b/etc/common index fb5e731..e579e64 100644 --- a/etc/common +++ b/etc/common @@ -39,16 +39,31 @@ signal () { PUSHARCHIVE=${PUSHARCHIVE:-""} PUSHCB=${PUSHCB:-""} + # And now get # back to space... + SSHOPTS=${SSHOPTS/\#/ } + # Defaults we always want, no matter what - SSH_OPTIONS="-o BatchMode=yes -o SetupTimeOut=45 -o ConnectTimeout=45 -o PasswordAuthentication=no" + SSH_OPTIONS="-o user=${USERNAME} -o BatchMode=yes -o SetupTimeOut=45 -o ConnectTimeout=45 -o PasswordAuthentication=no" if [ -n "${SSH_OPTS}" ]; then SSH_OPTIONS="${SSH_OPTIONS} ${SSH_OPTS}" fi - if [ ${SSHPROTO} -ne 1 ] && [ ${SSHPROTO} -ne 2 ]; then - # Idiots, we only want 1 or 2. Cant decide? Lets force 2 - ${SSHPROTO}=2 + if [ -n "${SSHKEY}" ]; then + SSH_OPTIONS="${SSH_OPTIONS} -i ${SSHKEY}" + fi + + if [ -n "${SSHOPTS}" ]; then + SSH_OPTIONS="${SSH_OPTIONS} ${SSHOPTS}" + fi + + if [ ${SSHPROTO} -ne 1 ] && [ ${SSHPROTO} -ne 2 ] && [ ${SSHPROTO} -ne 99 ]; then + # Idiots, we only want 1 or 2. Cant decide? Lets force 2. + SSHPROTO=2 + fi + + if [ -n "${SSHPROTO}" ] && [ ${SSHPROTO} -ne 99 ]; then + SSH_OPTIONS="${SSH_OPTIONS} -${SSHPROTO}" fi date -u >> "${LOGDIR}/${MIRROR}.log" @@ -65,14 +80,14 @@ signal () { # Default normal "fire and forget" push echo "Sending normal push" >> "${LOGDIR}/${MIRROR}.log" PUSHARGS1="sync:all" - ssh $SSH_OPTIONS -i "${SSHKEY}" -o"user ${USERNAME}" -${SSHPROTO} "${HOSTNAME}" "${PUSHARGS} ${PUSHARGS1}" >>"${LOGDIR}/${MIRROR}.log" 2>&1 & + ssh $SSH_OPTIONS "${HOSTNAME}" "${PUSHARGS} ${PUSHARGS1}" >>"${LOGDIR}/${MIRROR}.log" 2>&1 & elif [ "xstagedx" = "x${PUSHTYPE}x" ]; then # Want a staged push. Fine, lets do that echo "Sending staged push" >> "${LOGDIR}/${MIRROR}.log" # Step1: Do a push to only sync stage1, do not background PUSHARGS1="sync:stage1" - ssh $SSH_OPTIONS -i "${SSHKEY}" -o"user ${USERNAME}" -${SSHPROTO} "${HOSTNAME}" "${PUSHARGS} ${PUSHARGS1}" >>"${LOGDIR}/${MIRROR}.log" 2>&1 + ssh $SSH_OPTIONS "${HOSTNAME}" "${PUSHARGS} ${PUSHARGS1}" >>"${LOGDIR}/${MIRROR}.log" 2>&1 touch "${PUSHLOCKOWN}" # Step2: Wait for all the other "lock"files to appear. @@ -111,7 +126,7 @@ signal () { # Step3: It either timed out or we have all the "lock"files, sync stage2 PUSHARGS2="sync:stage2" echo "Now doing the second stage push" >> "${LOGDIR}/${MIRROR}.log" - ssh $SSH_OPTIONS -i "${SSHKEY}" -o"user ${USERNAME}" -${SSHPROTO} "${HOSTNAME}" "${PUSHARGS} ${PUSHARGS2}" >>"${LOGDIR}/${MIRROR}.log" 2>&1 + ssh $SSH_OPTIONS "${HOSTNAME}" "${PUSHARGS} ${PUSHARGS2}" >>"${LOGDIR}/${MIRROR}.log" 2>&1 else # Can't decide? Then you get nothing. return -- cgit v1.2.3