Minor code cleanup

This commit is contained in:
PedoDeveloper 2024-11-11 12:38:36 +00:00
parent 92efe6f85b
commit 926df11f34

View file

@ -41,13 +41,14 @@ check_input() {
exit 2
fi
echo "Archiving file/directory '${input_file}' with password '${archive_pwd}'" >&2
echo "Archiving file/directory '${input_file}' with password '${archive_pwd}' and size '$size'" >&2
}
calc_smart_volumes() {
total_size=$(du -s -BM "${input_file}" | grep -oP '^\d+') || return
num_volumes=$(echo "($total_size + $size - 1) / $size" | bc)
size=$(echo "($total_size + $num_volumes - 1) / $num_volumes" | bc)
echo "Calculated smart volume size '$size'" >&2
}
@ -62,6 +63,7 @@ set_volumes() {
generate_name() {
archive="$archive_dir/$(base64 /dev/urandom | tr -dc [:alnum:] | head -c 20).7z"
echo "Generated archive name '$archive'" >&2
}