The man page for motd(5) says that all lines up to (but not including)
the first line of /etc/motd are replaced by the kernel version at
startup.

But if the first line is blank the rc script ignores it and instead
deletes everything between the first blank line and the second. This
diff fixes that behavior.


Index: etc/rc
===================================================================
RCS file: /cvs/src/etc/rc,v
retrieving revision 1.493
diff -u -p -r1.493 rc
--- etc/rc      26 Feb 2017 16:51:18 -0000      1.493
+++ etc/rc      11 Apr 2017 20:51:24 -0000
@@ -505,7 +505,7 @@ fi
 if T=$(mktemp /tmp/_motd.XXXXXXXXXX); then
        sysctl -n kern.version | sed 1q >$T
        echo "" >>$T
-       sed '1,/^$/d' </etc/motd >>$T
+       sed '0,/^$/d' </etc/motd >>$T
        cmp -s $T /etc/motd || cp $T /etc/motd
        rm -f $T
 fi

Reply via email to