Date: Thu, 18 Oct 2001 08:40:09 -0700 (PDT) From: Gordon Tetlow <gordont@gnf.org> To: <arch@freebsd.org>, <hackers@freebsd.org> Subject: New rc.d init script roadmap Message-ID: <Pine.LNX.4.33.0110180824570.30874-200000@smtp.gnf.org>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Alright folks, I finally got off my butt last night and put together a
roadmap for the migration to the new rc.d init scripts that were imported
from NetBSD a long time ago and just sat in the tree.
M1 (Patch included)
Setup infrastructure
Make rcorder compile
Hook rc.subr into the distribution (and mergemaster)
Hook rcorder into the world
Add toggle in rc.conf to switch between rc_ng and current boot scripts
M2
Get FreeBSD to boot with the new boot scripts
Rewrite the /etc/rc.d scripts to work with FreeBSD
M3
Add some FreeBSD specific support into rc.subr
M4
Add true dependency checking to the infrastructure so that starting nfsd
will start mountd and rpcbind
Add support into rc.subr
Add dependencies into rc.d scripts
I'd like a couple of people to take a look at this and then I'll submit a
pr for it if there aren't too many objections. I'm expecting M2 to run
into quite a bikeshed, but hey, I got my nice shiny asbestos back from the
cleaners.
-gordon
[-- Attachment #2 --]
--- etc/Makefile.orig Wed Oct 17 20:04:07 2001
+++ etc/Makefile Wed Oct 17 22:29:38 2001
@@ -13,7 +13,7 @@
motd modems netconfig networks newsyslog.conf \
pam.conf phones printcap profile protocols \
rc rc.atm rc.devfs rc.diskless1 rc.diskless2 rc.firewall rc.firewall6 \
- rc.network rc.network6 rc.pccard rc.serial rc.shutdown \
+ rc.network rc.network6 rc.pccard rc.serial rc.shutdown rc.subr \
rc.syscons rc.sysctl remote rpc security services shells sysctl.conf \
syslog.conf usbd.conf \
etc.${MACHINE_ARCH}/disktab \
--- etc/rc.d/Makefile.orig Wed Oct 17 20:04:00 2001
+++ etc/rc.d/Makefile Wed Oct 17 22:25:26 2001
@@ -1,8 +1,6 @@
# $NetBSD: Makefile,v 1.16 2001/01/14 15:37:22 minoura Exp $
-.include <bsd.own.mk>
-
-FILES= DAEMON LOGIN NETWORK SERVERS accounting amd apmd bootparams \
+BIN= DAEMON LOGIN NETWORK SERVERS accounting amd apmd bootparams \
bootconf.sh ccd cleartmp cron dhclient dhcpd dhcrelay dmesg \
fsck gated inetd ipfilter ipmon ipnat ipsec isdnd kdc ldconfig \
lkm1 lkm2 lkm3 local lpd mopd motd mountall mountcritlocal \
@@ -12,9 +10,12 @@
savecore screenblank sendmail securelevel sshd swap1 swap2 sysdb \
sysctl syslogd timed ttys virecover wscons xdm xfs ypbind \
yppasswdd ypserv
-FILESDIR= /etc/rc.d
-FILESMODE= ${BINMODE}
-NOPROG= noprog
+BINDIR= /etc/rc.d
+NOOBJ=
+
+beforeinstall:
+ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 ${BIN} \
+ ${DESTDIR}${BINDIR}
.include <bsd.prog.mk>
--- etc/defaults/rc.conf.orig Wed Oct 17 20:03:57 2001
+++ etc/defaults/rc.conf Wed Oct 17 22:40:54 2001
@@ -19,6 +19,7 @@
### Important initial Boot-time options ####################
##############################################################
+rc_ng="NO" # Set to YES to enable new-style rc. Experimental.
swapfile="NO" # Set to name of swapfile if aux swapfile desired.
apm_enable="NO" # Set to YES to enable APM BIOS functions (or NO).
apmd_enable="NO" # Run apmd to handle APM event from userland.
--- etc/rc.orig Wed Oct 17 20:04:06 2001
+++ etc/rc Wed Oct 17 22:40:54 2001
@@ -71,6 +71,30 @@
. /etc/rc.conf
fi
+case ${rc_ng} in
+[Yy][Ee][Ss])
+ . /etc/rc.subr
+
+ _rc_conf_loaded=YES
+
+ if [ "$1" = autoboot ]; then
+ autoboot=yes
+ _rc_fast_run=yes # run_rc_command(): do fast booting
+ fi
+
+ files=`rcorder -s nostart /etc/rc.d/*`
+
+ for _rc_elem in $files; do
+ run_rc_script $_rc_elem start
+ done
+
+ exit 0
+ ;;
+*)
+ # fall-through to the old rc scripts
+ ;;
+esac
+
feed_dev_random() {
if [ -f "${1}" -a -r "${1}" -a -s "${1}" ]; then
# echo "Using ${1} as an entropy file"
--- etc/rc.shutdown.orig Wed Oct 17 20:04:07 2001
+++ etc/rc.shutdown Wed Oct 17 22:40:54 2001
@@ -52,6 +52,26 @@
. /etc/rc.conf
fi
+case ${rc_ng} in
+[Yy][Ee][Ss])
+ . /etc/rc.subr
+
+ files=`rcorder -k shutdown /etc/rc.d/*`
+ for i in $files; do # reverse order of files
+ nfiles="$i $nfiles"
+ done
+ files=$nfiles
+
+ for i in $files; do
+ run_rc_script $i stop
+ done
+
+ exit 0
+ ;;
+*)
+ ;;
+esac
+
# Write some entropy so the rebooting /dev/random can reseed
#
case ${entropy_file} in
--- sbin/rcorder/Makefile.orig Sat Jun 16 00:16:14 2001
+++ sbin/rcorder/Makefile Wed Oct 17 21:58:35 2001
@@ -1,4 +1,5 @@
# $NetBSD: Makefile,v 1.1 1999/11/23 05:28:20 mrg Exp $
+SYS!= uname -s
PROG= rcorder
SRCS= ealloc.c hash.c rcorder.c
@@ -8,6 +9,12 @@
DPADD+= ${LIBUTIL}
# XXX hack for make's hash.[ch]
+.if ${SYS} == NetBSD
CPPFLAGS+= -DORDER
+.elif ${SYS} == FreeBSD
+CFLAGS+= -DORDER
+.else
+.error "This is an unsupported system"
+.endif
.include <bsd.prog.mk>
--- sbin/rcorder/rcorder.c.orig Sat Jun 16 00:16:14 2001
+++ sbin/rcorder/rcorder.c Wed Oct 17 22:07:51 2001
@@ -41,7 +41,9 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#if defined(__NetBSD__)
#include <util.h>
+#endif
#include "ealloc.h"
#include "sprite.h"
--- sbin/Makefile.orig Fri Sep 21 10:55:47 2001
+++ sbin/Makefile Wed Oct 17 22:09:42 2001
@@ -64,6 +64,7 @@
ping \
ping6 \
quotacheck \
+ rcorder \
reboot \
restore \
route \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.33.0110180824570.30874-200000>
