aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2023-01-01 16:03:34 -0300
committerSilvio Rhatto <rhatto@riseup.net>2023-01-01 16:03:34 -0300
commit08283dceeb64eaaf8aafed7913adcbdc1ad22ba1 (patch)
treeb8bd50f05bd919f1fd3d6f165c55903ede2ab33a
parentd2cf9cb06f3ee4d50071b6e56f28a50f4133c166 (diff)
downloadscripts-08283dceeb64eaaf8aafed7913adcbdc1ad22ba1.tar.gz
scripts-08283dceeb64eaaf8aafed7913adcbdc1ad22ba1.tar.bz2
Minor copy-annotations-from-kobo enhancements
-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