LOCKFILE=/var/lock/timeliner-cron.lock
LOGFILE="/var/log/timeliner.log"
-OPMODE=disabled
-LBASE=/backup
-RBASE=/backup
-REMOTE=backup
-DIRS="/bin /etc /home /opt /root"
+# Which directory trees to back up
+DIRS="/boot /etc /home /opt /root"
+
+# Operations mode: disabled, local, remote, mixed, crypted.
+OPMODE="disabled"
+
+# These are used differently in different modes. See descriptions below
+LBASE="/backfs/vault/myhost"
+REMOTE="backup"
+RBASE="/backfs/vault"
+LHIDE=/backfs/.vault
+LOPEN=/backfs/vault
+LPASS="/root/.ssh/backfs.pass"
exec >>$LOGFILE 2>&1
flock -n 9 || exit 0
case "$OPMODE" in
- remote) # Remote-only backup scheme
- timeliner $REMOTE:$RBASE $DIRS
- ;;
local) # Local-only backup scheme
+ # LBASE is the local root for backup timeline
timeliner $LBASE $DIRS
;;
+ remote) # Remote-only backup scheme
+ # REMOTE identifies remote host
+ # RBASE is the remote root for the backup timeline
+ timeliner $REMOTE:$RBASE $DIRS
+ ;;
mixed) # Local backup window with remote store
+ # LBASE is the local root for backup timeline
+ # REMOTE identifies remote host
+ # RBASE is the remote root for the backup timeline
timeliner $LBASE $DIRS && timeliner-backup $REMOTE:$RBASE $LBASE
;;
+ crypted) # Local backup into a gocyptfs mount of an sshfs mount
+ # REMOTE identifies remote host
+ # RBASE is the remote root for the encrypted backup store
+ # LHIDE is the local mountpoint for encrypted backup store
+ # LOPEN is the local mountpoint for the opened backup store
+ # LBASE is the local root for the backup timeline
+ # LPASS is the password file for opening the encrypted backup store
+ sshfs $REMOTE:$RBASE $LHIDE &&
+ gocryptfs -extpass "cat $LPASS" $LHIDE $LOPEN &&
+ timeliner $LBASE $DIRS
+ fusermount -u $LOPEN
+ fusermount -u $LHIDE
+ ;;
esac