#!/bin/bash

cd $HOME
mkdir -p backup/spool 2>/dev/null
crontab -l >backup/crontab
cd $(perl -e 'require "lib/fex.ph"; print $spooldir||"spool"')
test "$(echo *@*)" = "*@*" && exit 1

if [ -t 0 ]; then
  rsync="rsync -vaRH"
  echo "backup $PWD/ --> $HOME/backup/spool/"
else
  rsync="rsync -aRH"
fi

$rsync --delete --delete-excluded \
	--exclude="*/*@*.*" \
        --exclude="*/SHARE/*/archives" \
        --exclude="*/DOX" \
        --include="*/DOX/*/.fexdox" \
	* $HOME/backup/spool/
