2 # download vcard contacts into contacts/ and commit them to git
5 export GIT_AUTHOR_NAME="vcard backup"
6 export GIT_AUTHOR_EMAIL="vcard-backup@home.cweiske.de"
7 export GIT_COMMITTER_NAME="vcard backup"
8 export GIT_COMMITTER_EMAIL="vcard-backup@home.cweiske.de"
10 [ -d contacts ] || mkdir contacts
13 [ -d .git ] || git init
14 [ -f .gitignore ] || cp ../.gitignore-contacts .gitignore
16 if [ ! -f vdirsyncer-config ]; then
17 cp ../vdirsyncer-config.example vdirsyncer-config
18 echo "Adjust contacts/vdirsyncer-config first"
22 # commit configuration files if necessary
23 conffiles=".gitignore vdirsyncer-config"
24 metamod=$(git status --porcelain $conffiles)
25 if [ -n "$metamod" ]; then
27 git commit $conffiles -m 'Update configuration'
30 # sync and commit vcards
31 vdirsyncer --config=vdirsyncer-config --verbosity WARNING sync
32 numchanged=$(git status --porcelain | wc -l)
33 if [ $numchanged -eq 0 ]; then
38 ../create-commit-message.sh > tmp-msg
39 git commit --quiet --file=tmp-msg