diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2024-08-20 20:42:26 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2024-08-20 20:42:26 -0300 |
commit | d1791e72e2e1442033cad2ad7ef1dd183562ddec (patch) | |
tree | 1a6f087ba2d77d6a7f69230da2ec8ba30c5b0f00 /sync-from-kobo | |
download | utils-doc-d1791e72e2e1442033cad2ad7ef1dd183562ddec.tar.gz utils-doc-d1791e72e2e1442033cad2ad7ef1dd183562ddec.tar.bz2 |
Initial import
Diffstat (limited to 'sync-from-kobo')
-rwxr-xr-x | sync-from-kobo | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sync-from-kobo b/sync-from-kobo new file mode 100755 index 0000000..74b89ef --- /dev/null +++ b/sync-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" |