]> git.ipfire.org Git - people/jschlag/ipfire-3.x-image.git/commitdiff
Fix check for available space
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Sun, 18 Nov 2018 17:31:14 +0000 (17:31 +0000)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Sun, 18 Nov 2018 17:31:14 +0000 (17:31 +0000)
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
generate_image.sh

index 379e995061fb21c229e9fc0c448c3a453f722990..1eb1a649646244c71345dd1008177ec9cbca68be 100755 (executable)
@@ -234,10 +234,13 @@ check_for_free_space() {
                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}