diff --git a/modules/archive.sh b/modules/archive.sh index 57def63..330bcc9 100755 --- a/modules/archive.sh +++ b/modules/archive.sh @@ -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 }