Files
sysmig/migrations/004-purge-haveged.sh
wan 5d1f641c61 add per-migration status case (read-only drift check), integrate into sysmig status
status convention: print one line, exit 0 OK / 1 DRIFT / 2 unknown (e.g.
needs root). sysmig status now shows [applied ✓/✗/?] per migration and
exits 1 on drift. DB checks fall back to peer auth when non-root.
2026-08-31 16:46:21 +09:00

24 lines
830 B
Bash

#!/usr/bin/env bash
# 004-purge-haveged - Remove entropy daemon (~8MB)
# Kernel 6.12 collects enough entropy on its own; haveged is redundant.
set -euo pipefail
export DEBIAN_FRONTEND=noninteractive
case "${1:-}" in
up) systemctl disable --now haveged.service 2>/dev/null || true
apt-get purge -y haveged >/dev/null
apt-get autoremove --purge -y >/dev/null
echo " haveged stopped + package purged" ;;
status)
if dpkg-query -W -f='${db:Status-Abbrev}' haveged 2>/dev/null | grep -q '^ii'; then
echo "DRIFT haveged is installed"
exit 1
fi
echo "OK haveged not installed" ;;
down) apt-get update -qq
apt-get install -y haveged >/dev/null
systemctl enable --now haveged.service
echo " haveged reinstalled + restarted" ;;
esac