From 414cf806a7147a6bb86ea0c7f6ac97b11cdabdae Mon Sep 17 00:00:00 2001 From: "D. M. Brownlee" Date: Thu, 30 Mar 2023 13:42:11 -0700 Subject: [PATCH] Update setup-kubetools.sh Current sed line breaks /etc/fstab as it puts the '#' between '/' and "swap". Instead, match the fstype field ("swap" surrounded by spaces) and prepend a '#' to the beginning of the line if it does not already start with one (idempotent ;) ). --- setup-kubetools.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-kubetools.sh b/setup-kubetools.sh index 3a1cb93..3bb4b78 100755 --- a/setup-kubetools.sh +++ b/setup-kubetools.sh @@ -33,7 +33,7 @@ EOF sudo apt-mark hold kubelet kubeadm kubectl swapoff -a - sed -i 's/swap/#swap/' /etc/fstab + sed -r -i 's/^([^#].*[[:space:]]swap[[:space:]].*)$/#\1/' /etc/fstab fi # Set iptables bridging