Skip to content

Commit

Permalink
/etc/rc.d/motd: Update to accommodate changes in uname(1) and newvers.sh
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by:	imp
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40225
  • Loading branch information
delphij committed May 23, 2023
1 parent 5a9c724 commit 634a770
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libexec/rc/rc.d/motd
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit 634a770

Please sign in to comment.