source $(dirname $0)/../detect-build-env-vars.sh
+if [ `uname` = FreeBSD ]; then
+ SED=gsed
+else
+ SED=sed
+fi
+
read -r -d '' cm <<'EOF'
# devices
device 0 device0
three=($(echo "$cm" | crushtool -c /dev/fd/0 --test --show-utilization \
--min-x 1 --max-x 1000000 --num-rep 3 | \
- grep "device \(0\|4\)" | sed -e 's/^.*stored : \([0-9]\+\).*$/\1/'))
+ grep "device \(0\|4\)" | $SED -e 's/^.*stored : \([0-9]\+\).*$/\1/'))
if test $(echo "scale=5; (10 - ${three[0]}/${three[1]}) < .75" | bc) = 1; then
echo 3 replicas weights better distributed than they should be. 1>&2
one=($(echo "$cm" | crushtool -c /dev/fd/0 --test --show-utilization \
--min-x 1 --max-x 1000000 --num-rep 1 | \
- grep "device \(0\|4\)" | sed -e 's/^.*stored : \([0-9]\+\).*$/\1/'))
+ grep "device \(0\|4\)" | $SED -e 's/^.*stored : \([0-9]\+\).*$/\1/'))
if test $(echo "scale=5; (10 - ${one[0]}/${one[1]}) > .1 || (10 - ${one[0]}/${one[1]}) < -.1" | bc) = 1; then
echo 1 replica not distributed as they should be. 1>&2