summaryrefslogtreecommitdiff
path: root/aports/openrc/sysctl.initd
diff options
context:
space:
mode:
authorPÁLI Gábor János <pali.gabor@gmail.com>2022-04-10 18:17:21 +0200
committerPÁLI Gábor János <pali.gabor@gmail.com>2022-04-10 23:09:31 +0200
commitbcbf7c6c9fc7d8a96b1d5c4cc9247b85fe3da2ad (patch)
tree46d796182b2249408b0597485462ef1698dc4c13 /aports/openrc/sysctl.initd
parent40d2daea11738408b7bf7b60f14a558ff8c47fb0 (diff)
downloadfreebsd-wifibox-alpine-bcbf7c6c9fc7d8a96b1d5c4cc9247b85fe3da2ad.zip
Move towards custom packages.
Change the build image process in a way that custom-built packages can be utilized. This means a simpler `Makefile` since every modification is implemented on the level of packages. Include the sources for every customized package.
Diffstat (limited to 'aports/openrc/sysctl.initd')
-rw-r--r--aports/openrc/sysctl.initd87
1 files changed, 87 insertions, 0 deletions
diff --git a/aports/openrc/sysctl.initd b/aports/openrc/sysctl.initd
new file mode 100644
index 0000000..befdb91
--- /dev/null
+++ b/aports/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
+}