Unverified Commit 53c4fda9 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Improve swap checks

parent d82d1385
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -41,6 +41,12 @@ if has dphys-swapfile; then
	dphys-swapfile swapoff
	dphys-swapfile uninstall
	systemctl disable dphys-swapfile.service
elif [[ -e /etc/rpi/swap.conf ]]; then
	mkdir -p /etc/rpi/swap.conf.d
	tee >/etc/rpi/swap.conf.d/90-disable-swap.conf <<-END_CONF
		[Main]
		Mechanism=none
	END_CONF
else
	swapoff -a
	echo >&2 "Ensure the permanent removal of swap partitions or files"
@@ -73,6 +79,10 @@ tee /etc/sysctl.d/k8s.conf <<-END
END
sysctl --system

if [[ $(swapon --show --noheadings|wc -l) -gt 0 ]]; then
	fatal "Restart needed to disable swap"
fi

if [[ -v INTERFACE ]]; then
	ip -j -4 addr show "$INTERFACE" |
		jq -r '.[].addr_info[] | select(.scope == "global") | .local' |