Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
local path=${2}
# Space needs to passed in MB
- # df returns bytes so we multiple by 1024²
- space=$(( ${space} * 1024 * 1024 ))
+ # df returns bytes so we multiple by 1024
+ space=$(( ${space} * 1024 ))
- if [[ $(df --output=avail ${path} | tail -n 1) -lt ${space} ]]; then
+ log debug $(df --output=avail ${path} | tail -n 1)
+ log debug ${space}
+
+ if [ $(df --output=avail ${path} | tail -n 1) -lt ${space} ]; then
log error "Not enough free space available under ${path}"
log error "Free space is $(df -h -B MB --output=avail ${path} | tail -n 1) but we need at least $(( ${space} / 1024 / 1024 ))MB"
return ${EXIT_ERROR}