summaryrefslogtreecommitdiff
path: root/carddav-to-alpine
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2021-11-13 11:12:11 +0100
committerErich Eckner <git@eckner.net>2021-11-13 11:15:37 +0100
commitd1a4727ba0dedcd32543f266edd826815e073f91 (patch)
tree1678426ced67b86060155d802cea5495ebaf6d70 /carddav-to-alpine
parent1f629475ec584371d573c7f13b5533de17da23bf (diff)
downloadcarddav-alpine-converter-d1a4727ba0dedcd32543f266edd826815e073f91.tar.xz
carddav-to-alpine: sanity check + write addressbook from scratch
Diffstat (limited to 'carddav-to-alpine')
-rwxr-xr-xcarddav-to-alpine13
1 files changed, 8 insertions, 5 deletions
diff --git a/carddav-to-alpine b/carddav-to-alpine
index db8db31..d6310b2 100755
--- a/carddav-to-alpine
+++ b/carddav-to-alpine
@@ -4,7 +4,14 @@
error=0
-touch "${git_dir}"'/uids'
+for file in 'addressbook' 'uids'; do
+ if [ -n $(git -C "${git_dir}" diff -- "${file}") ]; then
+ >&2 printf 'File "%s" was changed relative to git.\n' "${file##*/}"
+ exit 1
+ fi
+ rm -f "${git_dir}"'/'"${file}"
+ touch "${git_dir}"'/'"${file}"
+done
find "${git_dir}" \
-name '.git' \
@@ -42,10 +49,6 @@ find "${git_dir}" \
continue
fi
- sed -i '
- /^'"${uid}"' /d
- ' "${git_dir}"'/uids'
-
printf '%s\t' \
"${_UID}" \
"${_NICKNAME}" \