Add sysrc(8) support for "rc.conf.d" file(s) when given "-s name" to
indicate service(8) script. While here, add "-l" option for listing the
set of configuration file(s) considered (in order; separated by space).
Also add "-L" for exploring all configuration files and "-E" to omit
files that don't exist from operations.
Details
- Reviewers
eadler allanjude delphij bapt - Group Reviewers
manpages - Commits
- rS293292: MFC r290693: Add support for "rc.conf.d" file(s).
rS292833: MFC r290337: Add sysrc(8) support for "rc.conf.d"
rS290693: Add support for "rc.conf.d" file(s).
rS290337: Add sysrc(8) support for "rc.conf.d" file(s) when given "-s name" to
Check that "-L name" lists "rc.conf.d" entries for named "rc.d" script:
$ sysrc -L ipfw
/etc/rc.conf.d/ipfw /usr/local/etc/rc.conf.d/ipfw
$ sysrc -L dhclient
/etc/rc.conf.d/dhclient /usr/local/etc/rc.conf.d/dhclient \
/etc/rc.conf.d/network /usr/local/etc/rc.conf.d/network
$ sysrc -L nosuchservice
(no output)
Check that "-ls name" lists "rc.conf" and "rc.conf.d" entries:
$ sysrc -ls ipfw
/etc/rc.conf /etc/rc.conf.local \
/etc/rc.conf.d/ipfw /usr/local/etc/rc.conf.d/ipfw
$ sysrc -ls dhclient
/etc/rc.conf /etc/rc.conf.local \
/etc/rc.conf.d/dhclient /usr/local/etc/rc.conf.d/dhclient \
/etc/rc.conf.d/network /usr/local/etc/rc.conf.d/network
$ sysrc -ls nosuchservice
/etc/rc.conf /etc/rc.conf.local
Check that "-l" lists "rc.conf" entries:
$ sysrc -l
/etc/rc.conf /etc/rc.conf.local
Check that "-lD" lists the default rc.conf:
/etc/defaults/rc.conf
Check that "-s name variable" is able to get settings from "rc.conf.d":
$ sysrc -f /etc/rc.conf.d/ipfw foo=bar
foo: -> bar
$ sysrc -s ipfw foo
foo: bar
$ sysrc -Fs ipfw foo
foo: /etc/rc.conf.d/ipfw
Check that "-s name variable=value" is able to put settings in "rc.conf.d":
$ sysrc -vs ipfw bar=baz
/etc/rc.conf.d/ipfw: bar: -> baz
Check that "-L" produces a list of all usable configuration files:
$ sysrc -L
(long output)
Check that "-Lv" produces a list of services and their configuration files:
$ sysrc -Lv
(long output)
Check that "-EL" produces a list of existing configuration files:
$ sysrc -Lv
(depends on system)
Check that "-ELv" shows all existing configuration files and what uses them:
$ sysrc -ELv
(depends on system)
Check that "-qL ipfw" returns success:
$ sysrc -qL ipfw && echo found
found
Check that "-qL xxx" returns failure:
$ sysrc -qL xxx || echo not found
not found
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
usr.sbin/bsdconfig/share/sysrc.subr | ||
---|---|---|
248 ↗ | (On Diff #8438) | rcNG allows /etc/rc.conf.d/<service>/* as well rc.subr does it this way: for _d in /etc ${local_startup}; do _d=${_d%/rc.d} if [ -f ${_d}/rc.conf.d/"$_name" ]; then debug "Sourcing ${_d}/rc.conf.d/$_name" . ${_d}/rc.conf.d/"$_name" elif [ -d ${_d}/rc.conf.d/"$_name" ] ; then local _rc for _rc in ${_d}/rc.conf.d/"$_name"/* ; do if [ -f "$_rc" ] ; then debug "Sourcing $_rc" . "$_rc" fi done fi done |
usr.sbin/bsdconfig/share/sysrc.subr | ||
---|---|---|
248 ↗ | (On Diff #8438) | nevermind, you already addressed this |
Add -E' for "Existing Only" and -L' for "List all".
Update usage and help statements.
Change -l' and -s name' handling for robustness.
Produce usage if arguments are given to `-l'.
More manual updates.
Still a little more to do; I'd like to add more to the manual page with respect to examples using -l and -L. For instance, documenting "sysrc -ELv" is very important, as it's a quick way to get a list of all configuration files that exist and which services use them.