aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2020-05-10 14:04:24 -0300
committerSilvio Rhatto <rhatto@riseup.net>2020-05-10 14:04:24 -0300
commit6e2774f19b6fb5c690fca94b976a16e962502fe8 (patch)
treeff37a35882fa506ef1b34982839feb19073c4dc6
parent25526eae0f7ffebd500e76dc4c8a862a89f47ad8 (diff)
downloadscripts-6e2774f19b6fb5c690fca94b976a16e962502fe8.tar.gz
scripts-6e2774f19b6fb5c690fca94b976a16e962502fe8.tar.bz2
Adds receive-from-kobo
-rwxr-xr-xreceive-from-kobo34
1 files changed, 34 insertions, 0 deletions
diff --git a/receive-from-kobo b/receive-from-kobo
new file mode 100755
index 0000000..74b89ef
--- /dev/null
+++ b/receive-from-kobo
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# A mini-wrapper to sync a kobo folder into a local one.
+#
+
+# Parameters
+BASENAME="`basename $0`"
+BASEFOLDER="$HOME/data/doc"
+COLLECTION="$1"
+
+# Check
+if [ -z "$COLLECTION" ]; then
+ echo "usage: $BASENAME <colletion>"
+ echo "available collections:"
+ echo ""
+ ls $BASEFOLDER
+ exit 1
+fi
+
+# Ensure collection exists
+if [ ! -d "$BASEFOLDER/$COLLECTION" ]; then
+ echo "error: no such collection $COLLECTION at $BASEFOLDER"
+ exit 1
+fi
+
+# Setup origin
+if [ "$COLLECTION" == "clipboard" ]; then
+ ORIGIN="/mnt/onboard/.adds/koreader/clipboard"
+else
+ ORIGIN="/mnt/sd/$COLLECTION"
+fi
+
+# Dispatch
+lftp -c "open sftp://kobo && mirror -L $ORIGIN $BASEFOLDER/$COLLECTION"