Skip to content
Permalink
Browse files

Merge pull request #1887 from Myself5/master

v-backup-user: Properly fix userdata backup exclusions
  • Loading branch information...
serghey-rodin committed May 22, 2019
2 parents 7d48d55 + d24f68a commit 58e9615d94482db1297349a83d904eaea799e118
Showing with 9 additions and 5 deletions.
  1. +9 −5 bin/v-backup-user
@@ -460,11 +460,15 @@ if [ "$USER" != '*' ]; then
fi
fargs=()
for xpath in $(echo "$USER" |tr ',' '\n'); do
fargs+=(-not)
fargs+=(-path)
fargs+=("./$xpath*")
echo "$(date "+%F %T") excluding directory $xpath" |\
if [ -d "$xpath" ]; then
fargs+=(--exclude=$xpath/*)
echo "$(date "+%F %T") excluding directory $xpath" |\
tee -a $BACKUP/$user.log
else
echo "$(date "+%F %T") excluding file $xpath" |\
tee -a $BACKUP/$user.log
fargs+=(--exclude=$xpath)
fi
done

IFS=$'\n'
@@ -479,7 +483,7 @@ if [ "$USER" != '*' ]; then
echo -e "$(date "+%F %T") adding $udir" |tee -a $BACKUP/$user.log

# Backup files and dirs
tar -cpf- $udir |gzip -$BACKUP_GZIP - > $tmpdir/user_dir/$udir.tar.gz
tar --anchored -cpf- ${fargs[@]} $udir |gzip -$BACKUP_GZIP - > $tmpdir/user_dir/$udir.tar.gz
fi
done
set +f

0 comments on commit 58e9615

Please sign in to comment.
You can’t perform that action at this time.