From 13c552c3ece84b0d4e3b8e24eaa6b7196019b957 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 11 Jan 2008 10:55:36 +0000 Subject: Allow OS to define default package locations. --- Makefile | 2 - init.d.misc/Makefile | 28 ++++++++-- init.d.misc/Makefile.FreeBSD | 1 + init.d.misc/Makefile.Linux | 1 + init.d.misc/Makefile.NetBSD | 1 + init.d.misc/avahi-dnsconfd | 35 ------------- init.d.misc/avahi-dnsconfd.in | 35 +++++++++++++ init.d.misc/avahid | 35 ------------- init.d.misc/avahid.in | 35 +++++++++++++ init.d.misc/dbus | 40 -------------- init.d.misc/dbus.in | 40 ++++++++++++++ init.d.misc/dnsmasq | 45 ---------------- init.d.misc/dnsmasq.in | 45 ++++++++++++++++ init.d.misc/hald | 35 ------------- init.d.misc/hald.in | 35 +++++++++++++ init.d.misc/named | 118 ------------------------------------------ init.d.misc/named.in | 118 ++++++++++++++++++++++++++++++++++++++++++ init.d.misc/ntpd | 61 ---------------------- init.d.misc/ntpd.in | 61 ++++++++++++++++++++++ init.d.misc/openvpn | 93 --------------------------------- init.d.misc/openvpn.in | 87 +++++++++++++++++++++++++++++++ init.d.misc/polkitd | 35 ------------- init.d.misc/polkitd.in | 35 +++++++++++++ init.d.misc/sshd | 57 -------------------- init.d.misc/sshd.in | 57 ++++++++++++++++++++ mk/os.mk | 3 ++ mk/scripts.mk | 2 - runlevels/Makefile | 2 - 28 files changed, 578 insertions(+), 564 deletions(-) create mode 100644 init.d.misc/Makefile.FreeBSD create mode 100644 init.d.misc/Makefile.Linux create mode 100644 init.d.misc/Makefile.NetBSD delete mode 100755 init.d.misc/avahi-dnsconfd create mode 100644 init.d.misc/avahi-dnsconfd.in delete mode 100755 init.d.misc/avahid create mode 100644 init.d.misc/avahid.in delete mode 100644 init.d.misc/dbus create mode 100644 init.d.misc/dbus.in delete mode 100644 init.d.misc/dnsmasq create mode 100644 init.d.misc/dnsmasq.in delete mode 100644 init.d.misc/hald create mode 100644 init.d.misc/hald.in delete mode 100644 init.d.misc/named create mode 100644 init.d.misc/named.in delete mode 100644 init.d.misc/ntpd create mode 100644 init.d.misc/ntpd.in delete mode 100755 init.d.misc/openvpn create mode 100644 init.d.misc/openvpn.in delete mode 100644 init.d.misc/polkitd create mode 100644 init.d.misc/polkitd.in delete mode 100644 init.d.misc/sshd create mode 100644 init.d.misc/sshd.in diff --git a/Makefile b/Makefile index 6eb7a463..4d9a818e 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,6 @@ PKG= ${NAME}-${VERSION} SUBDIR= conf.d doc etc init.d man net runlevels sh src -INSTALL?= install - INSTALLAFTER= _installafter MK= mk diff --git a/init.d.misc/Makefile b/init.d.misc/Makefile index c50e550a..693f9134 100644 --- a/init.d.misc/Makefile +++ b/init.d.misc/Makefile @@ -1,5 +1,25 @@ -DIR = /etc/init.d -BIN = $(CONTENTS) +DIR= /etc/init.d +_SRCS!= ls *.in +SRCS?= ${_SRCS}$(shell ls *.in) +OBJS= ${SRCS:.in=} -TOPDIR = .. -include $(TOPDIR)/default.mk +MK= ../mk +include ${MK}/os.mk +include Makefile.${OS} + +VARBASE?= /var + +.SUFFIXES: .in + +all: ${OBJS} + +.in: + sed -e s':@PREFIX@:${PREFIX}:' -e 's:@VARBASE@:${VARBASE}:' $< > $@ + +install: all + for x in ${OBJS}; do \ + ${INSTALL} work/$$x ${DESTDIR}${DIR}; \ + done + +clean: + rm -f ${OBJS} diff --git a/init.d.misc/Makefile.FreeBSD b/init.d.misc/Makefile.FreeBSD new file mode 100644 index 00000000..69d25e05 --- /dev/null +++ b/init.d.misc/Makefile.FreeBSD @@ -0,0 +1 @@ +PREFIX?= /usr/local diff --git a/init.d.misc/Makefile.Linux b/init.d.misc/Makefile.Linux new file mode 100644 index 00000000..8cc7e216 --- /dev/null +++ b/init.d.misc/Makefile.Linux @@ -0,0 +1 @@ +PREFIX=/usr diff --git a/init.d.misc/Makefile.NetBSD b/init.d.misc/Makefile.NetBSD new file mode 100644 index 00000000..4c7dec3f --- /dev/null +++ b/init.d.misc/Makefile.NetBSD @@ -0,0 +1 @@ +PREFIX?= /usr/pkg diff --git a/init.d.misc/avahi-dnsconfd b/init.d.misc/avahi-dnsconfd deleted file mode 100755 index 0db2731c..00000000 --- a/init.d.misc/avahi-dnsconfd +++ /dev/null @@ -1,35 +0,0 @@ -#!/sbin/runscript -# Copyright 2007 Roy Marples -# All rights reserved - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -command=/usr/local/sbin/avahi-dnsconfd -command_args="${avahi_dnsconfd_args} -D" -pidfile=/var/run/avahi-dnsconfd.pid -name="Avahi DNS Configuration Daemon" - -depend() { - use dns - need localmount dbus - after bootmisc -} diff --git a/init.d.misc/avahi-dnsconfd.in b/init.d.misc/avahi-dnsconfd.in new file mode 100644 index 00000000..f857914c --- /dev/null +++ b/init.d.misc/avahi-dnsconfd.in @@ -0,0 +1,35 @@ +#!/sbin/runscript +# Copyright 2007 Roy Marples +# All rights reserved + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +command=@PREFIX@/sbin/avahi-dnsconfd +command_args="${avahi_dnsconfd_args} -D" +pidfile=@VARBASE@/run/avahi-dnsconfd.pid +name="Avahi DNS Configuration Daemon" + +depend() { + use dns + need localmount dbus + after bootmisc +} diff --git a/init.d.misc/avahid b/init.d.misc/avahid deleted file mode 100755 index df1d32d7..00000000 --- a/init.d.misc/avahid +++ /dev/null @@ -1,35 +0,0 @@ -#!/sbin/runscript -# Copyright 2007 Roy Marples -# All rights reserved - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -command=/usr/local/sbin/avahi-daemon -command_args="${avahid_args} -D" -pidfile=/var/run/avahi-daemon/pid -name="Avahi Service Advertisement Daemon" - -depend() { - use dns - need localmount dbus - after bootmisc -} diff --git a/init.d.misc/avahid.in b/init.d.misc/avahid.in new file mode 100644 index 00000000..8444fbd3 --- /dev/null +++ b/init.d.misc/avahid.in @@ -0,0 +1,35 @@ +#!/sbin/runscript +# Copyright 2007 Roy Marples +# All rights reserved + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +command=@PREFIX@%%/sbin/avahi-daemon +command_args="${avahid_args} -D" +pidfile=@VARBASE@/run/avahi-daemon/pid +name="Avahi Service Advertisement Daemon" + +depend() { + use dns + need localmount dbus + after bootmisc +} diff --git a/init.d.misc/dbus b/init.d.misc/dbus deleted file mode 100644 index be707f89..00000000 --- a/init.d.misc/dbus +++ /dev/null @@ -1,40 +0,0 @@ -#!/sbin/runscript -# Copyright 2007 Roy Marples -# All rights reserved - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -command=/usr/local/bin/dbus-daemon -pidfile=/var/run/dbus/dbus.pid -command_args="${dbusd_args---system}" -name="Message Bus Daemon" - -depend() { - need localmount net - after bootmisc -} - -start_pre() { - mkdir -p $(dirname $pidfile) -} - -# vim: set ts=4 : diff --git a/init.d.misc/dbus.in b/init.d.misc/dbus.in new file mode 100644 index 00000000..aa387b35 --- /dev/null +++ b/init.d.misc/dbus.in @@ -0,0 +1,40 @@ +#!/sbin/runscript +# Copyright 2007 Roy Marples +# All rights reserved + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +command=@PREFIX@%%/bin/dbus-daemon +pidfile=@VARBASE@/run/dbus/dbus.pid +command_args="${dbusd_args---system}" +name="Message Bus Daemon" + +depend() { + need localmount net + after bootmisc +} + +start_pre() { + mkdir -p $(dirname $pidfile) +} + +# vim: set ts=4 : diff --git a/init.d.misc/dnsmasq b/init.d.misc/dnsmasq deleted file mode 100644 index 960c5fae..00000000 --- a/init.d.misc/dnsmasq +++ /dev/null @@ -1,45 +0,0 @@ -#!/sbin/runscript -# Copyright 2007 Roy Marples -# All rights reserved - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -command=/usr/local/sbin/dnsmasq -command_args=${dnsmasq_args} -pidfile=/var/run/dnsmasq.pid -required_files=/usr/local/etc/dnsmasq.conf - -extra_started_commands="reload" - -depend() { - provide dns - need localmount net - after bootmisc -} - -reload() { - ebegin "Reloading ${SVCNAME}" - start-stop-daemon --signal SIGHUP --pidfile "${pidfile}" - eend $? -} - -# vim: set ts=4 : diff --git a/init.d.misc/dnsmasq.in b/init.d.misc/dnsmasq.in new file mode 100644 index 00000000..9e88b8fe --- /dev/null +++ b/init.d.misc/dnsmasq.in @@ -0,0 +1,45 @@ +#!/sbin/runscript +# Copyright 2007 Roy Marples +# All rights reserved + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +command=@PREFIX@/sbin/dnsmasq +command_args=${dnsmasq_args} +pidfile=@VARBASE@/run/dnsmasq.pid +required_files=/etc/dnsmasq.conf + +extra_started_commands="reload" + +depend() { + provide dns + need localmount net + after bootmisc +} + +reload() { + ebegin "Reloading ${SVCNAME}" + start-stop-daemon --signal SIGHUP --pidfile "${pidfile}" + eend $? +} + +# vim: set ts=4 : diff --git a/init.d.misc/hald b/init.d.misc/hald deleted file mode 100644 index e6a9b2d2..00000000 --- a/init.d.misc/hald +++ /dev/null @@ -1,35 +0,0 @@ -#!/sbin/runscript -# Copyright 2007 Roy Marples -# All rights reserved - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -command=/usr/local/sbin/hald -pidfile=/var/run/hald/hald.pid -command_args="${hald_args}" -name="Hardware Abstraction Layer Daemon" - -depend() { - need dbus -} - -# vim: set ts=4 : diff --git a/init.d.misc/hald.in b/init.d.misc/hald.in new file mode 100644 index 00000000..70e702df --- /dev/null +++ b/init.d.misc/hald.in @@ -0,0 +1,35 @@ +#!/sbin/runscript +# Copyright 2007 Roy Marples +# All rights reserved + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +command=@PREFIX@/sbin/hald +pidfile=@VARBASE@/run/hald/hald.pid +command_args="${hald_args}" +name="Hardware Abstraction Layer Daemon" + +depend() { + need dbus +} + +# vim: set ts=4 : diff --git a/init.d.misc/named b/init.d.misc/named deleted file mode 100644 index 1b8f1906..00000000 --- a/init.d.misc/named +++ /dev/null @@ -1,118 +0,0 @@ -#!/sbin/runscript -# Copyright 2007 Roy Marples -# All rights reserved - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -command=/usr/sbin/named -command_args=${named_args} -pidfile=/var/run/named/pid -name="Domain Name server" -extra_started_commands="reload" - -namedb=/etc/namedb -named_uid=${named_uid:-bind} - -depend() { - provide dns - need localmount - after bootmisc -} - -start_pre() { - if [ -n "${named_chroot}" ]; then - # Create (or update) the chroot directory structure - if [ -r /etc/mtree/BIND.chroot.dist ]; then - mtree -deU -f /etc/mtree/BIND.chroot.dist -p "${named_chroot}" - else - ewarn "/etc/mtree/BIND.chroot.dist missing," - ewarn "chroot directory structure not updated" - fi - - if [ ! -d "${named_chroot}"/. ]; then - eerror "chroot directory ${named_chroot} missing" - exit 1 - fi - - # Create /etc/namedb symlink - if [ ! -L "${namedb}" ]; then - if [ -d "${namedb}" ]; then - ewarn "named chroot: ${namedb} is a directory!" - elif [ -e "${namedb}" ]; then - ewarn "named chroot: ${namedb} exists!" - else - ln -s "${named_chroot}${namedb}" "${namedb}" - fi - else - # Make sure it points to the right place. - ln -shf "${named_chroot}${namedb}" "${namedb}" - fi - - case "${RC_UNAME}" in - *BSD|DragonFly) - # Mount a devfs in the chroot directory if needed - umount "${named_chroot}"/dev 2>/dev/null - mount -t devfs dev "${named_chroot}"/dev - devfs -m "${named_chroot}"/dev ruleset devfsrules_hide_all - devfs -m "${named_chroot}"/dev rule apply path null unhide - devfs -m "${named_chroot}"/dev rule apply path random unhide - ;; - esac - - # Copy local timezone information if it is not up to date. - if [ -r /etc/localtime ]; then - cmp -s /etc/localtime "${named_chroot}/etc/localtime" || - cp -p /etc/localtime "${named_chroot}/etc/localtime" - fi - - command_args="${command_args} -t ${named_chroot}" - - ln -fs "${named_chroot}${pidfile}" "${pidfile}" - fi - - if [ ! -s "${named_chroot}${namedb}/rndc.conf" ]; then - local confgen="${command%/named}/rndc-confgen -a -b256 -u ${named_uid} \ - -c ${named_chrootdir}/etc/namedb/rndc.key" - if [ -s "${named_chroot}${namedb}/rndc.key" ]; then - local getuser="stat -f%Su" - [ "${RC_UNAME}" = "Linux" ] && getuser="stat -c%U" - case $(${getuser} "${named_chroot}${namedb}"/rndc.key) in - root|"${named_uid}");; - *) ${confgen};; - esac - else - ${confgen} - fi - fi -} - -reload() { - rndc reload -} - -stop_post() { - if [ -n "${named_chroot}" -a -c "${named_chroot}"/dev/null ]; then - umount "${named_chroot}"/dev 2>/dev/null || true - fi -} - -# vim: set ts=4 : diff --git a/init.d.misc/named.in b/init.d.misc/named.in new file mode 100644 index 00000000..ae17b198 --- /dev/null +++ b/init.d.misc/named.in @@ -0,0 +1,118 @@ +#!/sbin/runscript +# Copyright 2007 Roy Marples +# All rights reserved + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +command=/usr/sbin/named +command_args=${named_args} +pidfile=@VARBASE@/run/named/pid +name="Domain Name server" +extra_started_commands="reload" + +namedb=/etc/namedb +named_uid=${named_uid:-bind} + +depend() { + provide dns + need localmount + after bootmisc +} + +start_pre() { + if [ -n "${named_chroot}" ]; then + # Create (or update) the chroot directory structure + if [ -r /etc/mtree/BIND.chroot.dist ]; then + mtree -deU -f /etc/mtree/BIND.chroot.dist -p "${named_chroot}" + else + ewarn "/etc/mtree/BIND.chroot.dist missing," + ewarn "chroot directory structure not updated" + fi + + if [ ! -d "${named_chroot}"/. ]; then + eerror "chroot directory ${named_chroot} missing" + exit 1 + fi + + # Create /etc/namedb symlink + if [ ! -L "${namedb}" ]; then + if [ -d "${namedb}" ]; then + ewarn "named chroot: ${namedb} is a directory!" + elif [ -e "${namedb}" ]; then + ewarn "named chroot: ${namedb} exists!" + else + ln -s "${named_chroot}${namedb}" "${namedb}" + fi + else + # Make sure it points to the right place. + ln -shf "${named_chroot}${namedb}" "${namedb}" + fi + + case "${RC_UNAME}" in + *BSD|DragonFly) + # Mount a devfs in the chroot directory if needed + umount "${named_chroot}"/dev 2>/dev/null + mount -t devfs dev "${named_chroot}"/dev + devfs -m "${named_chroot}"/dev ruleset devfsrules_hide_all + devfs -m "${named_chroot}"/dev rule apply path null unhide + devfs -m "${named_chroot}"/dev rule apply path random unhide + ;; + esac + + # Copy local timezone information if it is not up to date. + if [ -r /etc/localtime ]; then + cmp -s /etc/localtime "${named_chroot}/etc/localtime" || + cp -p /etc/localtime "${named_chroot}/etc/localtime" + fi + + command_args="${command_args} -t ${named_chroot}" + + ln -fs "${named_chroot}${pidfile}" "${pidfile}" + fi + + if [ ! -s "${named_chroot}${namedb}/rndc.conf" ]; then + local confgen="${command%/named}/rndc-confgen -a -b256 -u ${named_uid} \ + -c ${named_chrootdir}/etc/namedb/rndc.key" + if [ -s "${named_chroot}${namedb}/rndc.key" ]; then + local getuser="stat -f%Su" + [ "${RC_UNAME}" = "Linux" ] && getuser="stat -c%U" + case $(${getuser} "${named_chroot}${namedb}"/rndc.key) in + root|"${named_uid}");; + *) ${confgen};; + esac + else + ${confgen} + fi + fi +} + +reload() { + rndc reload +} + +stop_post() { + if [ -n "${named_chroot}" -a -c "${named_chroot}"/dev/null ]; then + umount "${named_chroot}"/dev 2>/dev/null || true + fi +} + +# vim: set ts=4 : diff --git a/init.d.misc/ntpd b/init.d.misc/ntpd deleted file mode 100644 index de1ccb38..00000000 --- a/init.d.misc/ntpd +++ /dev/null @@ -1,61 +0,0 @@ -#!/sbin/runscript -# Copyright 2007 Roy Marples -# All rights reserved - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -ntpd_config=${ntpd_config:-/etc/ntp.conf} -ntpd_drift=${ntpd_drift:-/var/db/ntpd.drift} - -command=/usr/sbin/ntpd -pidfile=/var/run/ntpd.pid -command_args="${ntpd_args} -c ${ntpd_config} -f ${ntpd_drift} -p ${pidfile}" -name="Network Time Protocol Daemon" - -depend() { - use dns - need localmount - after bootmisc ntp-client -} - -start_pre() { - if [ ! -r "${ntpd_config}" ]; then - eerror "${ntpd_config} is not readable" - return 1 - fi - - if [ -n "${ntpd_chroot}" ]; then - case "${RC_UNAME}" in - *BSD|DragonFly) - if [ ! -c "${ntpd_chroot}/dev/clockctl" ]; then - rm -f "${ntpd_chroot}/dev/clockctl" - (cd /dev; /bin/pax -rw -pe clockctl "${ntpd_chroot}/dev") - fi - ;; - esac - ln -fs "${ntpd_chroot}${ntpd_drift}" "${ntpd_drift}" - - command_args="${command_args} -u ntpd:ntpd -i ${ntpd_chroot}" - fi -} - -# vim: set ts=4 : diff --git a/init.d.misc/ntpd.in b/init.d.misc/ntpd.in new file mode 100644 index 00000000..de1ccb38 --- /dev/null +++ b/init.d.misc/ntpd.in @@ -0,0 +1,61 @@ +#!/sbin/runscript +# Copyright 2007 Roy Marples +# All rights reserved + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +ntpd_config=${ntpd_config:-/etc/ntp.conf} +ntpd_drift=${ntpd_drift:-/var/db/ntpd.drift} + +command=/usr/sbin/ntpd +pidfile=/var/run/ntpd.pid +command_args="${ntpd_args} -c ${ntpd_config} -f ${ntpd_drift} -p ${pidfile}" +name="Network Time Protocol Daemon" + +depend() { + use dns + need localmount + after bootmisc ntp-client +} + +start_pre() { + if [ ! -r "${ntpd_config}" ]; then + eerror "${ntpd_config} is not readable" + return 1 + fi + + if [ -n "${ntpd_chroot}" ]; then + case "${RC_UNAME}" in + *BSD|DragonFly) + if [ ! -c "${ntpd_chroot}/dev/clockctl" ]; then + rm -f "${ntpd_chroot}/dev/clockctl" + (cd /dev; /bin/pax -rw -pe clockctl "${ntpd_chroot}/dev") + fi + ;; + esac + ln -fs "${ntpd_chroot}${ntpd_drift}" "${ntpd_drift}" + + command_args="${command_args} -u ntpd:ntpd -i ${ntpd_chroot}" + fi +} + +# vim: set ts=4 : diff --git a/init.d.misc/openvpn b/init.d.misc/openvpn deleted file mode 100755 index 591464c7..00000000 --- a/init.d.misc/openvpn +++ /dev/null @@ -1,93 +0,0 @@ -#!/sbin/runscript -# Copyright 2007 Roy Marples -# All rights reserved - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -if [ -z "${openvpn_dir}" ]; then - if [ -d /usr/local/etc/openvpn ]; then - openvpn_dir=/usr/local/etc/openvpn - else - openvpn_dir=/etc/openvpn - fi -fi - -vpn=${SVCNAME#*.} -name="OpenVPN" -[ "${vpn}" != "openvpn" ] && name="${name} (${vpn})" -command=/usr/sbin/openvpn -[ -x ${command} ] || command=/usr/local/sbin/openvpn - -pidfile="/var/run/${SVCNAME}.pid" -openvpn_config=${openvpn_config:-${openvpn_dir}/${vpn}.conf} -command_args="${openvpn_args} --daemon --config ${openvpn_config} --writepid ${pidfile}" -required_dirs="${openvpn_dir}" -required_files="${openvpn_config}" - -# If we're an openvpn client, then supply a nice default config -# You can find sample up/down scripts in the OpenRC support/openvpn dir -if yesno "${openvpn_client}"; then - openvpn_up=${openvpn_up:-${openvpn_dir}/up.sh} - openvpn_down=${openvpn_down:-${openvpn_dir}/down.sh} - command_args="${command_args} --nobind --up-delay --up-restart --down-pre" - command_args="${command_args} --up ${openvpn_up}" - command_args="${command_args} --down ${openvpn_down}" - required_files="${required_files} ${openvpn_up} ${openvpn_down}" - - in_background_fake="start stop" - start_inactive="YES" -fi - -depend() { - need net - use dns -} - -start_pre() { - # Linux has good dynamic tun/tap creation - if [ "${RC_UNAME}" = "Linux" ]; then - if [ ! -e /dev/net/tun ]; then - if ! modprobe tun; then - eerror "TUN/TAP support is not available in this kernel" - return 1 - fi - fi - if [ -h /dev/net/tun -a -c /dev/misc/net/tun ]; then - ebegin "Detected broken /dev/net/tun symlink, fixing..." - rm -f /dev/net/tun - ln -s /dev/misc/net/tun /dev/net/tun - eend $? - fi - else - # Hammer the modules home by default - sysctl -a | grep -q '\.tun\.' || kldload if_tun - sysctl -a | grep -q '\.tap\.' || kldload if_tap - fi - - # If the config file does not specify the cd option, we do - # But if we specify it, we override the config option which we do not want - if ! grep -q "^[ \t]*cd[ \t].*" "${openvpn_config}"; then - command_args="${command_args} --cd ${openvpn_dir}" - fi -} - -# vim: set ts=4 : diff --git a/init.d.misc/openvpn.in b/init.d.misc/openvpn.in new file mode 100644 index 00000000..017dcf73 --- /dev/null +++ b/init.d.misc/openvpn.in @@ -0,0 +1,87 @@ +#!/sbin/runscript +# Copyright 2007 Roy Marples +# All rights reserved + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +vpn=${SVCNAME#*.} +name="OpenVPN" +[ "${vpn}" != "openvpn" ] && name="${name} (${vpn})" +command=@PREFIX/sbin/openvpn + +pidfile=@VARBASE@/run/"${SVCNAME}".pid +openvpn_dir=${openvpn_dir:-@PREFIX@/etc/openvpn} +openvpn_config=${openvpn_config:-${openvpn_dir}/${vpn}.conf} +command_args="${openvpn_args} --daemon --config ${openvpn_config} --writepid ${pidfile}" +required_dirs="${openvpn_dir}" +required_files="${openvpn_config}" + +# If we're an openvpn client, then supply a nice default config +# You can find sample up/down scripts in the OpenRC support/openvpn dir +if yesno "${openvpn_client}"; then + openvpn_up=${openvpn_up:-${openvpn_dir}/up.sh} + openvpn_down=${openvpn_down:-${openvpn_dir}/down.sh} + command_args="${command_args} --nobind --up-delay --up-restart --down-pre" + command_args="${command_args} --up ${openvpn_up}" + command_args="${command_args} --down ${openvpn_down}" + required_files="${required_files} ${openvpn_up} ${openvpn_down}" + + in_background_fake="start stop" + start_inactive="YES" +fi + +depend() { + need net + use dns +} + +start_pre() { + # Linux has good dynamic tun/tap creation + if [ "${RC_UNAME}" = "Linux" ]; then + if [ ! -e /dev/net/tun ]; then + if ! modprobe tun; then + eerror "TUN/TAP support is not available in this kernel" + return 1 + fi + fi + if [ -h /dev/net/tun -a -c /dev/misc/net/tun ]; then + ebegin "Detected broken /dev/net/tun symlink, fixing..." + rm -f /dev/net/tun + ln -s /dev/misc/net/tun /dev/net/tun + eend $? + fi + else + if type kldload >/dev/null 2>&1; then + # Hammer the modules home by default + sysctl -a | grep -q '\.tun\.' || kldload if_tun + sysctl -a | grep -q '\.tap\.' || kldload if_tap + fi + fi + + # If the config file does not specify the cd option, we do + # But if we specify it, we override the config option which we do not want + if ! grep -q "^[ \t]*cd[ \t].*" "${openvpn_config}"; then + command_args="${command_args} --cd ${openvpn_dir}" + fi +} + +# vim: set ts=4 : diff --git a/init.d.misc/polkitd b/init.d.misc/polkitd deleted file mode 100644 index c1e336e0..00000000 --- a/init.d.misc/polkitd +++ /dev/null @@ -1,35 +0,0 @@ -#!/sbin/runscript -# Copyright 2007 Roy Marples -# All rights reserved - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -command=/usr/local/sbin/polkitd -pidfile=/var/run/polkitd/polkitd.pid -command_args="${polkitd_args}" -name="PolicyKit Daemon" - -depend() { - need dbus -} - -# vim: set ts=4 : diff --git a/init.d.misc/polkitd.in b/init.d.misc/polkitd.in new file mode 100644 index 00000000..0e697f13 --- /dev/null +++ b/init.d.misc/polkitd.in @@ -0,0 +1,35 @@ +#!/sbin/runscript +# Copyright 2007 Roy Marples +# All rights reserved + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +command=@PREFIX@/sbin/polkitd +pidfile=@VARBASE@/run/polkitd/polkitd.pid +command_args="${polkitd_args}" +name="PolicyKit Daemon" + +depend() { + need dbus +} + +# vim: set ts=4 : diff --git a/init.d.misc/sshd b/init.d.misc/sshd deleted file mode 100644 index 4a050617..00000000 --- a/init.d.misc/sshd +++ /dev/null @@ -1,57 +0,0 @@ -#!/sbin/runscript -# Copyright 2007 Roy Marples -# All rights reserved - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -command=/usr/sbin/sshd -command_args=${sshd_args} -pidfile=/var/run/sshd.pid -required_files=/etc/ssh/sshd_config -required_dirs=/var/empty - -depend() { - use logger dns - need net -} - -start_pre() { - if [ ! -e /etc/ssh/ssh_host_key ]; then - ebegin "Generating Hostkey" - ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N '' - eend $? || return 1 - fi - if [ ! -e /etc/ssh/ssh_host_dsa_key ]; then - ebegin "Generating DSA Hostkey" - ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N '' - eend $? || return 1 - fi - if [ ! -e /etc/ssh/ssh_host_rsa_key ]; then - ebegin "Generating RSA Hostkey" - ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' - eend $? || return 1 - fi - - ${command} -t -} - -# vim: set ts=4 : diff --git a/init.d.misc/sshd.in b/init.d.misc/sshd.in new file mode 100644 index 00000000..8d5139bf --- /dev/null +++ b/init.d.misc/sshd.in @@ -0,0 +1,57 @@ +#!/sbin/runscript +# Copyright 2007 Roy Marples +# All rights reserved + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +command=/usr/sbin/sshd +command_args=${sshd_args} +pidfile=@VARBASE@/run/sshd.pid +required_files=/etc/ssh/sshd_config +required_dirs=@VARBASE@/empty + +depend() { + use logger dns + need net +} + +start_pre() { + if [ ! -e /etc/ssh/ssh_host_key ]; then + ebegin "Generating Hostkey" + ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N '' + eend $? || return 1 + fi + if [ ! -e /etc/ssh/ssh_host_dsa_key ]; then + ebegin "Generating DSA Hostkey" + ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N '' + eend $? || return 1 + fi + if [ ! -e /etc/ssh/ssh_host_rsa_key ]; then + ebegin "Generating RSA Hostkey" + ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' + eend $? || return 1 + fi + + ${command} -t +} + +# vim: set ts=4 : diff --git a/mk/os.mk b/mk/os.mk index 2de3bc61..f2499416 100644 --- a/mk/os.mk +++ b/mk/os.mk @@ -29,3 +29,6 @@ LIBDL?= ${_LIBDL}$(shell ${_LIBDL_SH}) _LIBKVM_SH= case `uname -s` in *BSD) echo "-lkvm";; *) echo;; esac _LIBKVM!= ${_LIBKVM_SH} LIBKVM?= ${_LIBKVM}$(shell ${_LIBKVM_SH}) + +# Maye as well define INSTALL here as everything uses us +INSTALL?= install diff --git a/mk/scripts.mk b/mk/scripts.mk index 806a5453..c7254aed 100644 --- a/mk/scripts.mk +++ b/mk/scripts.mk @@ -6,8 +6,6 @@ _CONTENTS_SH= ls -1 | grep -v Makefile | xargs _CONTENTS!= ${_CONTENTS_SH} CONTENTS= ${_CONTENTS}$(shell ${_CONTENTS_SH}) -INSTALL?= install - include ${MK}/os.mk all: diff --git a/runlevels/Makefile b/runlevels/Makefile index 2640d040..e6ca09d4 100644 --- a/runlevels/Makefile +++ b/runlevels/Makefile @@ -11,8 +11,6 @@ include ${MK}/os.mk include Makefile.${OS} include Makefile.${SUBOS} -INSTALL?= install - all: install: -- cgit v1.2.3