Commit Graph

122 Commits

Author SHA1 Message Date
Mike Makonnen
30cb2617ac NetBSD rev. 1.57
run_rc_command(): when checking if ${command} exists before executing it,
  be sure to check under ${name_chroot} (if set).
  Fix from Ed Ravin in [bin/18523]

Obtained From:	NetBSD
2004-02-26 12:35:58 +00:00
Mike Makonnen
42477cdb78 NetBSD rev. 1.56
Use more concise shell syntax:
  1. for i in $* -> for i
  2. foo=$* -> foo="$@"

Obtained From:	NetBSD
2004-02-26 12:30:38 +00:00
Mike Makonnen
4585b18227 NetBSD rev. 1.53, 1.54 and 1.55:
Change how internal boolean variables are used to:
	if ! ${_somevar:-false}; then
		_somevar=true
	fi
  (Consisent, slightly quicker, and slightly cleaner)

Obtained from:	NetBSD
2004-02-26 12:19:48 +00:00
Mike Makonnen
a039fbbf8c Since id(1) is in /usr, it may not be available until after filesystem
mounting.

Reminded by: bde
2004-01-22 08:46:03 +00:00
Colin Percival
b991815bc0 After setting a ruleset on a new devfs mount, apply it.
Approved by: phk, rwatson (mentor)
PR: bin/61047
2004-01-21 16:36:17 +00:00
Mike Makonnen
ed0bd3657c o Rename devfs_link() to make_symlink() and turn it into a generic
symlinking routine.
o Modify rc.d/jail to create its own symlink relative to the jail's
  filesystem
2003-12-09 08:51:11 +00:00
Mike Makonnen
4541e3ecc6 o Reduce rc(8) startup clutter by turning the informational messages
off by default.
o Apparently the routine displaying the informational messages wasn't
  checking its knob in rc.conf, so fix that as well.

Requested by:	obrien
2003-08-20 06:50:34 +00:00
Mike Makonnen
130112f793 Add a general mechanism for creating and applying
devfs(8) rules in rc(8). It is most useful for applying
rules to devfs(5) mount points in /dev or inside jails.
The following line of script is sufficient to
mount a relatively useful+secure devfs(5) in a jail:

	devfs_mount_jail /some/jail/dev

Some new shell routines available to scripts that source
rc.subr(5):
	o devfs_link		- Makes it a little easier to create symlinks
	o devfs_init_rulesets	- Create devfs(8) rulesets from devfs.rules
	o devfs_set_ruleset	- Set a ruleset to a devfs(5) mount
	o devfs_apply_ruleset	- Apply a ruleset to a devfs(5) mount
	o devfs_domount		- Mount devfs(5) and apply some ruleset
	o devfs_mount_jail	- Mount devfs(5) and apply a ruleset
				  appropriate to jails.

Additional rulesets can be specified in /etc/devfs.rules.
If the devfs_system_ruleset variable is defined in rc.conf
and it contains the name of a ruleset defined in /etc/defaults/devfs.rules
or user supplied rulesets in /etc/devfs.rules then that ruleset will
be applied to /dev at startup by the /etc/rc.d/devfs script. It can
also be applied post-startup:

	/etc/rc.d/devfs start

This is a more flexible mechanism than the previous method of using
/etc/devfs.conf. However, that method is still available.

Note: since devfs(8) doesn't provide any way for creating symlinks
as part of a ruleset, anyone wishing to create symlinks in a devfs(5)
as part of the bootup sequence will still have to rely on /etc/devfs.conf.
2003-08-20 06:15:18 +00:00
Mike Makonnen
22b4909430 Missing quotes around a variable. In this case we are only
evaluating the $_precmd command as a string. We're not actually
trying to evaluate the contents of the command.

