Warn when disk space is low before updating in Quattro (#6432)
* Warn when disk space is low before updating * Simplify update free space warning * Stop updates without enough free space * Allow forcing updates with low disk space --------- Co-authored-by: David Heinemeier Hansson <david@hey.com>
This commit is contained in:
co-authored by
David Heinemeier Hansson
parent
2093d1c9c7
commit
bf4aac95ad
@@ -102,6 +102,8 @@ run_update_pipeline() {
|
||||
|
||||
acquire_update_lock
|
||||
|
||||
omarchy-update-requires-free-space
|
||||
|
||||
trap restore_update_inhibitors EXIT
|
||||
trap 'echo ""; echo -e "\033[0;31mSomething went wrong during the update!\n\nPlease review the output above carefully, correct the error, and retry the update.\n\nIf you need assistance, get help from the community at https://omarchy.org/discord\033[0m"' ERR
|
||||
|
||||
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Check free disk space required for an update
|
||||
# omarchy:hidden=true
|
||||
|
||||
set -e
|
||||
|
||||
if [[ ${OMARCHY_UPDATE_FORCE:-0} == "1" ]]; then
|
||||
exit 0
|
||||
elif read -r available_bytes < <(df --output=avail --block-size=1 / 2>/dev/null | tail -n 1) &&
|
||||
[[ $available_bytes =~ ^[0-9]+$ ]] &&
|
||||
(( available_bytes < 10 * 1024 * 1024 * 1024 )); then
|
||||
echo "You need at least 10 GiB free to safely update Omarchy."
|
||||
exit 1
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
Reference in New Issue
Block a user