35 lines
585 B
Bash
35 lines
585 B
Bash
|
#!/usr/bin/env bash
|
||
|
. ./sync-config
|
||
|
echo "syncing notes..."
|
||
|
|
||
|
## sync dropbox -> mirror
|
||
|
# memos
|
||
|
$RCLONE sync ${dropbox_src_memos} ${mirror_dest_memos} -v
|
||
|
|
||
|
# assets
|
||
|
$RCLONE sync ${dropbox_src_assets} ${mirror_dest_assets} -v
|
||
|
|
||
|
|
||
|
## sync mirror -> git repo dest
|
||
|
# memos
|
||
|
$RSYNC ${mirror_dest_memos} ${git_repo_dest}
|
||
|
$RSYNC ${mirror_dest_assets} ${git_repo_dest}/assets/
|
||
|
|
||
|
pushd ${git_repo_root}
|
||
|
|
||
|
## git
|
||
|
if [[ `git status --porcelain` ]]; then
|
||
|
# Changes
|
||
|
echo 'changes!'
|
||
|
git add .
|
||
|
git commit -m "sync notes(auto)"
|
||
|
git pull
|
||
|
git push
|
||
|
else
|
||
|
# No changes
|
||
|
:
|
||
|
fi
|
||
|
|
||
|
popd
|
||
|
|