summaryrefslogtreecommitdiffstats
path: root/etc/rc.subr
Commit message (Collapse)AuthorAgeFilesLines
...
* Silence a warning about empty directories in all the places it mightdougb2005-12-101-1/+1
| | | | | | occur. Reminded by: yar
* Since rc.subr is a library of functions, it should not use exityar2005-12-061-6/+6
| | | | | | | | | | | | every now and then. It is up to the caller to choose a proper action upon an error condition. Therefore, use return, not exit, except for some special cases. Consistently return 1 to indicate an error. Submitted by: sem (initially) Reviewed by: freebsd-rc (silence) MFC after: 2 weeks
* Change how *.sh scripts are handled. If the script is in /etc/rc.d,dougb2005-12-051-2/+2
| | | | | | | | source it into the shell. If not, handle it in a subshell the same way that "real" rc.d-style scripts are handled. This will dramatically ease the "process local scripts in the base rcorder" transition. Add *.bak to the list of files in */rc.d that we ignore.
* Introduce startup scripts from the local_startup directories todougb2005-12-021-0/+38
| | | | | | | | | | | | | | | | the base rcorder. This is accomplished by running rcorder twice, first to get all the disks mounted (through mountcritremote), then again to include the local_startup directories. This dramatically changes the behavior of rc.d/localpkg, as all "local" scripts that have the new rc.d semantics are now run in the base rcorder, so only scripts that have not been converted yet will run in rc.d/localpkg. Make a similar change in rc.shutdown, and add some functions in rc.subr to support these changes. Bump __FreeBSD_version to reflect this change.
* Avoid invoking the current script again when we needyar2005-11-161-2/+3
| | | | | | | | | | | | | | to issue sub-commands, e.g., restart = stop + start. By calling run_rc_command instead, we provide rc.d scripts with full control over their configuration variables. For an example problem the former approach caused, see http://lists.freebsd.org/pipermail/freebsd-rc/2005-October/000311.html Reviewed by: freebsd-rc Tested by: Dirk Engling erdgeist <at> erdgeist.org MFC after: 2 weeks
* Override $command with $foo_program only if $commandyar2005-10-261-3/+1
| | | | | | | | | | has been set in the first place. This should reduce unwanted side-effects in rc.d scripts that don't mean to use $command and rc.subr(8) methods associated with it at all. Discussed with: brooks Reviewed by: -rc (silence)
* Document that `reload' is not provided by defaultyar2005-10-261-0/+2
| | | | yet it can be enabled when applicable.
* o Grammar.maxim2005-10-241-1/+1
| | | | | Submitted by: Ulrich Spoerlein MFC after: 1 week
* Allow the process name to be in square brackets ([]) in _find_processes().jhb2005-10-171-1/+1
| | | | | | PR: conf/82430 Submitted by: Pavel Volkov pol at iib dot ru MFC after: 1 week
* Fix the usage of rc_usage. The rc_usage function takesyar2005-10-011-3/+3
| | | | | | a list of possible keywords, not all them in a single argument. This also fixes the issue of extra delimiter characters appearing on the help line from rc.d scripts not setting $extra_commands.
* Stop hard-coding an -M flag to mdmfs(8) in /etc/rc.subr.yar2005-08-241-1/+1
| | | | | | | | | | | Now this flag can be set, or not set, for memory-backed file systems on individual basis, as illustrated by the rc.conf(5) variables tmpmfs_flags and varmfs_flags. The flag is set for those FS'en by default, in /etc/defaults/rc.conf, in order to stay compatible with the old rc.subr behaviour. Submitted by: marck MFC after: 3 days
* Add scripts for GELI device configuration on boot.pjd2005-08-141-0/+34
| | | | | | | | | | rc.d/geli - configures encryption (ask for passphrases, etc.); rc.d/geli2 - is called after file systems are mounted and mark devices for detach on last close. Sponsored by: Wheel Sp. z o.o. http://www.wheel.pl MFC after: 3 days
* Move 'local_tr' function to rc.subr and change its name to 'ltr'.pjd2005-08-141-0/+23
| | | | MFC after: 3 days
* Style: mostly tabs vs blanks, and semicolon placement.schweikh2005-05-221-26/+26
|
* Cosmetic typo in check_pidfile()keramida2005-01-091-1/+1
| | | | | PR: bin/75946 Submitted by: zero@gddn.org (Finn)
* Add two new rc.conf options: tmpmfs_flags and varmfs_flags.keramida2004-11-091-3/+3
| | | | | | | | | | | | | | These can be used to pass extra options to the mdmfs(8) utility, to customize the finer details of the md file system creation (i.e. to turn on/off softupdates, to specify a default owner for md filesystem, etc). Use these two new flags to mount tmpmfs and varmfs without softupdates, since it doesn't make much sense to use SU on malloc-backed file systems. Reviewed by: mtm Inspired by: J. D. Bronson, jbronson at wixb dot com
* Finish cleanup of rc.d/netif. It's now possible to start/stop moremtm2004-07-301-7/+13
| | | | | | | | | | | than one interface from the command line: # /etc/rc.d/netif start bfe0 xl0 It's also possible to restart an interface(s): # /etc/rc.d/netif restart bfe0 This required some changes to rc.subr(8) so that if the start/stop commands are overidden the rest of the command line (after the start/stop/etc... cmd) is passed through to the subroutines.
* Wrap rc.subr insidecperciva2004-07-041-0/+6
| | | | | | | | | | | if [ -z "${_rc_subr_loaded}" ]; then _rc_subr_loaded="YES" ... fi in order to avoid re-interpreting rc.subr every time an rc.d script is run. In my tests, this speeds up rc time by about 8-10%.
* Make the stop command respect the 'fast' prefix.mtm2004-06-261-3/+4
| | | | | | | | Most notably, this cleans up messages when shutting down from single user. In such a case there are usually no daemons running, but their pid files are still in /var/run. This causes rc.d to output diagnostics about daemons with pidfiles, but that are not running.
* Fix typo.mtm2004-06-241-1/+1
| | | | Submitted by: kuriyama
* Restore pre-rcNG behaviour:mtm2004-06-061-3/+2
| | | | | | | SIGINT (Ctrl-c) kills the current script SIGQUIT (Ctrl-\) kills /etc/rc (dropping you into single-user) Prodded by: harti
* Overhaul the /etc/rc.d/diskless script by splitting it out intobrooks2004-03-231-0/+13
| | | | | | | | | | hostname, resolve, tmp, and var scripts. The latter three are new and were repo copied. These scripts no longer depend on being booted with and NFS root instead attempt to automaticly create mfs /tmp and /var volumes if the they are not writable. This behavior can be overridden in /etc/rc.conf. Reviewed by: luigi, pjd
* Some (most?) processes don't cleanup their pid files whenmtm2004-03-031-1/+1
| | | | | | | | | | | they exit. Sometimes they simply can't (core-dump, for example). So, when searching for a running program send standard error output from ps(1) to never-never land. # This should quite those # ps: kvm_getprocs: No such user # errors. Since ports use a duplicate rc.subr(8) you might # still see this error from ports startup scripts.
* NetBSD rev. 1.61mtm2004-02-271-6/+16
| | | | | | | | | | | | | | | | Implement ``one'' prefix to allow a "one shot" operation as if ${rcvar}=yes yet all the other prerequisite tests are still performed. The existing ``force'' prefix is a sledgehammer that ignores all the prerequisite checks and always returns a zero exit status; this is a more gentle approach to the problem of "manipulate this disabled service without editing rc.conf(5)". Obtained From: NetBSD # We have a work-around in our version of rc.subr that # makes force* return a non-zero exit status if the # command/service could not be acted upon. The work-around # is no longer necessary and should be removed.
* o NetBSD rev. 1.60mtm2004-02-261-2/+2
| | | | | | | | | Add "*,v" to the list of scratch files to skip. Suggested by Johnny Lam / Alistair Crooks o Update NetBSD rcsid Obtained From: NetBSD
* NetBSD rev. 1.57mtm2004-02-261-1/+1
| | | | | | | | 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
* NetBSD rev. 1.56mtm2004-02-261-3/+3
| | | | | | | | Use more concise shell syntax: 1. for i in $* -> for i 2. foo=$* -> foo="$@" Obtained From: NetBSD
* NetBSD rev. 1.53, 1.54 and 1.55:mtm2004-02-261-7/+11
| | | | | | | | | | Change how internal boolean variables are used to: if ! ${_somevar:-false}; then _somevar=true fi (Consisent, slightly quicker, and slightly cleaner) Obtained from: NetBSD
* Since id(1) is in /usr, it may not be available until after filesystemmtm2004-01-221-1/+3
| | | | | | mounting. Reminded by: bde
* After setting a ruleset on a new devfs mount, apply it.cperciva2004-01-211-0/+1
| | | | | Approved by: phk, rwatson (mentor) PR: bin/61047
* o Rename devfs_link() to make_symlink() and turn it into a genericmtm2003-12-091-16/+17
| | | | | | symlinking routine. o Modify rc.d/jail to create its own symlink relative to the jail's filesystem
* o Reduce rc(8) startup clutter by turning the informational messagesmtm2003-08-201-4/+8
| | | | | | | | 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
* Add a general mechanism for creating and applyingmtm2003-08-201-0/+218
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Missing quotes around a variable. In this case we are onlymtm2003-07-241-1/+1
| | | | | | | 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>
* Previously, a "forced" command always exited successfully (with themtm2003-06-091-37/+65
| | | | | | | | | 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.
* The dhcp_program and dhcp_flags variables have to be renamed tomtm2003-06-071-0/+2
| | | | | | | | | | | | | | 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>
* This particular debugging statement is very verbose, making the restmtm2003-04-301-1/+1
| | | | | | | 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)
* Write out the debug messages (from the previous commit) only ifmtm2003-01-201-5/+11
| | | | | | the evaluated command exists. Approved by: markm (mentor)(implicit)
* Make the debug messages, for when a script rolls its own start routine,mtm2003-01-181-1/+5
| | | | | | | 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)
* By popular demand, make the debug log to syslog.gordon2002-11-091-1/+3
| | | | Remove an extraneous return too.
* Diff reduction to NetBSD:gordon2002-11-081-19/+16
| | | | | | | | | | | | | 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
* Remove the sourceing of rc.conf from the debug subroutine. This causedgordon2002-09-121-5/+0
| | | | problems when you try to override variables locally.
* Add a support for a ${OSTYPE} which is set once in /etc/rc.subr. Also convertgordon2002-09-061-3/+4
| | | | | | 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.
* Clean up some variables that should have been done before:gordon2002-08-141-1/+15
| | | | | | | | | | | 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>
* Bring this up to date with the latest NetBSD bits. Also add some bits ofgordon2002-06-131-145/+545
| | | | | | | our own. Submitted by: Mike Makonnen Reviewed by: silence on -current and -hackers
* Usage style sweep: spell "usage" with a small 'u'.des2002-04-221-1/+1
| | | | | Also change one case of blatant __progname abuse (several more remain) This commit does not touch anything in src/{contrib,crypto,gnu}/.
* Import the NetBSD 1.5 RC system.obrien2001-06-161-0/+586
Note that `rc' and `rc.shutdown' could not be imported because we already have files with those names.
OpenPOWER on IntegriCloud