[Bug 263782] Use sysrc instead of manually editing rc.conf throughout the FreeBSD Handbook for simplicity and consistency

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 18 May 2022 13:03:54 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263782

--- Comment #12 from PauAmma <pauamma@gundo.com> ---
Comment on attachment 233821
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=233821
combined sysrc with first patch and then combined the two patches

>diff --git a/documentation/content/en/books/handbook/x11/_index.adoc b/documentation/content/en/books/handbook/x11/_index.adoc
>index 8a9269cdcf..9aa05ef7a9 100644
>--- a/documentation/content/en/books/handbook/x11/_index.adoc
>+++ b/documentation/content/en/books/handbook/x11/_index.adoc

>+sysrc xdm_enable="YES"

Needs # prefix

>+sysrc dbus_enable="YES"

Needs # prefix

>diff --git a/documentation/content/en/books/handbook/config/_index.adoc b/documentation/content/en/books/handbook/config/_index.adoc
>index 5fcc5a350f..95ed64cc68 100644
>--- a/documentation/content/en/books/handbook/config/_index.adoc
>+++ b/documentation/content/en/books/handbook/config/_index.adoc
>@@ -56,7 +56,7 @@ This chapter explains much of the FreeBSD configuration process, including some
> 
> After reading this chapter, you will know:
> 
>-* The basics of [.filename]#rc.conf# configuration and [.filename]#/usr/local/etc/rc.d# startup scripts.
>+* The basics of [.filename]#rc.conf# configuration with man:sysrc[8] and [.filename]#/usr/local/etc/rc.d# startup scripts.
> * How to configure and test a network card.
> * How to configure virtual hosts on network devices.
> * How to use the various configuration files in [.filename]#/etc#.
>@@ -80,7 +80,7 @@ In FreeBSD, most included services, such as man:cron[8], are started through the
> === Extended Application Configuration
> 
> Now that FreeBSD includes [.filename]#rc.d#, configuration of application startup is easier and provides more features.
>-Using the key words discussed in <<configtuning-rcd>>, applications can be set to start after certain other services and extra flags can be passed through [.filename]#/etc/rc.conf# in place of hard coded flags in the startup script.
>+Using the key words discussed in <<configtuning-rcd>>, applications can be set to start after certain other services and extra flags can be passed through man:sysrc[8] in place of hard coded flags in the startup script.
> A basic script may look similar to the following:
> 
> [.programlisting]
>@@ -113,14 +113,14 @@ run_rc_command "$1"
> This script will ensure that the provided `utility` will be started after the `DAEMON` pseudo-service.
> It also provides a method for setting and tracking the process ID (PID).
> 
>-This application could then have the following line placed in [.filename]#/etc/rc.conf#:
>+This application could then be enabled with man:sysrc[8]:
> 
> [.programlisting]
> ....
>-utility_enable="YES"
>+# sysrc utility_enable="YES"
> ....
> 
>-This method allows for easier manipulation of command line arguments, inclusion of the default functions provided in [.filename]#/etc/rc.subr#, compatibility with man:rcorder[8], and provides for easier configuration via [.filename]#rc.conf#.
>+This method allows for easier manipulation of command line arguments, inclusion of the default functions provided in [.filename]#/etc/rc.subr#, compatibility with man:rcorder[8], and provides for easier configuration via man:sysrc[8].
> 
> === Using Services to Start Services
> 
>@@ -255,14 +255,13 @@ For instance, man:sshd[8] can be restarted with the following command:
> 
> This procedure can be used to start services on a running system.
> Services will be started automatically at boot time as specified in man:rc.conf[5].
>-For example, to enable man:natd[8] at system startup, add the following line to [.filename]#/etc/rc.conf#:
>+For example, to enable man:natd[8] at system startup, use man:sysrc[8]:
> 
> [.programlisting]
> ....
>-natd_enable="YES"
>+# sysrc natd_enable="YES"
> ....
> 
>-If a `natd_enable="NO"` line is already present, change the `NO` to `YES`.
> The man:rc[8] scripts will automatically load any dependent services during the next boot, as described below.
> 
> Since the man:rc[8] system is primarily intended to start and stop services at system startup and shutdown time, the `start`, `stop` and `restart` options will only perform their action if the appropriate [.filename]#/etc/rc.conf# variable is set.
>@@ -561,12 +560,12 @@ dc0: flags=8843<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
> it would indicate the card has not been configured.
> 
> The card must be configured as `root`.
>-The NIC configuration can be performed from the command line with man:ifconfig[8] but will not persist after a reboot unless the configuration is also added to [.filename]#/etc/rc.conf#.
>+The NIC configuration can be performed from the command line with man:ifconfig[8] but will not persist after a reboot unless the configuration is also modified with man:sysrc[8].
> If a DHCP server is present on the LAN, just add this line:
> 
> [.programlisting]
> ....
>-ifconfig_dc0="DHCP"
>+# sysrc ifconfig_dc0="DHCP"
> ....
> 
> Replace _dc0_ with the correct value for the system.
>@@ -948,12 +947,12 @@ This example adds the hostname of `B`, logs all facilities, and stores the log e
> When adding multiple log clients, add a similar two-line entry for each client.
> More information about the available facilities may be found in man:syslog.conf[5].
> 
>-Next, configure [.filename]#/etc/rc.conf#:
>+Next, configure with man:sysrc[8]:
> 
> [.programlisting]
> ....
>-syslogd_enable="YES"
>-syslogd_flags="-a logclient.example.com -v -v"
>+# sysrc syslogd_enable="YES"
>+# sysrc syslogd_flags="-a logclient.example.com -v -v"
> ....
> 
> The first entry starts syslogd at system boot.
>@@ -988,12 +987,12 @@ If the server did not restart, consult [.filename]#/var/log/messages# for the er
> A logging client sends log entries to a logging server on the network.
> The client also keeps a local copy of its own logs.
> 
>-Once a logging server has been configured, edit [.filename]#/etc/rc.conf# on the logging client:
>+Once a logging server has been configured, use man:sysrc[8] to enable the logging client:
> 
> [.programlisting]
> ....
>-syslogd_enable="YES"
>-syslogd_flags="-s -v -v"
>+# sysrc syslogd_enable="YES"
>+# sysrc syslogd_flags="-s -v -v"
> ....
> 
> The first entry enables syslogd on boot up.
>diff --git a/documentation/content/en/books/handbook/firewalls/_index.adoc b/documentation/content/en/books/handbook/firewalls/_index.adoc
>index ec3bc64543..e8fe2c55cb 100644
>--- a/documentation/content/en/books/handbook/firewalls/_index.adoc
>+++ b/documentation/content/en/books/handbook/firewalls/_index.adoc
>@@ -182,9 +182,8 @@ It also provides several examples for creating rulesets on a FreeBSD system.
> === Enabling PF
> 
> To use PF, its kernel module must be first loaded.
>-This section describes the entries that can be added to [.filename]#/etc/rc.conf# to enable PF.
>+This section describes the entries that can be added:
> 
>-Start by adding `pf_enable=yes` to [.filename]#/etc/rc.conf#:
> 
> [source,shell]
> ....
>@@ -192,7 +191,7 @@ Start by adding `pf_enable=yes` to [.filename]#/etc/rc.conf#:
> ....
> 
> Additional options, described in man:pfctl[8], can be passed to PF when it is started.
>-Add or change this entry in [.filename]#/etc/rc.conf# and specify any required flags between the two quotes (`""`):
>+Use man:sysrc[8] to specify any required flags between the two quotes (`""`):
> 
> [.programlisting]
> ....
>@@ -202,7 +201,7 @@ pf_flags=""                     # additional flags for pfctl startup
> PF will not start if it cannot find its ruleset configuration file.
> By default, FreeBSD does not ship with a ruleset and there is no [.filename]#/etc/pf.conf#.
> Example rulesets can be found in [.filename]#/usr/share/examples/pf/#.
>-If a custom ruleset has been saved somewhere else, add a line to [.filename]#/etc/rc.conf# which specifies the full path to the file:
>+If a custom ruleset has been saved somewhere else, use man:sysrc[8] to specify a line to specify the full path to the file:
> 
> [.programlisting]
> ....
>@@ -210,7 +209,7 @@ pf_rules="/path/to/pf.conf"
> ....
> 
> Logging support for PF is provided by man:pflog[4].
>-To enable logging support, add `pflog_enable=yes` to [.filename]#/etc/rc.conf#:
>+To enable logging support, add `pflog_enable=yes` with man:sysrc[8]:
> 
> [source,shell]
> ....
>diff --git a/documentation/content/en/books/handbook/linuxemu/_index.adoc b/documentation/content/en/books/handbook/linuxemu/_index.adoc
>index 8b46e6444f..d0387ee3c8 100644
>--- a/documentation/content/en/books/handbook/linuxemu/_index.adoc
>+++ b/documentation/content/en/books/handbook/linuxemu/_index.adoc
>@@ -71,11 +71,11 @@ Before reading this chapter, you should:
> == Configuring Linux Binary Compatibility
> 
> By default, Linux binary compatibility is not enabled.
>-To enable it at boot time, add this line to [.filename]#/etc/rc.conf#:
>+To enable it at boot time, use man:sysrc[8]:
> 
> [.programlisting]
> ....
>-linux_enable="YES"
>+# sysrc linux_enable="YES"
> ....
> 
> Once enabled, it can be started without rebooting by running:
>@@ -149,11 +149,11 @@ Consult https://wiki.freebsd.org/Linuxulator[FreeBSD Wiki - Linuxulator] for mor
> A list of all Linux-related man:sysctl[8] knobs can be found in man:linux[4].
> 
> Some applications require specific filesystems to be mounted.
>-This is normally handled by the [.filename]#/etc/rc.d/linux# script, but can be disabled by adding this line to [.filename]#/etc/rc.conf#:
>+This is normally handled by the [.filename]#/etc/rc.d/linux# script, but can be disabled by using man:sysrc[8]:
> 
> [.programlisting]
> ....
>-linux_mounts_enable="NO"
>+# sysrc linux_mounts_enable="NO"
> ....
> 
> Filesystems mounted by the rc script will not work for Linux processes inside chroots or jails; if needed, configure them in [.filename]#/etc/fstab#:
>diff --git a/documentation/content/en/books/handbook/multimedia/_index.adoc b/documentation/content/en/books/handbook/multimedia/_index.adoc
>index 37d7669dc8..742b3d9c42 100644
>--- a/documentation/content/en/books/handbook/multimedia/_index.adoc
>+++ b/documentation/content/en/books/handbook/multimedia/_index.adoc
>@@ -1225,11 +1225,11 @@ add path 'usb/*' mode 0666 group usb
> 
> Refer to man:devfs.rules[5] for more information about this file.
> 
>-Next, enable the ruleset in /etc/rc.conf:
>+Next, enable the ruleset with man:sysrc[8]:
> 
> [.programlisting]
> ....
>-devfs_system_ruleset="system"
>+# sysrc devfs_system_ruleset="system"
> ....
> 
> And, restart the man:devfs[8] system:
>diff --git a/documentation/content/en/books/handbook/ports/_index.adoc b/documentation/content/en/books/handbook/ports/_index.adoc
>index cfe881e847..9ccd1daec9 100644
>--- a/documentation/content/en/books/handbook/ports/_index.adoc
>+++ b/documentation/content/en/books/handbook/ports/_index.adoc
>@@ -1309,7 +1309,7 @@ The following commands and locations can be used to help determine what was inst
> 
> * Most applications install at least one default configuration file in [.filename]#/usr/local/etc#. In cases where an application has a large number of configuration files, a subdirectory will be created to hold them. Often, sample configuration files are installed which end with a suffix such as [.filename]#.sample#. The configuration files should be reviewed and possibly edited to meet the system's needs. To edit a sample file, first copy it without the [.filename]#.sample# extension.
> * Applications which provide documentation will install it into [.filename]#/usr/local/share/doc# and many applications also install manual pages. This documentation should be consulted before continuing.
>-* Some applications run services which must be added to [.filename]#/etc/rc.conf# before starting the application. These applications usually install a startup script in [.filename]#/usr/local/etc/rc.d#. See crossref:config[configtuning-starting-services,Starting Services] for more information.
>+* Some applications run services which must be added to [.filename]#/etc/rc.conf# with https://www.freebsd.org/cgi/man.cgi?query=sysrc[sysrc] before starting the application. These applications usually install a startup script in [.filename]#/usr/local/etc/rc.d#. See crossref:config[configtuning-starting-services,Starting Services] for more information.
> +
> [NOTE]
> ====
>diff --git a/documentation/content/en/books/handbook/printing/_index.adoc b/documentation/content/en/books/handbook/printing/_index.adoc
>index e8b92039c5..63fe07fee4 100644
>--- a/documentation/content/en/books/handbook/printing/_index.adoc
>+++ b/documentation/content/en/books/handbook/printing/_index.adoc
>@@ -100,11 +100,11 @@ For a printer connected directly to a network, use:
> +
> Replace _network-printer-name_ with the `DNS` host name of the network printer.
> +
>-. Enable LPD by editing [.filename]#/etc/rc.conf#, adding this line:
>+. Enable LPD by editing by using man:sysrc[8]:
> +
> [.programlisting]
> ....
>-lpd_enable="YES"
>+# sysrc lpd_enable="YES"
> ....
> +
> Start the service:
>@@ -375,11 +375,11 @@ After creating [.filename]#/etc/printcap#, use man:chkprintcap[8] to test it for
> 
> Fix any reported problems before continuing.
> 
>-Enable man:lpd[8] in [.filename]#/etc/rc.conf#:
>+Enable man:lpd[8] using man:sysrc[8]:
> 
> [.programlisting]
> ....
>-lpd_enable="YES"
>+# sysrc lpd_enable="YES"
> ....
> 
> Start the service:
>diff --git a/documentation/content/en/books/handbook/x11/_index.adoc b/documentation/content/en/books/handbook/x11/_index.adoc
>index 9aa05ef7a9..881fc862e4 100644
>--- a/documentation/content/en/books/handbook/x11/_index.adoc
>+++ b/documentation/content/en/books/handbook/x11/_index.adoc

