aboutsummaryrefslogtreecommitdiff
path: root/receive-from-kobo
diff options
context:
space:
mode:
Diffstat (limited to '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"