This commit is contained in:
Sebastian
2024-03-24 15:29:29 +01:00
parent 1c20ed878a
commit 09001707be

View File

@@ -55,23 +55,26 @@ for key in $keys; do
directory="$volume_dir/rpc_$key/_data/" directory="$volume_dir/rpc_$key/_data/"
[ -d "$directory" ] && existing_size=$(du -sb "$directory" | awk '{ total += $1 } END { print total }') || existing_size=0 [ -d "$directory" ] && existing_size=$(du -sb "$directory" | awk '{ total += $1 } END { print total }') || existing_size=0
if [ -z "$newest_file" ]; then #echo "$directory: $existing_size"
if [ -z "$newest_file" ]; then
if [[ "$2" = "--print-size-only" && $existing_size -gt 0 ]]; then if [[ "$2" = "--print-size-only" && $existing_size -gt 0 ]]; then
# I only want to have a theoretical file size # I only want to have a theoretical file size
GB=$(echo "$existing_size / 1024 / 1024 / 1024" | bc ) required_space=$existing_size
echo "$GB" #GB=$(echo "$existing_size / 1024 / 1024 / 1024" | bc )
exit 0 #echo "$GB"
#exit 0
else else
echo "Error: No backup found for volume '$volume_name'" echo "Error: No backup found for volume '$volume_name'"
exit 1 exit 1
fi fi
fi else
restore_files+=("$newest_file") restore_files+=("$newest_file")
cleanup_folders+=("$directory") cleanup_folders+=("$directory")
required_space=$(calculate_required_space "$(basename "$newest_file")") required_space=$(calculate_required_space "$(basename "$newest_file")")
fi
#echo "$volume_name: $required_space" #echo "$volume_name: $required_space"
total_space=$(echo "$total_space + $required_space" | bc) total_space=$(echo "$total_space + $required_space" | bc)