>+sysrc gdm_enable="YES"

Needs # prefix

>+sysrc gnome_enable="YES"

Needs # prefix

>+sysrc dbus_enable="YES"

Needs # prefix

>+sysrc sddm_enable="YES"

Needs # prefix

>+sysrc dbus_enable="YES"

Needs # prefix

>diff --git a/documentation/content/en/books/handbook/basics/_index.adoc b/documentation/content/en/books/handbook/basics/_index.adoc
>index aa6583ca95..66caeee406 100644
>--- a/documentation/content/en/books/handbook/basics/_index.adoc
>+++ b/documentation/content/en/books/handbook/basics/_index.adoc

>+sysrc allscreens_flags="MODE_279"

Needs # prefix

>diff --git a/documentation/content/en/books/handbook/config/_index.adoc b/documentation/content/en/books/handbook/config/_index.adoc
>index 5fcc5a350f..19cdeea129 100644
>--- a/documentation/content/en/books/handbook/config/_index.adoc
>+++ b/documentation/content/en/books/handbook/config/_index.adoc

>+sysrc utility_enable="YES"

Needs # prefix

>+sysrc natd_enable="YES"

Needs # prefix

>+sysrc ifconfig_dc0="DHCP"

Needs # prefix

>+sysrc syslogd_enable="YES"
>+sysrc syslogd_flags="-a logclient.example.com -v -v"

