From 634a770a5e16b424c096b74ac33a145e766dd7af Mon Sep 17 00:00:00 2001 From: Xin LI Date: Mon, 22 May 2023 21:23:57 -0700 Subject: [PATCH] /etc/rc.d/motd: Update to accommodate changes in uname(1) and newvers.sh The recent changes to the uname(1) command removed trailing spaces for better POSIX conformance, but it broke the regular expression used by the motd script which expected it. This commit addresses this by removing the requirement, as it is no longer present. Additionally, a recent change in newvers.sh introduced a new format for uname -v, which omited the build number and build dates to improve reproducible build support. This commit adds support for this new format. Reported-by: Jamie Landeg-Jones Reviewed-by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D40225 --- libexec/rc/rc.d/motd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/motd b/libexec/rc/rc.d/motd index d9dd60a0f59a..e27cf273741d 100755 --- a/libexec/rc/rc.d/motd +++ b/libexec/rc/rc.d/motd @@ -45,7 +45,8 @@ motd_start() fi T=`mktemp -t motd` - uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T} + uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\)$,\1 (\3) #\2,' \ + -e 's,^\([^ ]*\) \([^ ]*\) \([^ ]*\) \([^ ]*\)$,\1 \2 (\4) \3,' > ${T} cat "${TEMPLATE}" >> ${T} install -C -o root -g wheel -m "${PERMS}" "$T" "${TARGET}"