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
This commit is contained in:
Michael Johnson 2016-12-03 00:24:43 +00:00
parent fc7b7cf46d
commit 2e82d7f214

View File

@ -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 <<EOF_CAT
# $COMMENT
$NAME = $VALUE
EOF_CAT
fi