From owner-freebsd-hackers Thu Aug 26 21:20:38 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from dt011n65.san.rr.com (dt010nb9.san.rr.com [204.210.12.185]) by hub.freebsd.org (Postfix) with ESMTP id B42E014F64 for ; Thu, 26 Aug 1999 21:20:33 -0700 (PDT) (envelope-from Doug@gorean.org) Received: from gorean.org (master [10.0.0.2]) by dt011n65.san.rr.com (8.9.3/8.8.8) with ESMTP id VAA65935; Thu, 26 Aug 1999 21:20:23 -0700 (PDT) (envelope-from Doug@gorean.org) Message-ID: <37C61207.CD381903@gorean.org> Date: Thu, 26 Aug 1999 21:20:23 -0700 From: Doug Organization: Triborough Bridge & Tunnel Authority X-Mailer: Mozilla 4.61 [en] (X11; U; FreeBSD 4.0-CURRENT-0821 i386) X-Accept-Language: en MIME-Version: 1.0 To: "Stephen J. Roznowski" Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: How bullet-proof should the /etc/rc* scripts be? References: <199908270221.WAA14818@cc158233-a.catv1.md.home.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG "Stephen J. Roznowski" wrote: > > I'm trying to build a stripped down version of FreeBSD and have run > across a few oddities in the startup scripts. Ok, first thing is, if you are going to hack up some custom stuff you're pretty much in the driver's seat on issues like this. That's not to say that the rc*, etc. scripts couldn't use some work, in fact some of us are doing just that. > 1. Should commands be wrapped in a check for their existance? For > example: swapon, adjkerntz, etc. If failed execution of the command will leave the system in an unusable state, yes. (Assuming by "check for their existance" you mean using the -x flag to 'test'.) If the system can continue booting even if the command fails, but the user needs to know the command failed, you should test the exit code and act appropriately. If no one cares about the command you don't need to do this, but then why run it at all? > 2. Should everything be wrapped in a "rc.conf" variable? For example, > the section with "mount -a -t nfs" (even though it silently exists > if no NFS filesystems exist). No. That specific case refers to entries in /etc/fstab (the -a is your clue), so regardless of the presence or abscence of nfs stuff in rc.conf that command should be run. There are other commands like this, especially in rc.network that fall into the "we can just run this and nothing bad will happen if we don't need it" category. In a situation like yours that's bad, and in general I'm for making *less* assumptions about the state of the system, but you have to start _somewhere_. > 3. How much checking should be done before executing commands? As it > stands now, if you don't have any ptys, the chflags/chmod/chown > will fail -- should this be wrapped with an if statement? This is a little tougher. I would say that having NO pty's at all is a rather extreme case, but while I'm doing the review I'll give this another look. Can you send me the filename and line number of this specific case in a private e-mail please? That way I won't miss it. > 4. What is the point of the "stty status '^T' at the top of the rc file? Frankly, that one stumps me too. :) There are still plenty of "We've always done it that way" items in the various rc files, that may be one of them. In answer to the question in your subject line, I would say "More so than they are now." Comments and suggestions are welcome, preferably accompanied by unified diffs. :) Good luck with your project, Doug To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message