feat: add free disk space startup check (#331)

This commit is contained in:
Cameron Ryder
2023-06-08 11:45:32 -04:00
parent 7df3dd489f
commit 3099a6c9fb
2 changed files with 9 additions and 0 deletions

View File

@@ -86,6 +86,7 @@ function kiauh_update_dialog() {
}
check_euid
check_free_space
init_logfile
set_globals
kiauh_update_dialog

View File

@@ -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 ===============#
#================================================#