Compare commits

..

No commits in common. "000a7a270166a005f09a53a0604aeb91c2362f90" and "a5096a5b622d6e89ab044d32fa25b8c7e96fc0e6" have entirely different histories.

View File

@ -3086,29 +3086,21 @@ check_container_resources() {
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# check_container_storage() # check_container_storage()
# #
# - Checks root (/) partition usage # - Checks /boot partition usage
# - Warns if usage >80% and asks user confirmation before proceeding # - Warns if usage >80% and asks user confirmation before proceeding
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
check_container_storage() { check_container_storage() {
usage=$(df / -P | awk 'NR==2 {print $5}' | tr -d '%') total_size=$(df /boot --output=size | tail -n 1)
local used_size=$(df /boot --output=used | tail -n 1)
if [ -z "$usage" ] || [ "$usage" -lt 0 ]; then usage=$((100 * used_size / total_size))
echo -e "${CROSS}${HOLD}${RD}Error: Failed to check disk usage.${CL}" if ((usage > 80)); then
exit 1
fi
if [ "$usage" -gt 80 ]; then
echo -e "${INFO}${HOLD} ${YWB}Warning: Storage is dangerously low (${usage}%).${CL}" echo -e "${INFO}${HOLD} ${YWB}Warning: Storage is dangerously low (${usage}%).${CL}"
printf "Continue anyway? <y/N> " echo -ne "Continue anyway? <y/N> "
read -r prompt read -r prompt
if [[ ! ${prompt,,} =~ ^(y|yes)$ ]]; then
case "$prompt" in
[yY][eE][sS] | [yY]) ;;
*)
echo -e "${CROSS}${HOLD}${YWB}Exiting based on user input.${CL}" echo -e "${CROSS}${HOLD}${YWB}Exiting based on user input.${CL}"
exit 1 exit 1
;; fi
esac
fi fi
} }