From ed105593deb17b9b584786bc1399e088ec64d0e3 Mon Sep 17 00:00:00 2001 From: Sven Pieper <101557437+svenpieper@users.noreply.github.com> Date: Sun, 1 Sep 2024 11:46:25 +0200 Subject: [PATCH] Fix disk space check in autodesk_fusion_installer_x86-64.sh --- files/setup/autodesk_fusion_installer_x86-64.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/files/setup/autodesk_fusion_installer_x86-64.sh b/files/setup/autodesk_fusion_installer_x86-64.sh index 689d6b5..7b12b1c 100755 --- a/files/setup/autodesk_fusion_installer_x86-64.sh +++ b/files/setup/autodesk_fusion_installer_x86-64.sh @@ -535,10 +535,23 @@ function check_gpu_vram { ############################################################################################################################################################################## function check_disk_space { - # Get the free disk memory size in GB + # Get the free disk memory size in GB or MB GET_DISK_SPACE=$(df -h $SELECTED_DIRECTORY | awk '{print $4}' | tail -1) echo -e "$(gettext "${GREEN}The free disk memory size is: $GET_DISK_SPACE${NOCOLOR}")" - if [[ $GET_DISK_SPACE > 10G ]]; then # Check if the selected disk memory is greater than 10GB + + # Convert the size to a number without the unit + DISK_SPACE_NUM=${GET_DISK_SPACE%?} + + # Convert to gigabytes if necessary + if [[ $GET_DISK_SPACE == *G ]]; then + DISK_SPACE_GB=$DISK_SPACE_NUM + elif [[ $GET_DISK_SPACE == *M ]]; then + DISK_SPACE_GB=$(echo "scale=2; $DISK_SPACE_NUM / 1024" | bc) + else + DISK_SPACE_GB=0 + fi + + if (( $(echo "$DISK_SPACE_GB > 10" | bc -l) )); then echo -e "$(gettext "${GREEN}The free disk memory size is greater than 10GB.${NOCOLOR}")" else echo -e "$(gettext "${YELLOW}There is not enough disk free memory to continue installing Fusion on your system!${NOCOLOR}")"