feat: type in backup script

This commit is contained in:
Yannik Schmidt
2023-01-14 05:22:00 +01:00
parent b9b1f47be6
commit aadc9efb86
2 changed files with 13 additions and 3 deletions

View File

@@ -4,6 +4,16 @@ set -eu
mkdir -p {{ hostname_base }}
cd {{ hostname_base }}
TYPE=""
if [ -z "$1" ]; then
TYPE=$1
fi
TEST=$(python -c "int('$TYPE' in ['size_changed', 'no_high_data', 'minimal'])^1")
if [ $TEST -ne 0 ]; then
echo Bad Filter Option $1
fi
dest=./
for x in backup-*; do
test -d "$x" || continue
@@ -20,7 +30,7 @@ rsync \
--archive --acls --xattrs --hard-links --sparse --numeric-ids \
--one-file-system \
--link-dest="$dest" \
--filter="merge ../rsync-filter-{{ hostname_base }}.txt" \
--filter="merge ../rsync-filter-{{ hostname_base }}-${TYPE}.txt" \
root@{{ hostname }}:/ \
"$target_tmp"