Improved archive name generation
This commit is contained in:
parent
755cd36fb6
commit
0c351f42ae
1 changed files with 3 additions and 1 deletions
|
|
@ -49,6 +49,7 @@ check_input() {
|
|||
calc_smart_volumes() {
|
||||
total_size=$(du -s -BM "${input_file}" | grep -oP '^\d+') || return 0
|
||||
|
||||
# If total file size is smaller than volume size, don't pack it into volumes
|
||||
[[ $total_size -lt $size ]] && return 1
|
||||
|
||||
num_volumes=$(echo "($total_size + $size - 1) / $size" | bc)
|
||||
|
|
@ -65,8 +66,9 @@ set_volumes() {
|
|||
echo "Volumes set to '$volumes'" >&2
|
||||
}
|
||||
|
||||
# Generates a random archive name of 20 alphanumeric characters
|
||||
generate_name() {
|
||||
archive="$archive_dir/$(base64 /dev/urandom | tr -dc [:alnum:] | head -c 20).7z"
|
||||
archive="$archive_dir/$(tr -dc [:alnum:] < /dev/urandom | head -c 20).7z"
|
||||
|
||||
echo "Generated archive name '$archive'" >&2
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue