From 2e82d7f2141aa048c29ad3d9302280efd2a9d62c Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Sat, 3 Dec 2016 00:24:43 +0000 Subject: [PATCH] Update sysctl-write-value to do conflict checking Adds conflict checking to the sysctl-write-value script to detect settings from multiple elements conflicting. Change-Id: If312d199388036d6f4103e94dca99249cb3bcbaf --- elements/sysctl/bin/sysctl-write-value | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/elements/sysctl/bin/sysctl-write-value b/elements/sysctl/bin/sysctl-write-value index e60f5535..b12297f7 100755 --- a/elements/sysctl/bin/sysctl-write-value +++ b/elements/sysctl/bin/sysctl-write-value @@ -26,7 +26,18 @@ fi FILENAME="/etc/sysctl.d/${NAME}.conf" +if [ -f $FILENAME ]; then + # check to make sure the settings match... otherwise fail + if ! grep -q "^$NAME = $VALUE" $FILENAME; then + echo "Conflicting sysctl.conf setting for $NAME == $VALUE. Found:" + grep "^$NAME" $FILENAME + exit 1 + fi +else + cat > $FILENAME <