git: c1a76c0486d6 - main - rc.d/ggated: Simplify service script

From: Mateusz Piotrowski <0mp_at_FreeBSD.org>
Date: Fri, 04 Mar 2022 16:52:29 UTC
The branch main has been updated by 0mp (doc, ports committer):

URL: https://cgit.FreeBSD.org/src/commit/?id=c1a76c0486d68b09cbb69e0b5d19385c1b223baa

commit c1a76c0486d68b09cbb69e0b5d19385c1b223baa
Author:     Mateusz Piotrowski <0mp@FreeBSD.org>
AuthorDate: 2022-03-04 14:53:01 +0000
Commit:     Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2022-03-04 16:50:42 +0000

    rc.d/ggated: Simplify service script
    
    - Use the standard *_flags variable for additional flags.
    - Style: do not create unnecessary variables
    - Do not set the defaults in the service script. This is what
      /etc/defaults/rc.conf is for.
    - Do not set additional flags via commands_args. ggated_flags are
      already included in the final invocation. See rc.subr(8) for details.
    - Document the meaning of ggated_config in /etc/defaults/rc.conf.
    
    Approved by:    eugen (src)
    Fixes:          c068632981eb Add ggated rc script
    Differential Revision:  https://reviews.freebsd.org/D34439
---
 libexec/rc/rc.conf     | 4 ++--
 libexec/rc/rc.d/ggated | 6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index 23a397c3b4ad..a497740eff85 100644
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -297,8 +297,8 @@ hastd_enable="NO"		# Run the HAST daemon (YES/NO).
 hastd_program="/sbin/hastd"	# path to hastd, if you want a different one.
 hastd_flags=""			# Optional flags to hastd.
 ggated_enable="NO"		# Run the ggate daemon (YES/NO).
-ggated_config="/etc/gg.exports"
-ggated_params=""		# Extra parameters like which port to bind to.
+ggated_config="/etc/gg.exports"	# ggated(8) exports file.
+ggated_flags=""			# Extra parameters like which port to bind to.
 ctld_enable="NO"		# CAM Target Layer / iSCSI target daemon.
 local_unbound_enable="NO"	# Local caching resolver
 local_unbound_tls="NO"		# Use DNS over TLS
diff --git a/libexec/rc/rc.d/ggated b/libexec/rc/rc.d/ggated
index dc31468920ef..22bc8beb7ca0 100644
--- a/libexec/rc/rc.d/ggated
+++ b/libexec/rc/rc.d/ggated
@@ -12,10 +12,8 @@ command="/sbin/${name}"
 pidfile="/var/run/${name}.pid"
 
 load_rc_config $name
-params="${ggated_params}"
-config="${ggated_config:-/etc/gg.exports}"
-required_files="${config}"
+required_files="${ggated_config}"
 
-command_args="${params} ${config}"
+command_args="${ggated_config}"
 
 run_rc_command "$1"