diff options
author | Joerg Jaspert <joerg@debian.org> | 2009-07-18 22:48:19 +0200 |
---|---|---|
committer | Joerg Jaspert <joerg@debian.org> | 2009-07-18 22:48:19 +0200 |
commit | 9bc4a2692679e274c7be30459e1c1eb9935828b3 (patch) | |
tree | fb5521def841f8acbe86430c07d47365715509e5 /etc | |
parent | b0ed5e1fcb9c8bec7611ee9dee5f1e4ae1c61efe (diff) |
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 <joerg@debian.org>
Diffstat (limited to 'etc')
-rw-r--r-- | etc/common | 29 |
1 files changed, 22 insertions, 7 deletions
@@ -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 |