#!/bin/bash
# This script requires the MOZILLA_BOOKMARKSFILE environment variable
# be set to the location where you export bookmarks from mozilla.
# Create an empty file with date and time _before_ bookmarks.html is
# exported by the iceweasel command below.
touch bookmarks.html_timestamp
if iceweasel ; then
if [ $MOZILLA_BOOKMARKSFILE -ot bookmarks.html_timestamp ] ; then
echo "You forgot to export the bookmarks file to $MOZILLA_BOOKMARKSFILE. Off with your head!"
exit_code=1
else
# apply_gpl_notice.sh does what it says.
cp $MOZILLA_BOOKMARKSFILE bookmarks.html && ./apply_gpl_notice.sh
exit_code=$?
fi
else
echo "iceweasel failed for some reason"
exit_code=2
fi
rm -f bookmarks.html_timestamp
exit $exit_code