From 5223656147df4b7d2e0f49cbc2e0ac2eccb0f1d2 Mon Sep 17 00:00:00 2001 From: robert <> Date: Wed, 6 Jul 2011 18:55:36 +0000 Subject: [PATCH] Add rc.d(8) script for the system daemons that are restartable. From now on rc(8) is going to call these scripts to start them up on boot in the same order than before. In addition the inetd and rwhod variables in rc.conf are deprecated so that inetd_flags and rwhod_flags should be used. The old flags are still going to be used for some time to allow users to switch. There are more rc modifications to come later so let's put this in so we can base more work on this. It is important to mention that you can still keep using rc.local just like the way you did before, and we have no intention to remove that either. I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working on this with me. --- src/etc/Makefile | 11 +- src/etc/rc | 233 ++++++---------------------------------- src/etc/rc.conf | 12 ++- src/etc/rc.d/apmd | 11 ++ src/etc/rc.d/bgpd | 11 ++ src/etc/rc.d/bootparamd | 15 +++ src/etc/rc.d/cron | 9 ++ src/etc/rc.d/dhcpd | 15 +++ src/etc/rc.d/dhcrelay | 11 ++ src/etc/rc.d/dvmrpd | 11 ++ src/etc/rc.d/ftpd | 11 ++ src/etc/rc.d/ftpproxy | 11 ++ src/etc/rc.d/hostapd | 9 ++ src/etc/rc.d/hotplugd | 9 ++ src/etc/rc.d/httpd | 15 +++ src/etc/rc.d/identd | 11 ++ src/etc/rc.d/ifstated | 9 ++ src/etc/rc.d/iked | 17 +++ src/etc/rc.d/inetd | 9 ++ src/etc/rc.d/isakmpd | 17 +++ src/etc/rc.d/ldapd | 9 ++ src/etc/rc.d/ldattach | 15 +++ src/etc/rc.d/ldpd | 11 ++ src/etc/rc.d/lpd | 9 ++ src/etc/rc.d/mopd | 15 +++ src/etc/rc.d/mrouted | 9 ++ src/etc/rc.d/named | 11 ++ src/etc/rc.d/nsd | 9 ++ src/etc/rc.d/ntpd | 11 ++ src/etc/rc.d/rarpd | 15 +++ src/etc/rc.d/rbootd | 9 ++ src/etc/rc.d/rc.subr | 4 +- src/etc/rc.d/relayd | 11 ++ src/etc/rc.d/ripd | 11 ++ src/etc/rc.d/route6d | 9 ++ src/etc/rc.d/rtadvd | 11 ++ src/etc/rc.d/rtsold | 11 ++ src/etc/rc.d/rwhod | 9 ++ src/etc/rc.d/sasyncd | 11 ++ src/etc/rc.d/sendmail | 11 ++ src/etc/rc.d/sensorsd | 9 ++ src/etc/rc.d/smtpd | 9 ++ src/etc/rc.d/snmpd | 11 ++ src/etc/rc.d/sshd | 9 ++ src/etc/rc.d/syslogd | 24 +++++ src/etc/rc.d/timed | 11 ++ src/etc/rc.d/watchdogd | 9 ++ 47 files changed, 543 insertions(+), 207 deletions(-) create mode 100644 src/etc/rc.d/apmd create mode 100644 src/etc/rc.d/bgpd create mode 100644 src/etc/rc.d/bootparamd create mode 100644 src/etc/rc.d/cron create mode 100644 src/etc/rc.d/dhcpd create mode 100644 src/etc/rc.d/dhcrelay create mode 100644 src/etc/rc.d/dvmrpd create mode 100644 src/etc/rc.d/ftpd create mode 100644 src/etc/rc.d/ftpproxy create mode 100644 src/etc/rc.d/hostapd create mode 100644 src/etc/rc.d/hotplugd create mode 100644 src/etc/rc.d/httpd create mode 100644 src/etc/rc.d/identd create mode 100644 src/etc/rc.d/ifstated create mode 100644 src/etc/rc.d/iked create mode 100644 src/etc/rc.d/inetd create mode 100644 src/etc/rc.d/isakmpd create mode 100644 src/etc/rc.d/ldapd create mode 100644 src/etc/rc.d/ldattach create mode 100644 src/etc/rc.d/ldpd create mode 100644 src/etc/rc.d/lpd create mode 100644 src/etc/rc.d/mopd create mode 100644 src/etc/rc.d/mrouted create mode 100644 src/etc/rc.d/named create mode 100644 src/etc/rc.d/nsd create mode 100644 src/etc/rc.d/ntpd create mode 100644 src/etc/rc.d/rarpd create mode 100644 src/etc/rc.d/rbootd create mode 100644 src/etc/rc.d/relayd create mode 100644 src/etc/rc.d/ripd create mode 100644 src/etc/rc.d/route6d create mode 100644 src/etc/rc.d/rtadvd create mode 100644 src/etc/rc.d/rtsold create mode 100644 src/etc/rc.d/rwhod create mode 100644 src/etc/rc.d/sasyncd create mode 100644 src/etc/rc.d/sendmail create mode 100644 src/etc/rc.d/sensorsd create mode 100644 src/etc/rc.d/smtpd create mode 100644 src/etc/rc.d/snmpd create mode 100644 src/etc/rc.d/sshd create mode 100644 src/etc/rc.d/syslogd create mode 100644 src/etc/rc.d/timed create mode 100644 src/etc/rc.d/watchdogd diff --git a/src/etc/Makefile b/src/etc/Makefile index e4d5e738..17fd40c9 100644 --- a/src/etc/Makefile +++ b/src/etc/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.296 2011/07/06 18:32:58 miod Exp $ +# $OpenBSD: Makefile,v 1.297 2011/07/06 18:55:36 robert Exp $ TZDIR= /usr/share/zoneinfo LOCALTIME= Canada/Mountain @@ -30,6 +30,13 @@ BIN1+= wsconsctl.conf # -rw-rw-r-- BIN2= motd +# -r-xr-xr-x +RCDAEMONS= apmd bgpd bootparamd cron dhcpd dhcrelay dvmrpd ftpd ftpproxy \ + hostapd hotplugd httpd identd ifstated iked inetd isakmpd ldapd \ + ldattach ldpd lpd mopd mrouted named nsd ntpd rarpd rbootd relayd \ + ripd route6d rtadvd rtsold rwhod sasyncd sendmail sensorsd smtpd \ + snmpd sshd syslogd timed watchdogd + MISETS= base${OSrev}.tgz comp${OSrev}.tgz \ man${OSrev}.tgz game${OSrev}.tgz etc${OSrev}.tgz @@ -249,6 +256,8 @@ distribution-etc-root-var: distrib-dirs ${DESTDIR}/etc/sudoers cd rc.d; \ ${INSTALL} -c -o root -g wheel -m 644 rc.subr \ + ${DESTDIR}/etc/rc.d && \ + ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \ ${DESTDIR}/etc/rc.d distribution: diff --git a/src/etc/rc b/src/etc/rc index 1f7209f5..569d53f1 100644 --- a/src/etc/rc +++ b/src/etc/rc @@ -1,4 +1,4 @@ -# $OpenBSD: rc,v 1.352 2011/04/22 06:08:14 ajacoutot Exp $ +# $OpenBSD: rc,v 1.353 2011/07/06 18:55:36 robert Exp $ # System startup script run by init on autoboot # or after single-user. @@ -142,6 +142,17 @@ fill_baddynamic() } } +start_daemon() +{ + local _n; + for _n; do + eval _do=\${${_n}_flags} + if [ X"${_do}" != X"NO" ]; then + /etc/rc.d/${_n} start + fi + done +} + # End subroutines stty status '^T' @@ -340,26 +351,9 @@ rm -f /var/spool/uucp/STST/* # save a copy of the boot messages dmesg >/var/run/dmesg.boot -echo 'starting system logger' -rm -f /dev/log -if [ X"${httpd_flags}" != X"-u" ]; then - rm -f /var/www/dev/log - syslogd_flags="${syslogd_flags} -a /var/www/dev/log" -fi -if [ X"${named_flags}" != X"NO" ]; then - rm -f /var/named/dev/log - syslogd_flags="${syslogd_flags} -a /var/named/dev/log" -fi -if [ X"${nsd_flags}" != X"NO" ]; then - rm -f /var/nsd/dev/log - syslogd_flags="${syslogd_flags} -a /var/nsd/dev/log" -fi -if [ -d /var/empty ]; then - rm -f /var/empty/dev/log - mkdir -p -m 0555 /var/empty/dev - syslogd_flags="${syslogd_flags} -a /var/empty/dev/log" -fi -syslogd ${syslogd_flags} +echo -n 'starting system logger: ' +start_daemon syslogd +echo '.' if [ X"${pf}" != X"NO" ]; then ifconfig pflog0 create >/dev/null 2>&1 @@ -381,13 +375,11 @@ if [ X"${named_flags}" != X"NO" ]; then echo failed. fi fi - - echo 'starting named'; named $named_flags fi -if [ X"${nsd_flags}" != X"NO" ]; then - echo 'starting nsd'; nsd $nsd_flags -fi +echo -n 'starting name service daemons:' +start_daemon named nsd +echo '.' if [ ! -f /etc/isakmpd/private/local.key ]; then echo -n "openssl: generating new isakmpd/iked RSA key... " @@ -409,23 +401,9 @@ if [ ! -f /etc/iked/private/local.key ]; then cp /etc/isakmpd/local.pub /etc/iked/local.pub fi -if [ X"${isakmpd_flags}" != X"NO" ]; then - if [ X"${sasyncd_flags}" != X"NO" ]; then - isakmpd_flags="-S ${isakmpd_flags}" - fi - echo 'starting isakmpd'; isakmpd ${isakmpd_flags} -fi - -if [ X"${iked_flags}" != X"NO" ]; then - if [ X"${sasyncd_flags}" != X"NO" ]; then - iked_flags="-S ${iked_flags}" - fi - echo 'starting iked'; iked ${iked_flags} -fi - -if [ X"${sasyncd_flags}" != X"NO" ]; then - echo 'starting sasyncd'; sasyncd ${sasyncd_flags} -fi +echo -n 'starting IPsec daemons:' +start_daemon isakmpd iked sasyncd +echo '.' if [ X"${ipsec}" != X"NO" ]; then if [ -f ${ipsec_rules} ]; then @@ -493,17 +471,8 @@ if [ X"${rdate_flags}" != X"NO" ]; then echo -n ' rdate'; rdate -s ${rdate_flags} fi -if [ X"${timed_flags}" != X"NO" ]; then - echo -n ' timed'; timed $timed_flags -fi - -if [ X"${ldattach_flags}" != X"NO" -a -n "${ldattach_flags}" ]; then - echo -n ' ldattach'; ldattach ${ldattach_flags} -fi +start_daemon timed ldattach ntpd -if [ X"${ntpd_flags}" != X"NO" ]; then - echo -n ' ntpd'; ntpd $ntpd_flags -fi echo '.' mount -a @@ -619,83 +588,23 @@ fi /usr/bin/ssh-keygen -A -echo -n starting network daemons: - -if [ X"${sshd_flags}" != X"NO" ]; then - echo -n ' sshd'; /usr/sbin/sshd ${sshd_flags} -fi - -if [ X"${snmpd_flags}" != X"NO" ]; then - echo -n ' snmpd'; /usr/sbin/snmpd $snmpd_flags -fi - -if [ X"${ldpd_flags}" != X"NO" ]; then - echo -n ' ldpd'; /usr/sbin/ldpd $ldpd_flags -fi - -if [ X"${ripd_flags}" != X"NO" ]; then - echo -n ' ripd'; /usr/sbin/ripd $ripd_flags -fi - -if [ X"${mrouted_flags}" != X"NO" ]; then - echo -n ' mrouted'; mrouted $mrouted_flags -fi - -if [ X"${dvmrpd_flags}" != X"NO" ]; then - echo -n ' dvmrpd'; /usr/sbin/dvmrpd $dvmrpd_flags -fi - -if [ X"${ospfd_flags}" != X"NO" ]; then - echo -n ' ospfd'; /usr/sbin/ospfd $ospfd_flags -fi - -if [ X"${ospf6d_flags}" != X"NO" ]; then - echo -n ' ospf6d'; /usr/sbin/ospf6d $ospf6d_flags -fi - -if [ X"${bgpd_flags}" != X"NO" ]; then - echo -n ' bgpd'; /usr/sbin/bgpd $bgpd_flags -fi - -if [ X"${ifstated_flags}" != X"NO" ]; then - echo -n ' ifstated'; ifstated $ifstated_flags -fi - -if [ X"${relayd_flags}" != X"NO" ]; then - echo -n ' relayd'; /usr/sbin/relayd $relayd_flags -fi - -if [ X"${dhcpd_flags}" != X"NO" -a -f /etc/dhcpd.conf ]; then - touch /var/db/dhcpd.leases - echo -n ' dhcpd'; /usr/sbin/dhcpd ${dhcpd_flags} -fi +echo -n 'starting network daemons:' -if [ X"${dhcrelay_flags}" != X"NO" ]; then - echo -n ' dhcrelay'; /usr/sbin/dhcrelay $dhcrelay_flags -fi +start_daemon sshd snmpd ldpd ripd bgpd ifstated relayd dhcpd \ + dhcrelay mrouted dvmrpd if ifconfig lo0 inet6 >/dev/null 2>&1; then fw=`sysctl -n net.inet6.ip6.forwarding` if [ X"${fw}" = X"0" ]; then - if [ X"${rtsold_flags}" != X"NO" ]; then - echo -n ' rtsold' - /usr/sbin/rtsold ${rtsold_flags} - fi + start_daemon rtsold else - if [ X"${route6d_flags}" != X"NO" ]; then - echo -n ' route6d' - /usr/sbin/route6d ${route6d_flags} - fi - if [ X"${rtadvd_flags}" != X"NO" ]; then - echo -n ' rtadvd' - /usr/sbin/rtadvd ${rtadvd_flags} - fi + start_daemon route6d + start_daemon rtadvd fi fi -if [ X"${hostapd_flags}" != X"NO" ]; then - echo -n ' hostapd'; /usr/sbin/hostapd ${hostapd_flags} -fi +start_daemon hostapd rwhod lpd ldapd sendmail smtpd httpd ftpd \ + ftpproxy identd inetd rarpd bootparamd rbootd mopd if [ X"${bt}" != X"NO" ]; then echo -n ' btd'; /usr/sbin/btd @@ -704,52 +613,6 @@ if [ X"${bt}" != X"NO" ]; then fi fi -if [ X"${rwhod}" = X"YES" ]; then - echo -n ' rwhod'; rwhod -fi - - -if [ X"${lpd_flags}" != X"NO" ]; then - echo -n ' lpd'; lpd ${lpd_flags} -fi - -if [ X"${ldapd_flags}" != X"NO" ]; then - echo -n ' ldapd'; /usr/sbin/ldapd ${ldapd_flags} -fi - -# We call sendmail with a full path so that SIGHUP works. -# Note that /usr/sbin/sendmail may actually call a -# mailer other than sendmail, depending on /etc/mailer.conf. -if [ X"${sendmail_flags}" != X"NO" -a -s /etc/mailer.conf ]; then - echo -n ' sendmail'; ( /usr/sbin/sendmail ${sendmail_flags} >/dev/null 2>&1 & ) -fi - -if [ X"${smtpd_flags}" != X"NO" ]; then - echo -n ' smtpd'; smtpd $smtpd_flags -fi - -if [ X"${httpd_flags}" != X"NO" ]; then - # Clean up left-over httpd locks - rm -f /var/www/logs/{ssl_mutex,httpd.lock,accept.lock}.* - echo -n ' httpd'; /usr/sbin/httpd ${httpd_flags} -fi - -if [ X"${ftpd_flags}" != X"NO" ]; then - echo -n ' ftpd'; /usr/libexec/ftpd ${ftpd_flags} -fi - -if [ X"${ftpproxy_flags}" != X"NO" ]; then - echo -n ' ftp-proxy'; /usr/sbin/ftp-proxy ${ftpproxy_flags} -fi - -if [ X"${identd_flags}" != X"NO" ]; then - echo -n ' identd'; /usr/libexec/identd ${identd_flags} -fi - -if [ X"${inetd}" = X"YES" -a -e /etc/inetd.conf ]; then - echo -n ' inetd'; inetd -fi - if [ X"${spamd_flags}" != X"NO" ]; then if [ X"${spamd_black}" != X"NO" ]; then spamd_flags="${spamd_flags} -b" @@ -762,22 +625,6 @@ if [ X"${spamd_flags}" != X"NO" ]; then fi fi -if [ X"${rarpd_flags}" != X"NO" -a -s /etc/ethers ]; then - echo -n ' rarpd'; rarpd ${rarpd_flags} -fi - -if [ X"${bootparamd_flags}" != X"NO" -a -s /etc/bootparams ]; then - echo -n ' rpc.bootparamd'; rpc.bootparamd ${bootparamd_flags} -fi - -if [ X"${rbootd_flags}" != X"NO" -a -s /etc/rbootd.conf ]; then - echo -n ' rbootd'; rbootd ${rbootd_flags} -fi - -if [ X"${mopd_flags}" != X"NO" -a -d /tftpboot/mop ]; then - echo -n ' mopd'; mopd ${mopd_flags} -fi - echo '.' mixerctl_conf @@ -819,25 +666,9 @@ fi [ -f /etc/rc.local ] && . /etc/rc.local -echo -n starting standard daemons: - -if [ X"${apmd_flags}" != X"NO" -a -x /usr/sbin/apmd ]; then - echo -n ' apmd'; /usr/sbin/apmd ${apmd_flags} -fi - -if [ X"${sensorsd_flags}" != X"NO" ]; then - echo -n ' sensorsd'; /usr/sbin/sensorsd ${sensorsd_flags} -fi - -if [ X"${hotplugd_flags}" != X"NO" -a -x /usr/sbin/hotplugd ]; then - echo -n ' hotplugd'; /usr/sbin/hotplugd ${hotplugd_flags} -fi - -if [ X"${watchdogd_flags}" != X"NO" -a -x /usr/sbin/watchdogd ]; then - echo -n ' watchdogd'; /usr/sbin/watchdogd ${watchdogd_flags} -fi +echo -n 'starting standard daemons:' -echo -n ' cron'; cron +start_daemon apmd sensorsd hotplugd watchdogd cron # disable carp interlock ifconfig -g carp -carpdemote 128 diff --git a/src/etc/rc.conf b/src/etc/rc.conf index f5822571..f95a50e9 100644 --- a/src/etc/rc.conf +++ b/src/etc/rc.conf @@ -1,6 +1,6 @@ #!/bin/sh - # -# $OpenBSD: rc.conf,v 1.141 2011/02/12 11:21:01 ajacoutot Exp $ +# $OpenBSD: rc.conf,v 1.142 2011/07/06 18:55:36 robert Exp $ # set these to "NO" to turn them off. otherwise, they're used as flags ldpd_flags=NO # for normal use: "" @@ -47,6 +47,8 @@ snmpd_flags=NO # for normal use: "" smtpd_flags=NO # for normal use: "" aucat_flags=NO # for normal use: "" ldapd_flags=NO # for normal use: "" +inetd_flags="" # for normal use: "" +rwhod_flags=NO # for normal use: "" # use -u to disable chroot, see httpd(8) httpd_flags=NO # for normal use: "" (or "-DSSL" after reading ssl(8)) @@ -70,7 +72,6 @@ xdm_flags=NO # for normal use: "" wsmoused_flags=NO # for ps/2 or usb mice: "", serial: "-p /dev/cua00" # set the following to "YES" to turn them on -rwhod=NO nfs_server=NO # see sysctl.conf for nfs client configuration lockd=NO amd=NO @@ -78,7 +79,6 @@ pf=YES # Packet filter / NAT ipsec=NO # IPsec bt=NO # Bluetooth portmap=NO # Note: inetd(8) rpc services need portmap too -inetd=YES # almost always needed check_quotas=YES # NO may be desirable in some YP environments accounting=NO # process accounting (using /var/account/acct) @@ -113,4 +113,10 @@ rc_scripts= local_rcconf="/etc/rc.conf.local" +unset inetd_flags rwhod_flags + [ -f ${local_rcconf} ] && . ${local_rcconf} # Do not edit this line + +# backward compatibility for inetd and rwhod +: ${inetd_flags=$([ X"${inetd-YES}" = XYES ] || echo NO)} +: ${rwhod_flags=$([ X"${rwhod-NO}" = XYES ] || echo NO)} diff --git a/src/etc/rc.d/apmd b/src/etc/rc.d/apmd new file mode 100644 index 00000000..455f3a10 --- /dev/null +++ b/src/etc/rc.d/apmd @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: apmd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/apmd" + +. /etc/rc.d/rc.subr + +rc_reload=NO + +rc_cmd $1 diff --git a/src/etc/rc.d/bgpd b/src/etc/rc.d/bgpd new file mode 100644 index 00000000..48a09f3c --- /dev/null +++ b/src/etc/rc.d/bgpd @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: bgpd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/bgpd" + +. /etc/rc.d/rc.subr + +pexp="bgpd: parent.*" + +rc_cmd $1 diff --git a/src/etc/rc.d/bootparamd b/src/etc/rc.d/bootparamd new file mode 100644 index 00000000..e3f45a50 --- /dev/null +++ b/src/etc/rc.d/bootparamd @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $OpenBSD: bootparamd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/rpc.bootparamd" + +. /etc/rc.d/rc.subr + +rc_reload=NO + +rc_pre() { + [ -s /etc/bootparams ] || return 1 +} + +rc_cmd $1 diff --git a/src/etc/rc.d/cron b/src/etc/rc.d/cron new file mode 100644 index 00000000..347d7d07 --- /dev/null +++ b/src/etc/rc.d/cron @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: cron,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/cron" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/dhcpd b/src/etc/rc.d/dhcpd new file mode 100644 index 00000000..c3a94241 --- /dev/null +++ b/src/etc/rc.d/dhcpd @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $OpenBSD: dhcpd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/dhcpd" + +. /etc/rc.d/rc.subr + +rc_pre() { + touch /var/db/dhcpd.leases +} + +rc_reload=NO + +rc_cmd $1 diff --git a/src/etc/rc.d/dhcrelay b/src/etc/rc.d/dhcrelay new file mode 100644 index 00000000..d692b695 --- /dev/null +++ b/src/etc/rc.d/dhcrelay @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: dhcrelay,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/dhcrelay" + +. /etc/rc.d/rc.subr + +rc_reload=NO + +rc_cmd $1 diff --git a/src/etc/rc.d/dvmrpd b/src/etc/rc.d/dvmrpd new file mode 100644 index 00000000..948b2893 --- /dev/null +++ b/src/etc/rc.d/dvmrpd @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: dvmrpd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/dvmrpd" + +. /etc/rc.d/rc.subr + +rc_reload=NO + +rc_cmd $1 diff --git a/src/etc/rc.d/ftpd b/src/etc/rc.d/ftpd new file mode 100644 index 00000000..2ea6bf1a --- /dev/null +++ b/src/etc/rc.d/ftpd @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: ftpd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/libexec/ftpd" + +. /etc/rc.d/rc.subr + +rc_reload=NO + +rc_cmd $1 diff --git a/src/etc/rc.d/ftpproxy b/src/etc/rc.d/ftpproxy new file mode 100644 index 00000000..1dc88975 --- /dev/null +++ b/src/etc/rc.d/ftpproxy @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: ftpproxy,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/ftp-proxy" + +. /etc/rc.d/rc.subr + +rc_reload=NO + +rc_cmd $1 diff --git a/src/etc/rc.d/hostapd b/src/etc/rc.d/hostapd new file mode 100644 index 00000000..0e4d8783 --- /dev/null +++ b/src/etc/rc.d/hostapd @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: hostapd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/hostapd" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/hotplugd b/src/etc/rc.d/hotplugd new file mode 100644 index 00000000..b443e13a --- /dev/null +++ b/src/etc/rc.d/hotplugd @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: hotplugd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/hotplugd" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/httpd b/src/etc/rc.d/httpd new file mode 100644 index 00000000..0dcf1c6a --- /dev/null +++ b/src/etc/rc.d/httpd @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $OpenBSD: httpd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/httpd" + +. /etc/rc.d/rc.subr + +pexp="httpd: parent.*" + +rc_pre() { + rm -f /var/www/logs/{ssl_mutex,httpd.lock,accept.lock}.* +} + +rc_cmd $1 diff --git a/src/etc/rc.d/identd b/src/etc/rc.d/identd new file mode 100644 index 00000000..aa21dfb0 --- /dev/null +++ b/src/etc/rc.d/identd @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: identd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/libexec/identd" + +. /etc/rc.d/rc.subr + +rc_reload=NO + +rc_cmd $1 diff --git a/src/etc/rc.d/ifstated b/src/etc/rc.d/ifstated new file mode 100644 index 00000000..e05607dd --- /dev/null +++ b/src/etc/rc.d/ifstated @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: ifstated,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/ifstated" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/iked b/src/etc/rc.d/iked new file mode 100644 index 00000000..b564c182 --- /dev/null +++ b/src/etc/rc.d/iked @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $OpenBSD: iked,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/sbin/iked" + +. /etc/rc.d/rc.subr + +pexp="iked:.*parent.*" + +rc_pre() { + [ X"${sasyncd_flags}" != X"NO" ] && \ + daemon_flags="-S ${daemon_flags}" + return 0 +} + +rc_cmd $1 diff --git a/src/etc/rc.d/inetd b/src/etc/rc.d/inetd new file mode 100644 index 00000000..d13ea54f --- /dev/null +++ b/src/etc/rc.d/inetd @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: inetd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/inetd" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/isakmpd b/src/etc/rc.d/isakmpd new file mode 100644 index 00000000..33eb2078 --- /dev/null +++ b/src/etc/rc.d/isakmpd @@ -0,0 +1,17 @@ +#!/bin/sh +# +# $OpenBSD: isakmpd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/sbin/isakmpd" + +. /etc/rc.d/rc.subr + +pexp="isakmpd: monitor \[priv\]" + +rc_pre() { + [ X"${sasyncd_flags}" != X"NO" ] && \ + daemon_flags="-S ${daemon_flags}" + return 0 +} + +rc_cmd $1 diff --git a/src/etc/rc.d/ldapd b/src/etc/rc.d/ldapd new file mode 100644 index 00000000..0bf911fe --- /dev/null +++ b/src/etc/rc.d/ldapd @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: ldapd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/ldapd" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/ldattach b/src/etc/rc.d/ldattach new file mode 100644 index 00000000..39d520ae --- /dev/null +++ b/src/etc/rc.d/ldattach @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $OpenBSD: ldattach,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/sbin/ldattach" + +. /etc/rc.d/rc.subr + +rc_reload=NO + +rc_pre() { + [ -n "${ldattach_flags}" ] || return 1 +} + +rc_cmd $1 diff --git a/src/etc/rc.d/ldpd b/src/etc/rc.d/ldpd new file mode 100644 index 00000000..9ea10b42 --- /dev/null +++ b/src/etc/rc.d/ldpd @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: ldpd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/ldpd" + +. /etc/rc.d/rc.subr + +pexp="ldpd: parent.*" + +rc_cmd $1 diff --git a/src/etc/rc.d/lpd b/src/etc/rc.d/lpd new file mode 100644 index 00000000..c80ec954 --- /dev/null +++ b/src/etc/rc.d/lpd @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: lpd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/lpd" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/mopd b/src/etc/rc.d/mopd new file mode 100644 index 00000000..cf46ddae --- /dev/null +++ b/src/etc/rc.d/mopd @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $OpenBSD: mopd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/mopd" + +. /etc/rc.d/rc.subr + +rc_reload=NO + +rc_pre() { + [ -d /tftpboot/mop ] || return 1 +} + +rc_cmd $1 diff --git a/src/etc/rc.d/mrouted b/src/etc/rc.d/mrouted new file mode 100644 index 00000000..fd31f242 --- /dev/null +++ b/src/etc/rc.d/mrouted @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: mrouted,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/mrouted" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/named b/src/etc/rc.d/named new file mode 100644 index 00000000..c7b3cbf2 --- /dev/null +++ b/src/etc/rc.d/named @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: named,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/named" + +. /etc/rc.d/rc.subr + +pexp="named: \[priv\]" + +rc_cmd $1 diff --git a/src/etc/rc.d/nsd b/src/etc/rc.d/nsd new file mode 100644 index 00000000..ecf2f80d --- /dev/null +++ b/src/etc/rc.d/nsd @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: nsd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/nsd" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/ntpd b/src/etc/rc.d/ntpd new file mode 100644 index 00000000..22dd8137 --- /dev/null +++ b/src/etc/rc.d/ntpd @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: ntpd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/ntpd" + +. /etc/rc.d/rc.subr + +pexp="ntpd: \[priv\]" + +rc_cmd $1 diff --git a/src/etc/rc.d/rarpd b/src/etc/rc.d/rarpd new file mode 100644 index 00000000..82a8ac77 --- /dev/null +++ b/src/etc/rc.d/rarpd @@ -0,0 +1,15 @@ +#!/bin/sh +# +# $OpenBSD: rarpd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/rarpd" + +. /etc/rc.d/rc.subr + +rc_reload=NO + +rc_pre() { + [ -s /etc/ethers ] || return 1 +} + +rc_cmd $1 diff --git a/src/etc/rc.d/rbootd b/src/etc/rc.d/rbootd new file mode 100644 index 00000000..9135a368 --- /dev/null +++ b/src/etc/rc.d/rbootd @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: rbootd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/rbootd" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/rc.subr b/src/etc/rc.d/rc.subr index 8f6b33e6..837d9580 100644 --- a/src/etc/rc.d/rc.subr +++ b/src/etc/rc.d/rc.subr @@ -1,4 +1,4 @@ -# $OpenBSD: rc.subr,v 1.39 2011/07/03 16:09:06 schwarze Exp $ +# $OpenBSD: rc.subr,v 1.40 2011/07/06 18:55:36 robert Exp $ # Default functions and variables used by rc.d(8) scripts. @@ -74,7 +74,7 @@ rc_cmd() { rc_do rc_check ;; start) - rc_do rc_check && exit 0 + [ -z "${INRC}" ] && rc_do rc_check && exit 0 while true; do # no real loop, only needed to break if type rc_pre >/dev/null; then rc_do rc_pre || break diff --git a/src/etc/rc.d/relayd b/src/etc/rc.d/relayd new file mode 100644 index 00000000..6c73c12b --- /dev/null +++ b/src/etc/rc.d/relayd @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: relayd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/relayd" + +. /etc/rc.d/rc.subr + +pexp="relayd: parent.*" + +rc_cmd $1 diff --git a/src/etc/rc.d/ripd b/src/etc/rc.d/ripd new file mode 100644 index 00000000..8eec7370 --- /dev/null +++ b/src/etc/rc.d/ripd @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: ripd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/ripd" + +. /etc/rc.d/rc.subr + +pexp="ripd: parent.*" + +rc_cmd $1 diff --git a/src/etc/rc.d/route6d b/src/etc/rc.d/route6d new file mode 100644 index 00000000..1b1824b4 --- /dev/null +++ b/src/etc/rc.d/route6d @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: route6d,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/route6d" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/rtadvd b/src/etc/rc.d/rtadvd new file mode 100644 index 00000000..fc0df45e --- /dev/null +++ b/src/etc/rc.d/rtadvd @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: rtadvd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/rtadvd" + +. /etc/rc.d/rc.subr + +rc_reload=NO + +rc_cmd $1 diff --git a/src/etc/rc.d/rtsold b/src/etc/rc.d/rtsold new file mode 100644 index 00000000..1de730ff --- /dev/null +++ b/src/etc/rc.d/rtsold @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: rtsold,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/rtsold" + +. /etc/rc.d/rc.subr + +rc_reload=NO + +rc_cmd $1 diff --git a/src/etc/rc.d/rwhod b/src/etc/rc.d/rwhod new file mode 100644 index 00000000..b6f246c9 --- /dev/null +++ b/src/etc/rc.d/rwhod @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: rwhod,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/rwhod" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/sasyncd b/src/etc/rc.d/sasyncd new file mode 100644 index 00000000..3a12dc11 --- /dev/null +++ b/src/etc/rc.d/sasyncd @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: sasyncd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/sasyncd" + +. /etc/rc.d/rc.subr + +pexp="sasyncd: \[priv\]" + +rc_cmd $1 diff --git a/src/etc/rc.d/sendmail b/src/etc/rc.d/sendmail new file mode 100644 index 00000000..65450e39 --- /dev/null +++ b/src/etc/rc.d/sendmail @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: sendmail,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/sendmail" + +. /etc/rc.d/rc.subr + +pexp="sendmail: accepting.*" + +rc_cmd $1 diff --git a/src/etc/rc.d/sensorsd b/src/etc/rc.d/sensorsd new file mode 100644 index 00000000..9ac16e22 --- /dev/null +++ b/src/etc/rc.d/sensorsd @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: sensorsd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/sensorsd" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/smtpd b/src/etc/rc.d/smtpd new file mode 100644 index 00000000..122a76d4 --- /dev/null +++ b/src/etc/rc.d/smtpd @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: smtpd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/smtpd" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/snmpd b/src/etc/rc.d/snmpd new file mode 100644 index 00000000..a3648d59 --- /dev/null +++ b/src/etc/rc.d/snmpd @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: snmpd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/snmpd" + +. /etc/rc.d/rc.subr + +pexp="snmpd: parent.*" + +rc_cmd $1 diff --git a/src/etc/rc.d/sshd b/src/etc/rc.d/sshd new file mode 100644 index 00000000..46aef908 --- /dev/null +++ b/src/etc/rc.d/sshd @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: sshd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/sshd" + +. /etc/rc.d/rc.subr + +rc_cmd $1 diff --git a/src/etc/rc.d/syslogd b/src/etc/rc.d/syslogd new file mode 100644 index 00000000..8f82c846 --- /dev/null +++ b/src/etc/rc.d/syslogd @@ -0,0 +1,24 @@ +#!/bin/sh +# +# $OpenBSD: syslogd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/syslogd" + +. /etc/rc.d/rc.subr + +pexp="syslogd: \[priv\]" + +rc_pre() { + [ X"${httpd_flags}" != X"-u" ] && rm -f /var/www/dev/log && \ + daemon_flags="${daemon_flags} -a /var/www/dev/log" + [ X"${named_flags}" != X"NO" ] && rm -f /var/named/dev/log && \ + daemon_flags="${daemon_flags} -a /var/named/dev/log" + [ X"${nsd_flags}" != X"NO" ] && rm -f /var/nsd/dev/log && \ + daemon_flags="${daemon_flags} -a /var/nsd/dev/log" + [ -d /var/empty ] && rm -f /var/empty/dev/log && \ + mkdir -p -m 0555 /var/empty/dev && \ + daemon_flags="${daemon_flags} -a /var/empty/dev/log" + rm -f /dev/log +} + +rc_cmd $1 diff --git a/src/etc/rc.d/timed b/src/etc/rc.d/timed new file mode 100644 index 00000000..b0e7b214 --- /dev/null +++ b/src/etc/rc.d/timed @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $OpenBSD: timed,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/timed" + +. /etc/rc.d/rc.subr + +rc_reload=NO + +rc_cmd $1 diff --git a/src/etc/rc.d/watchdogd b/src/etc/rc.d/watchdogd new file mode 100644 index 00000000..5a432186 --- /dev/null +++ b/src/etc/rc.d/watchdogd @@ -0,0 +1,9 @@ +#!/bin/sh +# +# $OpenBSD: watchdogd,v 1.1 2011/07/06 18:55:36 robert Exp $ + +daemon="/usr/sbin/watchdogd" + +. /etc/rc.d/rc.subr + +rc_cmd $1