diskimage-builder/diskimage_builder/elements/sysctl/bin/sysctl-write-value
Ian Wienand bfca36c772 Release 1.25.2
-----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJYV1yqAAoJEBty/58O8cX8hLwIAKP66w6MdPN8PDgUOteui/Sx
 N0UFKJ9yR4GQOAP0NffPLjch5/g0iJLs3eFKOhtGC1LjbDjpVgjX8vW18ib8wBZK
 GemOZPF3uxg8FROrZF1vpoDy/cHgL1YV10hCnwdjN/r9rb8zOuSabqjW+Dennj2n
 fZ0SJfa8Owfudn3YxGuOymVb/wMtEloDmVGBEI1Y+h7osELCCDi3OXmwsA8qMsdl
 cTwbeugBs4PlOVbZUK/JKGuwIHKgPnDYzYu5KpXw77/MdjGT0fo5Tlq5AOBDI2sC
 9JOFEBDli4Ro05VwvI58ADMpvvOax+9EvOhLbB1dRPdZl21Iyb6gOdy2PUbFO0c=
 =aKxq
 -----END PGP SIGNATURE-----

Merge tag '1.25.2' into merge-branch

Release 1.25.2

Change-Id: I698bcf2e82117bd81649cd065a7af5cac85990c7
2017-02-02 11:20:00 +11:00

43 lines
995 B
Bash
Executable file

#!/bin/bash
#
# Copied from tripleo-image-element's sysctl element
#
# Validate and manage setting sysctl settings.
#
# The script is called with name/value pairs which are stored
# in the system default sysctl.d directory. This script performs
# no checking, just writing out the file.
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
NAME=${1:-}
VALUE=${2:-}
# Optional comment used to describe the setting
COMMENT=${3:-"This file was created by diskimage-builder."}
if [ -z "$NAME" -o -z "$VALUE" ]; then
echo "Usage: sysctl-write-value <name> <value> [comment]"
exit 1
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