numerous updates
This commit is contained in:
@@ -48,6 +48,16 @@ if [[ -z "$UPDATE_REEXECED" ]]; then
|
||||
exec ~/.local/bin/update
|
||||
fi
|
||||
|
||||
# An upgrade that runs out of disk space part way through can leave the system
|
||||
# half-upgraded. Set UPDATE_FORCE=1 to skip this check.
|
||||
MIN_FREE_GIB=10
|
||||
FREE_KIB="$(df -k --output=avail / | tail -n 1 | tr -d ' ')"
|
||||
if [[ -z "$UPDATE_FORCE" && "$FREE_KIB" =~ ^[0-9]+$ ]] && (( FREE_KIB < MIN_FREE_GIB * 1024 * 1024 )); then
|
||||
echo "Only $(( FREE_KIB / 1024 / 1024 )) GiB free on /; updating needs at least $MIN_FREE_GIB GiB."
|
||||
echo "Free up space (sudo paccache -rk1 clears old cached packages), or run: UPDATE_FORCE=1 update"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ask for the password once, then keep sudo's cached credentials fresh until
|
||||
# update exits, so long-running hooks don't stop for a password again.
|
||||
sudo -v || exit 1
|
||||
|
||||
Reference in New Issue
Block a user