aboutsummaryrefslogtreecommitdiff
path: root/copy-annotations-from-kobo
diff options
context:
space:
mode:
Diffstat (limited to 'copy-annotations-from-kobo')
-rwxr-xr-xcopy-annotations-from-kobo9
1 files changed, 9 insertions, 0 deletions
diff --git a/copy-annotations-from-kobo b/copy-annotations-from-kobo
index 40ad9e8..271328f 100755
--- a/copy-annotations-from-kobo
+++ b/copy-annotations-from-kobo
@@ -34,9 +34,18 @@ show --search "$PATTERN" | while read item; do
extension="$(echo $item | sed -e "s|$basename.||")"
sdr="$basename.sdr"
+ # Make sure that the annotation file exists
mkdir -p "$BASEFOLDER/$sdr"
touch "$BASEFOLDER/$sdr/metadata.$extension.lua"
+
+ # Make sure it's not locked by git annex
+ git annex unlock "$BASEFOLDER/$sdr/metadata.$extension.lua"
+
+ # Update
silentSsh kobo >"$BASEFOLDER/$sdr/metadata.$extension.lua" <<EOF
cat "$REMOTE_BASE/$sdr/metadata.$extension.lua"
EOF
+
+ # Stage
+ git add "$REMOTE_BASE/$sdr/metadata.$extension.lua"
done