#!/bin/sh # 40-sysctl.sh — Apply kernel parameters required for K8s networking # Apply all .conf files in sysctl.d for conf in /etc/sysctl.d/*.conf; do [ -f "$conf" ] || continue while IFS='=' read -r key value; do case "$key" in '#'*|'') continue ;; esac # NOTE: do NOT use tr -d '[:space:]' — see 30-kernel-modules.sh for the # rationale. Use explicit whitespace chars so this works under # Ubuntu's busybox-static tr too. key="$(printf '%s' "$key" | tr -d ' \t\r\n')" value="$(printf '%s' "$value" | tr -d ' \t\r\n')" if [ -n "$key" ] && [ -n "$value" ]; then sysctl -w "${key}=${value}" >/dev/null 2>&1 || \ log_warn "Failed to set sysctl: ${key}=${value}" fi done < "$conf" done log_ok "Sysctl settings applied"