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
|
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
|
# 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)
|
num_volumes=$(( (total_size + size - 1) / size ))
|
||||||
size=$(echo "($total_size + $num_volumes - 1) / $num_volumes" | bc)
|
size=$(( (total_size + num_volumes - 1) / num_volumes ))
|
||||||
|
|
||||||
echo "Calculated smart volume size '$size'" >&2
|
echo "Calculated smart volume size '$size'" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
set_volumes() {
|
set_volumes() {
|
||||||
if [[ -n "$size" ]]; then
|
[[ -n "$size" ]] && calc_smart_volumes && volumes="-v${size}m"
|
||||||
calc_smart_volumes && volumes="-v${size}m"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Volumes set to '$volumes'" >&2
|
echo "Volumes set to '$volumes'" >&2
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue