Date: Wed, 20 Jun 2001 18:23:20 -0700 From: "David O'Brien" <obrien@freebsd.org> To: arch@freebsd.org Subject: (FWD) Re: import NetBSD rc system Message-ID: <20010620182320.D99923@dragon.nuxi.com>
next in thread | raw e-mail | index | archive | help
Does anyone have any problems with this patch? If not I'd like to commit it. (I might make "rc_new" rc_ng" since everything else we have seems to be named that way) ----- Forwarded message from Gordon Tetlow <gordont@bluemtn.net> ----- From: Gordon Tetlow <gordont@bluemtn.net> Subject: Re: import NetBSD rc system Date: Sun, 17 Jun 2001 21:28:02 -0700 (PDT) To: "David O'Brien" <obrien@FreeBSD.ORG> Cc: "David O'Brien -Hackers" <freebsd-hackers@FreeBSD.ORG> X-X-Sender: <gordont@sdmail0.sd.bmarts.com> List-ID: <freebsd-hackers.FreeBSD.ORG> List-Archive: <http://docs.freebsd.org/mail/> (Web Archive) On Sat, 16 Jun 2001, David O'Brien wrote: > On Sat, Jun 16, 2001 at 07:58:06AM -0700, Gordon Tetlow wrote: > > I like Matt's idea (I think it was Matt) to have a new_rc switch. I'll > > look at adding the code for it and submitting a patch, > > You are going off on a tangent. You are worried about the flag day > before we even have a flag to run up the poll. Actually, this makes the import of the new rc system much easier. I've attached the patch against an older (may 11th) world. It should make it pretty clear. After this, all you need to do is import the rc.subr and the rc.d directory from the NetBSD project. Then to test the new boot system, all you need is rcorder and new_rc switched on in /etc/rc.conf. If you need to get back to the old boot system, just change the new_rc knob to off and you can boot normally. > > > > /etc/rc.subr ported > > > > > > What changes were needed here? > > > > I basically added a function called checkwildno() that is similar to > > checkyesno that returns 1 for NO (plus variants) or '' and returns 0 for > > anything else. This gets rid of alot of case statements in the modules, > > making them simple if's. > > Again, why don't we just concentrate on porting the NetBSD scripts and > not the second system enhancements? I agree. I'm a little further ahead on my local box than where we are on the repo. My big question is, do we want to keep the current boot order/logic or are we going with NetBSDs? Either way is fine by me, although I've tried to keep FreeBSDs system more than NetBSDs. -gordon diff -ur /usr/src/etc/defaults/rc.conf etc/defaults/rc.conf --- /usr/src/etc/defaults/rc.conf Wed May 9 22:30:33 2001 +++ etc/defaults/rc.conf Sat Jun 16 08:39:43 2001 @@ -19,6 +19,7 @@ ### Important initial Boot-time options #################### ############################################################## +new_rc="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. diff -ur /usr/src/etc/rc etc/rc --- /usr/src/etc/rc Fri May 11 12:06:55 2001 +++ etc/rc Sat Jun 16 15:46:27 2001 @@ -52,6 +52,39 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin export HOME PATH +# If there is a global system configuration file, suck it in. +# +if [ -r /etc/defaults/rc.conf ]; then + . /etc/defaults/rc.conf + source_rc_confs +elif [ -r /etc/rc.conf ]; then + . /etc/rc.conf +fi + +case ${new_rc} 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 + # BOOTP diskless boot. We have to run the rc file early in order to # retarget various config files. # @@ -60,15 +93,6 @@ if [ ${dlv:=0} != 0 ]; then . /etc/rc.diskless1 fi -fi - -# If there is a global system configuration file, suck it in. -# -if [ -r /etc/defaults/rc.conf ]; then - . /etc/defaults/rc.conf - source_rc_confs -elif [ -r /etc/rc.conf ]; then - . /etc/rc.conf fi feed_dev_random() { diff -ur /usr/src/etc/rc.shutdown etc/rc.shutdown --- /usr/src/etc/rc.shutdown Sun Dec 17 00:15:57 2000 +++ etc/rc.shutdown Sat Jun 16 15:46:32 2001 @@ -52,6 +52,26 @@ . /etc/rc.conf fi +case ${new_rc} 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 ----- End forwarded message ----- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010620182320.D99923>