diff --git a/kiauh.sh b/kiauh.sh index c0fed70..7863171 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -86,6 +86,7 @@ function kiauh_update_dialog() { } check_euid +check_free_space init_logfile set_globals kiauh_update_dialog diff --git a/scripts/utilities.sh b/scripts/utilities.sh index b3293ff..05d0106 100644 --- a/scripts/utilities.sh +++ b/scripts/utilities.sh @@ -26,6 +26,14 @@ function check_euid() { fi } +function check_free_space() { + local gb_req=5 + if [[ $(df -Pk ${HOME} | sed 1d | grep -v used | awk '{ print $4 "\t" }') -lt $((1048576*$gb_req)) ]]; then + echo -e "${red}Free disk space in ${yellow}${HOME}${red} is less than ${gb_req}GB, abort${white}" + exit 1 + fi +} + #================================================# #============= MESSAGE FORMATTING ===============# #================================================#