No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

smd-push 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/sh
  2. #
  3. # Released under the terms of GPLv3 or at your option any later version.
  4. # No warranties.
  5. # Copyright Enrico Tassi <gares@fettunta.org>
  6. # the idea is (where == is a bi-directional pipe) :
  7. #
  8. # ssh foo smd-client == tee log == smd-server
  9. #
  10. set -e
  11. #set -x
  12. PREFIX="@PREFIX@"
  13. if [ `echo "$PREFIX" | cut -c -1` = "@" ]; then
  14. SMDROOT=.
  15. echo "smd-pull not installed, assuming smd-common is ./smd-common"
  16. else
  17. SMDROOT=$PREFIX/share/syncmaildir
  18. fi
  19. . $SMDROOT/smd-common
  20. init
  21. parse_args "$@"
  22. read_conffile
  23. # this could be a system wide pre-hook
  24. check_lockfile
  25. setup_plumbing
  26. setup_logging
  27. setup_mailboxnames
  28. # we move to the home, since Mail paths are relative
  29. # to the home
  30. cd
  31. # reset log file before caclling hooks
  32. > $CL
  33. run_hooks $CONFDIR pre push 0
  34. ($MITM $CtS > $LtS) < $CtL &
  35. LOGGER1=$!
  36. atexit_kill $LOGGER1
  37. ($MITM $StC > $LtC) < $StL &
  38. LOGGER2=$!
  39. atexit_kill $LOGGER2
  40. ($PROGRESS_REPORTER $SL) < $PRp &
  41. REPORTER=$!
  42. atexit_kill $REPORTER
  43. setup_workarea
  44. (run_local_server < $LtC 2>> $CL) > $CtL &
  45. CLIENT=$!
  46. atexit_kill $CLIENT
  47. EXITCODE=0
  48. (run_remote_client < $LtS 2> $PRp) > $StL || EXITCODE=1
  49. wait $CLIENT || EXITCODE=1
  50. wait $REPORTER || EXITCODE=1
  51. run_hooks $CONFDIR post push $EXITCODE
  52. report $EXITCODE $SHOWTAGS smd-push smd-pull smd-server smd-client
  53. exit $EXITCODE