From 739c65c54cb0e957df5e9b76f93fb02554e5cac3 Mon Sep 17 00:00:00 2001 From: davidovski Date: Wed, 4 May 2022 23:52:30 +0100 Subject: moved everything to new file formatting --- repo/system/openrc/sysctl.initd | 87 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 repo/system/openrc/sysctl.initd (limited to 'repo/system/openrc/sysctl.initd') diff --git a/repo/system/openrc/sysctl.initd b/repo/system/openrc/sysctl.initd new file mode 100644 index 0000000..befdb91 --- /dev/null +++ b/repo/system/openrc/sysctl.initd @@ -0,0 +1,87 @@ +#!/sbin/openrc-run + +depend() +{ + after clock + before bootmisc logger + keyword -prefix -systemd-nspawn -vserver +} + +start() +{ + local quiet retval=0 status + ebegin "Configuring kernel parameters" + + yesno $rc_verbose || quiet=-q + + eindent + + for f in /lib/sysctl.d/*.conf \ + /usr/lib/sysctl.d/*.conf; do + + if [ -f /etc/sysctl.d/"${f##*/}" ]; then + veinfo "Ignoring $f due to /etc/sysctl.d/${f##*/}" + continue + fi + + if [ -f /run/sysctl.d/"${f##*/}" ]; then + veinfo "Ignoring $f due to /run/sysctl.d/${f##*/}" + continue + fi + + if [ -f "$f" ]; then + vebegin "applying $f" + sysctl $quiet -p "$f" + status=$? + if [ $status -gt 0 ]; then + # Don't change retval= since we expect some package/distro provided + # sysctl configurations to break, so just warn when the user wants + # verbose messages + vewarn "Unable to configure kernel parameters from $f" + fi + fi + done + + for f in /etc/sysctl.d/*.conf; do + + if [ -f /run/sysctl.d/"${f##*/}" ]; then + veinfo "Ignoring $f due to /run/sysctl.d/${f##*/}" + continue + fi + + if [ -f "$f" ]; then + vebegin "applying $f" + sysctl $quiet -p "$f" + status=$? + if [ $status -gt 0 ]; then + retval=$(( $retval + $status )) + eerror "Unable to configure kernel parameters from $f" + fi + fi + done + + if [ -f /etc/sysctl.conf ]; then + vebegin "applying /etc/sysctl.conf" + sysctl $quiet -p /etc/sysctl.conf + status=$? + if [ $status -gt 0 ]; then + retval=$(( $retval + $status )) + eerror "Unable to configure kernel parameters from /etc/sysctl.conf" + fi + fi + + for f in /run/sysctl.d/*.conf; do + if [ -f "$f" ]; then + vebegin "applying $f" + sysctl $quiet -p "$f" + status=$? + if [ $status -gt 0 ]; then + retval=$(( $retval + $status )) + eerror "Unable to configure kernel parameters from $f" + fi + fi + done + eoutdent + + eend $retval +} -- cgit v1.2.1