git: 1843da3edb2f - main - bsdinstall: Fix ntpd_sync_on_start service option

From: Jessica Clarke <jrtc27_at_FreeBSD.org>
Date: Tue, 29 Nov 2022 03:41:49 UTC
The branch main has been updated by jrtc27:

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

commit 1843da3edb2fa64384d06698ffcd62a3bdff4f7f
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2022-11-29 00:57:38 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2022-11-29 03:33:47 +0000

    bsdinstall: Fix ntpd_sync_on_start service option
    
    This installer option is currently totally useless, as it ends up
    creating an ntpd_sync_on_start_enable="YES" entry in rc.conf, not an
    ntpd_sync_on_start="YES" entry, as is the correct name. This can also be
    noticed by revisiting the services menu, which parses the previously
    written rc.conf.services file to set variables governing the default
    menu entry values so that selecting OK regenerates the same file, as the
    menu entry will use the correct variable name and thus think the entry
    was not selected last time, defaulting back to off and losing the
    setting.
    
    Thus, add a special case in the loop for this option. The only other
    entry that doesn't follow the *_enable pattern is dumpdev (even moused
    does, it just also sets a second variable), but that also deviates in
    terms of being explicitly set either way and using AUTO rather than YES,
    hence why ntpd_sync_on_start follows a different pattern here and is
    special-cased rather than introducing a whole new variable that governs
    behaviour outside the loop.
    
    Fixes:  c153a35bfd71 ("bsdinstall: replace ntpdate by ntpd_sync_on_start")
---
 usr.sbin/bsdinstall/scripts/services | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/bsdinstall/scripts/services b/usr.sbin/bsdinstall/scripts/services
index bfb3a07d48f0..44d7c5f138e6 100755
--- a/usr.sbin/bsdinstall/scripts/services
+++ b/usr.sbin/bsdinstall/scripts/services
@@ -68,7 +68,12 @@ havemouse=
 for daemon in $DAEMONS; do
 	[ "$daemon" = "dumpdev" ] && havedump=1 continue
 	[ "$daemon" = "moused" ] && havemouse=1
-	echo ${daemon}_enable=\"YES\" >> $BSDINSTALL_TMPETC/rc.conf.services
+	if [ "$daemon" = "ntpd_sync_on_start" ]; then
+		rcvar=${daemon}
+	else
+		rcvar=${daemon}_enable
+	fi
+	echo ${rcvar}=\"YES\" >> $BSDINSTALL_TMPETC/rc.conf.services
 done
 
 if [ ! "$havemouse" ]; then