#!/bin/bash
# /usr/local/bin/syncbookmarks
# http://crystalfaeries.net/posix/bin/syncbookmarks
# celeste:crystalfaery 2016-03-08 11:30:53+00:00
# We manually export in HTML format our bookmarks after adding new ones, and wish to keep them synchronized.
# FireFox (IceWeasel) generates a random text string and appends ".default" as name of preferences directory,
# therefore we use shell wild-card matching presuming there is only one such directory per user per host.
# Starting Up:
echo "`/usr/local/bin/now` ======= $0 ======= $1 =======" && exitval=0 || exitval=$?
# Update Me from My TAILS (ignore errors in case Corsair Survivor is not mounted):
rsync -auvzH $1 /media/`/usr/bin/whoami`/TailsData/bookmarks/bookmarks.html \
~/.mozilla/firefox/*.default/bookmarks.html 2>/dev/null
# Update Me from My Twin:
rsync -auvzH $1 $(/usr/local/bin/my_twin):~/.mozilla/firefox/*.default/bookmarks.html \
~/.mozilla/firefox/*.default/bookmarks.html || exitval=$?
# Update My Twin:
rsync -auvzH $1 ~/.mozilla/firefox/*.default/bookmarks.html \
$(/usr/local/bin/my_twin):~/.mozilla/firefox/*.default/bookmarks.html || exitval=$?
# Update My TAILS (ignore errors in case Corsair Survivor is not mounted):
rsync -auvzH $1 ~/.mozilla/firefox/*.default/bookmarks.html \
/media/`/usr/bin/whoami`/TailsData/bookmarks/bookmarks.html 2>/dev/null
# Pau for Now.
echo "`/usr/local/bin/now` ------- $0 ------- $1 -------" || exitval=$?
exit $exitval
syntax highlighted by Code2HTML, v. 0.9.1