mirror of
https://github.com/FAUSheppy/athq-vm-management
synced 2025-12-06 05:41:35 +01:00
feat: type in backup script
This commit is contained in:
@@ -102,7 +102,7 @@ def createBackupScriptStructure(backupList, baseDomain=""):
|
||||
os.chmod(os.path.join(backupPath, scriptName), 0o700)
|
||||
|
||||
# write filter #
|
||||
filterName = "rsync-filter-{}.txt".format(hostnameBase)
|
||||
filterName = "rsync-filter-{}-.txt".format(hostnameBase)
|
||||
with open(os.path.join(backupPath, filterName), "w") as f:
|
||||
f.write(rsyncFilterAll)
|
||||
|
||||
@@ -113,7 +113,7 @@ def createBackupScriptStructure(backupList, baseDomain=""):
|
||||
( "minimal" , rsyncFilterMinimal )
|
||||
]
|
||||
for filterType, render in alternativeRsyncFilters:
|
||||
filterType = "rsync-filter-{}-{}.txt".format(hostnameBase, filterType)
|
||||
filterName = "rsync-filter-{}-{}.txt".format(hostnameBase, filterType)
|
||||
with open(os.path.join(backupPath, filterName), "w") as f:
|
||||
f.write(render)
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user