time as we know how to do this properly (see #612128).
#612538).
* We need at least freebsd-utils (>= 8.0-4) on kFreeBSD architectures for
camcontrol, so depend on it.
+ * Tolerate camcontrol failing to read capacity of IDE devices, until such
+ time as we know how to do this properly (see #612128).
-- Colin Watson <cjwatson@debian.org> Wed, 09 Feb 2011 01:04:06 +0000
# for kFreeBSD
camcontrol_size()
{
- local num_sectors sector_size size
+ local num_sectors sector_size size=
- num_sectors="$(camcontrol readcap "$1" -q -s -N)"
- sector_size="$(camcontrol readcap "$1" -q -b)"
- size="$(expr "$num_sectors" \* "$sector_size" / 1000 / 1000)"
+ if num_sectors="$(camcontrol readcap "$1" -q -s -N)"; then
+ sector_size="$(camcontrol readcap "$1" -q -b)"
+ size="$(expr "$num_sectors" \* "$sector_size" / 1000 / 1000)"
+ fi
[ "$size" ] || size='???'
echo "$size"