fix(hack): symmetrize runtime checks and soften HINT text
Two small issues caught in review: 1. check_containerd probed the socket unconditionally even when service_active had already set found=1, while check_docker short circuited the same path behind 'if \[ $found -eq 0 \]'. The asymmetry was not user visible but violated least surprise for future maintainers. check_containerd now uses the same gated pattern. 2. The HINT block recommended 'sudo rm -rf /var/lib/docker /var/lib/containerd' as a casual follow up, which could destroy data the operator still needs. Replace that line with a warning telling the operator to inspect and reclaim standalone runtime storage manually rather than deleting it blindly. Also drop a no op 'printf' from disk_usage that served no purpose. Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
parent
7b1364e00b
commit
87e206de39
1 changed files with 3 additions and 4 deletions
|
|
@ -60,10 +60,8 @@ disk_usage() {
|
|||
usage=$(du -sh "$path" 2>/dev/null | awk '{print $1}' || true)
|
||||
if [ -n "${usage:-}" ]; then
|
||||
printf ' (%s uses %s)' "$path" "$usage"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
printf ''
|
||||
}
|
||||
|
||||
service_active() {
|
||||
|
|
@ -82,7 +80,7 @@ check_containerd() {
|
|||
if service_active containerd.service; then
|
||||
found=1
|
||||
fi
|
||||
if [ -e "$CONTAINERD_SOCKET" ]; then
|
||||
if [ "$found" -eq 0 ] && [ -e "$CONTAINERD_SOCKET" ]; then
|
||||
found=1
|
||||
fi
|
||||
if [ "$found" -eq 1 ]; then
|
||||
|
|
@ -123,7 +121,8 @@ check_docker
|
|||
if [ "$WARNINGS" -gt 0 ]; then
|
||||
printf '%bHINT:%b cozystack runs its own containerd under k3s. To stop the shadow runtime:\n' "$YELLOW" "$RESET" >&2
|
||||
printf ' sudo systemctl disable --now docker.service containerd.service\n' >&2
|
||||
printf ' sudo rm -rf /var/lib/docker /var/lib/containerd\n' >&2
|
||||
printf 'Inspect and reclaim standalone runtime storage separately — it may contain container data\n' >&2
|
||||
printf 'that the operator still needs; do not delete it blindly.\n' >&2
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue