fdffa56ff2
Theres a pretty standard workflow for setting a sysctl value which will be applied on image boot which was written by tripleo. Lets move this in tree as other folks (like Octavia) would like to depend on it. Change-Id: I3c266870d417cdba3196f5fa65c4cd634ab13173
33 lines
717 B
Bash
Executable File
33 lines
717 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"
|
|
|
|
cat > $FILENAME <<EOF_CAT
|
|
# $COMMENT
|
|
$NAME = $VALUE
|
|
EOF_CAT
|