diff options
author | Sebastien Luttringer <seblu@seblu.net> | 2011-08-31 11:32:51 +0200 |
---|---|---|
committer | Sebastien Luttringer <seblu@seblu.net> | 2011-08-31 18:01:25 +0200 |
commit | 5948612fe7191734ccc89570e808659ee2e6b3e3 (patch) | |
tree | 03ca326c69850042a6525144799bf56e6126f7e0 /arch-sysctl | |
parent | 227b71e67d19f73128862d20aac714537c8517df (diff) | |
download | initscripts-5948612fe7191734ccc89570e808659ee2e6b3e3.tar.xz |
Load sysctl config files from sysctl.d
This patch implement loading of sysctl config files as described in
http://0pointer.de/public/systemd-man/sysctl.d.html
This is a very conveniant way of configuring sysctl option for sysadmin
which can drop sysctl config files inside this directory to enable some
feature.
Dropping a file like disableipv6.conf inside this directory will disable ipv6
$ cat disableipv6.conf
net.ipv6.conf.all.disable_ipv6 = 1
There is atm no package which use this functionnality
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
Diffstat (limited to 'arch-sysctl')
-rwxr-xr-x | arch-sysctl | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/arch-sysctl b/arch-sysctl new file mode 100755 index 0000000..4856df6 --- /dev/null +++ b/arch-sysctl @@ -0,0 +1,29 @@ +#!/bin/bash +# +# /usr/lib/initscripts/arch-sysctl +# +# Load sysctl configuration files following +# http://0pointer.de/public/systemd-man/sysctl.d.html +# + +shopt -s nullglob + +declare -a sysctl_d=( + /usr/lib/sysctl.d/*.conf + /etc/sysctl.d/*.conf + /run/sysctl.d/*.conf + /etc/sysctl.conf +) +declare -A fragments + +# files declared later in the sysctl_d array will override earlier +# Example: `/etc/sysctl.d/foo.conf' supersedes `/usr/lib/sysctl.d/foo.conf'. +for path in "${sysctl_d[@]}"; do + [[ -f $path ]] && fragments[${path##*/}]=$path +done + +for path in "${fragments[@]}"; do + sysctl -q -p "$path" +done + +# vim: set ts=2 sw=2 noet: |