Reported by:	Glenn Johnson <gjohnson@srrc.ars.usda.gov>
2003-07-24 18:17:21 +00:00
Mike Makonnen
7d25d82513 Previously, a "forced" command always exited successfully (with the
exception of the default 'status' command) regardless of whether the
executed command was actually successfull or not. Forced scripts should
always correctly reflect the outcome of the command.

NOTE: exit values are treated as booleans. We don't care what
      the actual exit value was, only whether it was successfull or not.
2003-06-09 17:31:06 +00:00
Mike Makonnen
d679c13014 The dhcp_program and dhcp_flags variables have to be renamed to
take advantage of the rc.subr(8) glue. They are renamed dhclient_program
and dhclient_flags.
	o Rename them in rc.conf(5)
	o Rename them in /etc/defaults/rc.conf
	o Add the deprecated variables to /etc/rc.subr
	o Isolate the use  of the 'command' variable to the
	  NetBSD specific parts in /etc/rc.d/dhclient.
	o Now that dhcp_flags has also been renamed it will
	  be applied properly by rc.subr(8) glue code.

Reported by:	John Nielsen <john@jnielsen.net>
2003-06-07 10:31:17 +00:00
Mike Makonnen
3d9556ddc0 This particular debugging statement is very verbose, making the rest
of the debug output hard to follow. Comment it out. It's commented out
in NetBSD's version as well.

Approved by:	markm (mentor)(implicit)
2003-04-30 03:03:47 +00:00
Mike Makonnen
03891d9007 Write out the debug messages (from the previous commit) only if
the evaluated command exists.

Approved by: markm (mentor)(implicit)
2003-01-20 19:30:15 +00:00
Mike Makonnen
276ae160e6 Make the debug messages, for when a script rolls its own start routine,
more usefull. Currently it just says 'xxx_cmd'; whereas with this
change it will name the routine that's being run.

Approved by: markm (mentor)
2003-01-18 05:25:59 +00:00
Gordon Tetlow
59de601c12 By popular demand, make the debug log to syslog.
Remove an extraneous return too.
2002-11-09 17:34:21 +00:00
Gordon Tetlow
fd750dbd4c Diff reduction to NetBSD:
Fix a minor grammer nit.
Get rid of _echo that uses logger and just call logger in the 3 routines
that need it.
Add a comment referencing rc.conf(5) in the case of an incorrectly set
variable.

This pulls rc.subr up to 1.51 of rc.subr. I skipped 1.49 (systrace support)
since I don't have systrace.

Obtained from:	NetBSD
2002-11-08 17:06:15 +00:00
Gordon Tetlow
0d8441a9fe Remove the sourceing of rc.conf from the debug subroutine. This caused
problems when you try to override variables locally.
2002-09-12 17:27:36 +00:00
Gordon Tetlow
550f8fc46b Add a support for a ${OSTYPE} which is set once in /etc/rc.subr. Also convert
all instances of `${CMD_OSTYPE}` to just using ${OSTYPE}. This saves us a
shell invocation on anything that is OS-dependent. I seriously doubt that we
will be spontaneously changing OS types during bootup.
2002-09-06 16:15:29 +00:00
Gordon Tetlow
2ee93c5780 Clean up some variables that should have been done before:
xntpd_* -> ntpd_*
portmap_* -> rpcbind_*

Also change single_mountd_enable to mountd_enable.

We also include shims for all the old variable names.

Submitted by:	Mike Makonnen <makonnen@pacbell.net>
2002-08-14 05:37:15 +00:00
Gordon Tetlow
64deb069a9 Bring this up to date with the latest NetBSD bits. Also add some bits of
our own.

Submitted by:	Mike Makonnen
Reviewed by:	silence on -current and -hackers
2002-06-13 22:19:42 +00:00
Dag-Erling Smørgrav
d397408818 Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.
2002-04-22 13:44:47 +00:00
David E. O'Brien
9d62501fd8 Import the NetBSD 1.5 RC system.
Note that `rc' and `rc.shutdown' could not be imported because we already
have files with those names.
2001-06-16 07:16:14 +00:00