summaryrefslogtreecommitdiff
path: root/localbackupiceweaselprofile
blob: 78a6d6c4f5df659aac1727d5f46e2e44c29aea2b (plain)
  1. #!/bin/sh
  2. set -e
  3. # Based on script by Micah Anderson <micah@riseup.net>
  4. CFGFILE="{CFGFILE:-${HOME}/.backupiceweaselprofile}"
  5. if -f "$CFGFILE"; then
  6. . "$CFGFILE"
  7. fi
  8. MOZDIR="${MOZDIR:-${HOME}/.mozilla/firefox}"
  9. # Change this to match your correct profile
  10. PROFILE="${PROFILE:-8xrm3et5.default}"
  11. exit1() {
  12. response="${1:+Error: }${1:-Internal error!}"
  13. echo >&2 "$response"
  14. exit 1
  15. }
  16. [ -d "${MOZDIR}/${PROFILE}" || exit1 "Profile $PROFILE missing. Perhaps set PROFILE in $CFGFILE"
  17. if test -z "$(mount | grep -F "${MOZDIR}/${PROFILE}" )"; then
  18. mount "${MOZDIR}/${PROFILE}"
  19. fi
  20. if test -f "${MOZDIR}/${PROFILE}/.unpacked"; then
  21. rsync -av --delete --exclude .unpacked "${MOZDIR}/${PROFILE}/" "${MOZDIR}/profile/"
  22. else
  23. rsync -av "${MOZDIR}/profile/" "${MOZDIR}/$PROFILE/"
  24. touch "${MOZDIR}/${PROFILE}/.unpacked"
  25. fi