From 6af2b20297afb9cca88eb4843997c87eb48a5429 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 26 Mar 2008 09:36:34 +0000 Subject: Split sysctl into Linux and BSD specific files. --- init.d/Makefile.FreeBSD | 6 +++++- init.d/Makefile.Linux | 4 ++++ init.d/Makefile.NetBSD | 6 +++++- init.d/sysctl.BSD.in | 24 ++++++++++++++++++++++++ init.d/sysctl.Linux.in | 18 ++++++++++++++++++ init.d/sysctl.in | 37 ------------------------------------- sh/Makefile.NetBSD | 1 - 7 files changed, 56 insertions(+), 40 deletions(-) create mode 100644 init.d/sysctl.BSD.in create mode 100644 init.d/sysctl.Linux.in delete mode 100644 init.d/sysctl.in diff --git a/init.d/Makefile.FreeBSD b/init.d/Makefile.FreeBSD index cca0e00..8bcb969 100644 --- a/init.d/Makefile.FreeBSD +++ b/init.d/Makefile.FreeBSD @@ -1,7 +1,11 @@ # Generic BSD scripts SRCS+= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \ - rpcbind.in savecore.in sysctl.in syslogd.in + rpcbind.in savecore.in syslogd.in # These are FreeBSD specific SRCS+= adjkerntz.in devd.in dumpon.in ipfw.in mixer.in nscd.in \ powerd.in syscons.in + +.SUFFIXES: .BSD.in +.BSD.in: + sed ${SED_REPLACE} ${SED_EXTRA} $< > $@ diff --git a/init.d/Makefile.Linux b/init.d/Makefile.Linux index f8be1de..653913c 100644 --- a/init.d/Makefile.Linux +++ b/init.d/Makefile.Linux @@ -1,2 +1,6 @@ SRCS+= hwclock.in consolefont.in keymaps.in modules.in mtab.in numlock.in \ procfs.in + +.SUFFIXES: .Linux.in +.Linux.in: + sed ${SED_REPLACE} ${SED_EXTRA} $< > $@ diff --git a/init.d/Makefile.NetBSD b/init.d/Makefile.NetBSD index 90832db..0bf2f65 100644 --- a/init.d/Makefile.NetBSD +++ b/init.d/Makefile.NetBSD @@ -1,6 +1,10 @@ # Generic BSD scripts SRCS+= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \ - rpcbind.in savecore.in sysctl.in syslogd.in + rpcbind.in savecore.in syslogd.in # These are NetBSD specific SRCS+= swap-blk.in ttys.in wscons.in + +.SUFFIXES: .BSD.in +.BSD.in: + sed ${SED_REPLACE} ${SED_EXTRA} $< > $@ diff --git a/init.d/sysctl.BSD.in b/init.d/sysctl.BSD.in new file mode 100644 index 0000000..6131a0b --- /dev/null +++ b/init.d/sysctl.BSD.in @@ -0,0 +1,24 @@ +#!@PREFIX@/sbin/runscript +# Copyright 2007-2008 Roy Marples +# All rights reserved. Released under the 2-clause BSD license. + +depend() +{ + use hostname + before bootmisc logger + keyword noprefix +} + +start() +{ + [ -e /etc/sysctl.conf ] || return 0 + local retval=0 var= comments= + ebegin "Configuring kernel parameters" + while read var comments; do + case "${var}" in + ""|"#"*) continue;; + esac + sysctl -w "${var}" >/dev/null || retval=1 + done < /etc/sysctl.conf + eend ${retval} "Some errors were encountered" +} diff --git a/init.d/sysctl.Linux.in b/init.d/sysctl.Linux.in new file mode 100644 index 0000000..03f48ee --- /dev/null +++ b/init.d/sysctl.Linux.in @@ -0,0 +1,18 @@ +#!@PREFIX@/sbin/runscript +# Copyright 2007-2008 Roy Marples +# All rights reserved. Released under the 2-clause BSD license. + +depend() +{ + use hostname + before bootmisc logger + keyword noprefix +} + +start() +{ + [ -e /etc/sysctl.conf ] || return 0 + ebegin "Configuring kernel parameters" + sysctl -p >/dev/null + eend $? "Some errors were encountered" +} diff --git a/init.d/sysctl.in b/init.d/sysctl.in deleted file mode 100644 index fdaf8ee..0000000 --- a/init.d/sysctl.in +++ /dev/null @@ -1,37 +0,0 @@ -#!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples -# All rights reserved. Released under the 2-clause BSD license. - -depend() -{ - use hostname - before bootmisc logger - keyword noprefix -} - -sysctl_BSD() { - local retval=0 var= comments= - while read var comments; do - case "${var}" in - ""|"#"*) continue;; - esac - sysctl -w "${var}" >/dev/null || retval=1 - done < /etc/sysctl.conf - return ${retval} -} - -sysctl_Linux() { - sysctl -p >/dev/null -} - -start() -{ - [ -e /etc/sysctl.conf ] || return 0 - - ebegin "Configuring kernel parameters" - case "${RC_UNAME}" in - Linux) sysctl_Linux;; - *) sysctl_BSD;; - esac - eend $? "Some errors were encountered" -} diff --git a/sh/Makefile.NetBSD b/sh/Makefile.NetBSD index 5b13c88..f1d9e3b 100644 --- a/sh/Makefile.NetBSD +++ b/sh/Makefile.NetBSD @@ -7,4 +7,3 @@ BIN+= ifwatchd-carrier.sh ifwatchd-nocarrier.sh .SUFFIXES: .BSD.sh.in .BSD.sh.in.sh: sed ${SED_REPLACE} ${SED_EXTRA} $< > $@ - -- cgit v1.2.3