Removed use of bc
This commit is contained in:
parent
194b6b672d
commit
e7f2320b82
1 changed files with 4 additions and 6 deletions
|
|
@ -44,18 +44,16 @@ 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
|
||||
(( total_size < size )) && return 1
|
||||
|
||||
num_volumes=$(echo "($total_size + $size - 1) / $size" | bc)
|
||||
size=$(echo "($total_size + $num_volumes - 1) / $num_volumes" | bc)
|
||||
num_volumes=$(( (total_size + size - 1) / size ))
|
||||
size=$(( (total_size + num_volumes - 1) / num_volumes ))
|
||||
|
||||
echo "Calculated smart volume size '$size'" >&2
|
||||
}
|
||||
|
||||
set_volumes() {
|
||||
if [[ -n "$size" ]]; then
|
||||
calc_smart_volumes && volumes="-v${size}m"
|
||||
fi
|
||||
[[ -n "$size" ]] && calc_smart_volumes && volumes="-v${size}m"
|
||||
|
||||
echo "Volumes set to '$volumes'" >&2
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue