git: 428647d483bb - stable/13 - motd: MFC: unbreak for source upgrade

From: Eugene Grosbein <eugen_at_FreeBSD.org>
Date: Mon, 26 Jun 2023 04:27:48 UTC
The branch stable/13 has been updated by eugen:

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

commit 428647d483bb78ca8f152e5c4ef7556eec2a2c68
Author:     Eugene Grosbein <eugen@FreeBSD.org>
AuthorDate: 2023-06-19 07:49:35 +0000
Commit:     Eugene Grosbein <eugen@FreeBSD.org>
CommitDate: 2023-06-26 04:26:47 +0000

    motd: MFC: unbreak for source upgrade
    
    In case of source upgrade path from 12.x proper merge of new /etc
    installs /etc/motd.template. Becase of that, the system is left
    without symlink /etc/motd -> /var/run/motd but with stale /etc/motd contents.
    
    Fix it creating symlink despite of presence of /etc/motd.template.
    
    (cherry picked from commit 79a96e294c1acb4a2d17447a35f08647a6d09978)
---
 libexec/rc/rc.d/motd | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libexec/rc/rc.d/motd b/libexec/rc/rc.d/motd
index d9dd60a0f59a..7d865a00a88f 100755
--- a/libexec/rc/rc.d/motd
+++ b/libexec/rc/rc.d/motd
@@ -38,10 +38,10 @@ motd_start()
 			# Otherwise, create an empty template file.
 			install -c -o root -g wheel -m ${PERMS} /dev/null "${TEMPLATE}"
 		fi
-		# Provide compatibility symlink:
-		if [ ! -h "${COMPAT_MOTD}" ]; then
-			ln -sF "${TARGET}" "${COMPAT_MOTD}"
-		fi
+	fi
+	# Provide compatibility symlink:
+	if [ ! -h "${COMPAT_MOTD}" ]; then
+		ln -sF "${TARGET}" "${COMPAT_MOTD}"
 	fi
 
 	T=`mktemp -t motd`