123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #!/bin/sh
- #
- # Released under the terms of GPLv3 or at your option any later version.
- # No warranties.
- # Copyright Enrico Tassi <gares@fettunta.org>
-
- # the idea is (where == is a bi-directional pipe) :
- #
- # ssh foo smd-server == tee log == smd-client
- #
-
- set -e
- #set -x
-
- PREFIX="@PREFIX@"
- if [ `echo "$PREFIX" | cut -c -1` = "@" ]; then
- SMDROOT=.
- echo "smd-pull not installed, assuming smd-common is ./smd-common"
- else
- SMDROOT=$PREFIX/share/syncmaildir
- fi
-
- . $SMDROOT/smd-common
-
- init
- parse_args "$@"
- read_conffile
- # this could be a system wide pre-hook
- check_lockfile
- setup_plumbing
- setup_logging
- setup_mailboxnames
-
- # we move to the home, since Mail paths are relative
- # to the home
- cd
-
- # reset log file before caclling hooks
- > $CL
-
- run_hooks $CONFDIR pre pull 0
-
- ($MITM $CtS > $LtS) < $CtL &
- LOGGER1=$!
- atexit_kill $LOGGER1
-
- ($MITM $StC > $LtC) < $StL &
- LOGGER2=$!
- atexit_kill $LOGGER2
-
- ($PROGRESS_REPORTER $CL) < $PRp &
- REPORTER=$!
- atexit_kill $REPORTER
-
- (run_local_client < $LtC 2> $PRp) > $CtL &
- CLIENT=$!
- atexit_kill $CLIENT
-
- EXITCODE=0
- (run_remote_server < $LtS 2> $SL) > $StL || EXITCODE=1
-
- wait $CLIENT || EXITCODE=1
- wait $REPORTER || EXITCODE=1
-
- run_hooks $CONFDIR post pull $EXITCODE
-
- report $EXITCODE $SHOWTAGS smd-pull smd-push smd-client smd-server
-
- exit $EXITCODE
|