ugh, gastei muito tempo procurando uma resposta antes de postar esta pergunta, e agora eu acho que a opção --reverse
para encfs
faz o que eu quero. aqui está meu script de backup:
#!/bin/bash
set -e
set -u
CP="/usr/bin/sudo /usr/bin/rsync -aAhHPxX --delete-excluded --del --ignore-errors --rsync-path=\"rsync --fake-super\" $*"
SOURCE='/'
MOUNTPOINT='/tmp/slash'
DEST='backupuser@backuphost:backupdir'
mkdir -p $MOUNTPOINT
mount -t fuse.encfs | grep "^encfs on $MOUNTPOINT type fuse.encfs" || /usr/bin/sudo /usr/bin/encfs --reverse $SOURCE $MOUNTPOINT
#don't cross mount points
EXCLUDE_LIST=$(encfsctl encode $SOURCE '/usr/bin/cut -d\ -f 2 /proc/mounts | /bin/grep -v ^$SOURCE$')
EXCLUDE=''
for EXCLUDE_ITEM in ${EXCLUDE_LIST} ; do
EXCLUDE="${EXCLUDE} --exclude ${EXCLUDE_ITEM}"
done
/usr/bin/rsync -haxHAXPR $SOURCE/.encfs* $DEST/../
#eval for the quotes in the CP command
eval $CP $EXCLUDE $MOUNTPOINT/ $DEST/
e para recuperar um arquivo:
CP='/usr/bin/sudo /usr/bin/rsync -haxHAXPR --no-implied-dirs --rsync-path="rsync --fake-super"';
SOURCE='/';
DEST='backupuser@backuphost:backupdir';
MOUNTPOINT='/tmp/slash';
ENCRYPTED_NAME=$(encfsctl encode $SOURCE $*);
eval $CP $DEST/./$ENCRYPTED_NAME $MOUNTPOINT