Skip to content

Commit

Permalink
pdist-bootcheck: Don't loop when system disk is full
Browse files Browse the repository at this point in the history
This script uses a file `/var/run/updatecheck.reboot-triggered` to
prevent boot loops on pdist failures when pdist+reboot is required.
However, when the system disk is full, the creation of that file might
fail.

Check for reasonable free space before attempting pdist and create the
flag file before pdist is started.
  • Loading branch information
donald committed Jan 15, 2024
1 parent 6cab7a5 commit 178e3ed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pdist/pdist-bootcheck
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,15 @@ elif [ "$need_pdist_and_reboot" ]; then
rm /var/run/updatecheck.reboot-triggered
exit 1
fi
if (( $(stat -f -c %f /) * $(stat -f -c %s /) /1024/1024/1024 < 10)); then
echo "Update and reboot required but prevented because of insufficient free disk space (<10G)"
exit 1
fi
echo "Update and reboot required"
touch /var/run/updatecheck.reboot-triggered
sync /
while true; do sleep 5; echo "System update in progress. Please be patient..."; done &
netcat $(distmaster) 237
mxgrub default
touch /var/run/updatecheck.reboot-triggered
systemctl start reboot.target --job-mode=replace-irreversibly
fi

0 comments on commit 178e3ed

Please sign in to comment.