Need # prefix

>+sysrc syslogd_enable="YES"
>+sysrc syslogd_flags="-s -v -v"

Need # prefix

>diff --git a/documentation/content/en/books/handbook/linuxemu/_index.adoc b/documentation/content/en/books/handbook/linuxemu/_index.adoc
>index 8b46e6444f..8931f2892c 100644
>--- a/documentation/content/en/books/handbook/linuxemu/_index.adoc
>+++ b/documentation/content/en/books/handbook/linuxemu/_index.adoc

>+sysrc linux_enable="YES"

Needs # prefix

>+sysrc linux_mounts_enable="NO"

Needs # prefix

>diff --git a/documentation/content/en/books/handbook/multimedia/_index.adoc b/documentation/content/en/books/handbook/multimedia/_index.adoc
>index 37d7669dc8..922a0ec75c 100644
>--- a/documentation/content/en/books/handbook/multimedia/_index.adoc
>+++ b/documentation/content/en/books/handbook/multimedia/_index.adoc
>+sysrc devfs_system_ruleset="system"

Needs # prefix

>diff --git a/documentation/content/en/books/handbook/printing/_index.adoc b/documentation/content/en/books/handbook/printing/_index.adoc
>index e8b92039c5..a64ee33632 100644
>--- a/documentation/content/en/books/handbook/printing/_index.adoc
>+++ b/documentation/content/en/books/handbook/printing/_index.adoc

>+sysrc lpd_enable="YES"

Needs # prefix

>+sysrc lpd_enable="YES"

Needs # prefix

-- 
You are receiving this mail because:
You are the assignee for the bug.