7 # REQUIRE: mountcritremote FILESYSTEMS
13 desc="Update /var/run/motd"
15 start_cmd="motd_start"
18 COMPAT_MOTD="/etc/motd"
19 TARGET="/var/run/motd"
20 TEMPLATE="/etc/motd.template"
25 # Update kernel info in /var/run/motd
26 # Must be done *before* interactive logins are possible
27 # to prevent possible race conditions.
29 check_startmsgs && echo -n 'Updating motd:'
30 if [ ! -f "${TEMPLATE}" ]; then
31 # Create missing template from existing regular motd file, if
33 if [ -f "${COMPAT_MOTD}" ]; then
34 sed '1{/^FreeBSD.*/{d;};};' "${COMPAT_MOTD}" > "${TEMPLATE}"
35 chmod $PERMS "${TEMPLATE}"
36 rm -f "${COMPAT_MOTD}"
38 # Otherwise, create an empty template file.
39 install -c -o root -g wheel -m ${PERMS} /dev/null "${TEMPLATE}"
41 # Provide compatibility symlink:
42 if [ ! -h "${COMPAT_MOTD}" ]; then
43 ln -sF "${TARGET}" "${COMPAT_MOTD}"
48 uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
49 cat "${TEMPLATE}" >> ${T}
51 install -C -o root -g wheel -m "${PERMS}" "$T" "${TARGET}"
54 check_startmsgs && echo '.'