Last active
December 24, 2019 05:06
-
-
Save ptrm/3fc3365a0f802c768441f86ed4234953 to your computer and use it in GitHub Desktop.
Kobo rclone sync / update script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- .cache | |
- *.sdr/ | |
- .* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# echo 'script disabled! comment the "return" line at the beginning' | |
# return 123 | |
# lack of trailing "/" both here and in parameters below is intentional, | |
# as e.g. Dropbox disallows absolute paths for sandboxed apps. | |
remote_root='book-sync:' | |
local_root='/mnt/onboard' | |
script_logfile='/mnt/onboard/.book-sync.log' | |
sync_status () { | |
fbink -mpr -x 0 -y 0 -S 5 " " | |
fbink -C GRAY8 -t italic=/mnt/onboard/fonts/Baskerville/Baskerville32-Italic.ttf,size=8,top=2 -m "$1" | |
} | |
sync_status "Sync starting in 7 seconds." | |
# first sync the time to avoid filetime-triggered updates | |
date >> "${script_logfile}" | |
echo "Starting book sync, delaying by 7s" >> "${script_logfile}" | |
sleep 7 | |
sync_status "Syncing (ntp query)…" | |
ntpd -q -n -d -p pool.ntp.org >> "${script_logfile}" 2>&1 || return 1 | |
hwclock -u -w >> "${script_logfile}" 2>&1 | |
rclone_params=' | |
--config /.config/rclone/rclone.conf | |
--log-file /mnt/onboard/.rclone.log | |
--filter-from /rclone-filter.txt | |
--update | |
--use-server-modtime | |
-v' | |
sync_status "Syncing (Books)…" | |
rclone copy $rclone_params "${remote_root}"Books "$local_root"/Books | |
rclone copy $rclone_params "$local_root"/Books "${remote_root}"Books | |
sync_status "Syncing (styletweaks)…" | |
rclone copy $rclone_params "$local_root"/.adds/koreader/styletweaks "${remote_root}"styletweaks | |
rclone copy $rclone_params "${remote_root}"styletweaks "$local_root"/.adds/koreader/styletweaks | |
sync_status "Syncing (fonts)…" | |
rclone copy $rclone_params "$local_root"/fonts "${remote_root}"fonts | |
rclone copy $rclone_params "${remote_root}"fonts "$local_root"/fonts | |
sync_status "Syncing (screensaver)…" | |
rclone copy $rclone_params "$local_root"/screensaver "${remote_root}"screensaver | |
rclone copy $rclone_params "${remote_root}"screensaver "$local_root"/screensaver | |
sync_status "Synced." | |
sync | |
sleep 5 | |
sync_status " " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment