Skip to content

Commit 4aff6e2

Browse files
committed
move again
1 parent 0b834f0 commit 4aff6e2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

constructor/header.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -390,16 +390,18 @@ elif [ "$FORCE" = "1" ] && [ -e "$PREFIX" ]; then
390390
fi
391391

392392
total_installation_size_kb="__TOTAL_INSTALLATION_SIZE_KB__"
393+
total_installation_size_mb="$(( total_installation_size_kb / 1024 ))"
394+
if ! mkdir -p "$PREFIX"; then
395+
printf "ERROR: Could not create directory: '%s'.\\n" "$PREFIX" >&2
396+
printf "Check permissions and available disk space (%s MB needed).\\n" "$total_installation_size_mb" >&2
397+
exit 1
398+
fi
399+
393400
free_disk_space_kb="$(df -Pk "$PREFIX" | tail -n 1 | awk '{print $4}')"
394401
free_disk_space_kb_with_buffer="$((free_disk_space_kb - 50 * 1024))" # add 50MB of buffer
395402
if [ "$free_disk_space_kb_with_buffer" -lt "$total_installation_size_kb" ]; then
396403
printf "ERROR: Not enough free disk space. Only %s MB are available, but %s MB are required (leaving a 50 MB buffer).\\n" \
397-
"$((free_disk_space_kb_with_buffer / 1024))" "$((total_installation_size_kb / 1024))" >&2
398-
exit 1
399-
fi
400-
401-
if ! mkdir -p "$PREFIX"; then
402-
printf "ERROR: Could not create directory: '%s'\\n" "$PREFIX" >&2
404+
"$((free_disk_space_kb_with_buffer / 1024))" "$total_installation_size_mb" >&2
403405
exit 1
404406
fi
405407

0 commit comments

Comments
 (0)