This repository has been archived by the owner on Jun 30, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Enrico Tassi
committed
May 19, 2012
1 parent
661fb3e
commit 0da78a3
Showing
7 changed files
with
149 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
- it seems that escaping in translator LR RL is inconsistent | ||
- check for .. in MAILBOX_* | ||
- smd-uniform-names | ||
- no delete 2nd round | ||
- autostart option in smd applet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/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: | ||
# 0) it is the first run (no db) | ||
# 1) we compute the local db with mddiff | ||
# 2) we push it to the remote host via ssh | ||
# 3) we start a special pull where smd-server uses the special db | ||
# and where smd-client just emits a shell script with all the renaming | ||
# 4) we remove the remote db | ||
|
||
set -e | ||
#set -x | ||
|
||
PREFIX="@PREFIX@" | ||
if [ `echo "$PREFIX" | cut -c -1` = "@" ]; then | ||
SMDROOT=. | ||
echo "smd-uniform-names 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 | ||
|
||
setup_workarea | ||
|
||
ORIG_CHILDARGS="$CHILDSARGS" | ||
|
||
CHILDSARGS="$ORIG_CHILDARGS --get-mddiff-cmdline --override-db $RENAMEDB" | ||
MDLINE=`run_local_server` | ||
|
||
|
||
gc_mktemp | ||
TMPERR="$RC" | ||
$MDLINE > /dev/null 2> $TMPERR | ||
grep -v '^warning.*unable to open db' $TMPERR || true | ||
mv $RENAMEDB.new $RENAMEDB | ||
atexit_rm $RENAMEDB.mtime.new | ||
atexit_rm $RENAMEDB | ||
|
||
CHILDSARGS="$ORIG_CHILDARGS --dump-stdin $RENAMEDB" | ||
cat $RENAMEDB | run_remote_server | ||
|
||
($MITM $CtS > $LtS) < $CtL & | ||
LOGGER1=$! | ||
atexit_kill $LOGGER1 | ||
|
||
($MITM $StC > $LtC) < $StL & | ||
LOGGER2=$! | ||
atexit_kill $LOGGER2 | ||
|
||
($PROGRESS_REPORTER $CL) < $PRp & | ||
REPORTER=$! | ||
atexit_kill $REPORTER | ||
|
||
CHILDSARGS="$ORIG_CHILDARGS --rename-only --override-db $RENAMEDB" | ||
(run_local_client < $LtC 2> $PRp) > $CtL & | ||
CLIENT=$! | ||
atexit_kill $CLIENT | ||
|
||
CHILDSARGS="$ORIG_CHILDARGS --stop-after-diff --override-db $RENAMEDB" | ||
EXITCODE=0 | ||
(run_remote_server < $LtS 2> $SL) > $StL || EXITCODE=1 | ||
|
||
wait $CLIENT || EXITCODE=1 | ||
wait $REPORTER || EXITCODE=1 | ||
|
||
report $EXITCODE 0 smd-push smd-pull smd-server smd-client | ||
|
||
exit $EXITCODE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
NAME | ||
smd-uniform-names - renames local mails as on the remote host | ||
|
||
SYNOPSIS | ||
smd-uniform-names [-v|--verbose] [endpoint] | ||
|
||
DESCRIPTION | ||
smd-uniform-names is useful to migrate from offlineimap to smd. | ||
offlineimap may name the same email differently on the local and | ||
remote host. This utility generates a script to be run on the local | ||
host to uniform the names to the remote ones. | ||
|
||
The utility generates the script '~/smd-rename.sh' that has to be run | ||
by the user. | ||
|
||
OPTIONS | ||
-v --verbose Verbose output | ||
endpoint Is the suffix for the name of the configuration file to | ||
use. If it is omitted, the configuration file | ||
~/.smd/config.default is used. | ||
FILES | ||
~/.smd/config.* | ||
~/smd-rename.sh | ||
|
||
SEE ALSO | ||
smd-pull(1), smd-push(1), smd-config(5) | ||
|
||
AUTHOR | ||
Enrico Tassi <gares@fettunta.org> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
mpull -t | ||
assert $? 0 "failed mpull -t" | ||
echo DEBUG=true >> target/.smd/config.default | ||
|
||
cp -r Mail target/Mail | ||
cd target/Mail/cur | ||
for x in *; do mv $x $x`md5sum $x | cut -d ' ' -f 1`; done | ||
cd ../../.. | ||
|
||
muniform -v | ||
cd target | ||
sh smd-rename.sh | ||
cd .. | ||
|
||
test_eq Mail target/Mail | ||
|