Minor code cleanup
This commit is contained in:
parent
92efe6f85b
commit
926df11f34
1 changed files with 3 additions and 1 deletions
|
|
@ -41,13 +41,14 @@ check_input() {
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
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() {
|
calc_smart_volumes() {
|
||||||
total_size=$(du -s -BM "${input_file}" | grep -oP '^\d+') || return
|
total_size=$(du -s -BM "${input_file}" | grep -oP '^\d+') || return
|
||||||
num_volumes=$(echo "($total_size + $size - 1) / $size" | bc)
|
num_volumes=$(echo "($total_size + $size - 1) / $size" | bc)
|
||||||
size=$(echo "($total_size + $num_volumes - 1) / $num_volumes" | bc)
|
size=$(echo "($total_size + $num_volumes - 1) / $num_volumes" | bc)
|
||||||
|
|
||||||
echo "Calculated smart volume size '$size'" >&2
|
echo "Calculated smart volume size '$size'" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,6 +63,7 @@ set_volumes() {
|
||||||
|
|
||||||
generate_name() {
|
generate_name() {
|
||||||
archive="$archive_dir/$(base64 /dev/urandom | tr -dc [:alnum:] | head -c 20).7z"
|
archive="$archive_dir/$(base64 /dev/urandom | tr -dc [:alnum:] | head -c 20).7z"
|
||||||
|
|
||||||
echo "Generated archive name '$archive'" >&2
|
echo "Generated archive name '$archive'" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue