| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
_update_sysctl() { |
| 6 |
# Conditionally apply the updated sysctl configuration: |
| 7 |
# - The init system must not be systemd; if it is then its own |
| 8 |
# file trigger will handle this. |
| 9 |
# - /proc/sys must be available. |
| 10 |
# - We must not be running in a chroot, as we would then wrongly |
| 11 |
# override the outer system. |
| 12 |
# - We must not be running in a container, as many sysctls will |
| 13 |
# not be writable and we don't know how to handle that. |
| 14 |
if ! [ -d /run/systemd/system ] \ |
| 15 |
&& [ -d /proc/sys ] \ |
| 16 |
&& ! ischroot \ |
| 17 |
&& ! grep -qz '^container=' /proc/1/environ; then |
| 18 |
echo 'procps: Applying updated sysctl configuration' |
| 19 |
sysctl -q --system || true |
| 20 |
fi |
| 21 |
} |
| 22 |
|
| 23 |
if [ "$1" = "triggered" ]; then |
| 24 |
shift |
| 25 |
for trigger in "$@"; do |
| 26 |
case "$trigger" in |
| 27 |
/usr/lib/sysctl.d) |
| 28 |
_update_sysctl |
| 29 |
;; |
| 30 |
esac |
| 31 |
done |
| 32 |
exit 0 |
| 33 |
fi |
| 34 |
|
| 35 |
#DEBHELPER# |