motd revision 78344
1#!/bin/sh
2#
3# $NetBSD: motd,v 1.5 2000/09/19 13:04:38 lukem Exp $
4#
5
6# PROVIDE: motd
7# REQUIRE: mountcritremote
8
9. /etc/rc.subr
10
11name="motd"
12rcvar="update_motd"
13start_cmd="motd_start"
14stop_cmd=":"
15
16motd_start()
17{
18	#	Update kernel info in /etc/motd
19	#	Must be done *before* interactive logins are possible
20	#	to prevent possible race conditions.
21	#
22	echo "Updating motd."
23	if [ ! -f /etc/motd ]; then
24		install -c -o root -g wheel -m 664 /dev/null /etc/motd
25	fi
26	T=/etc/_motd
27	sysctl -n kern.version | while read i; do echo $i; break; done > $T
28	sed '1{/^NetBSD.*/{d;};};' < /etc/motd >> $T
29	cmp -s $T /etc/motd || cp $T /etc/motd
30	rm -f $T
31}
32
33load_rc_config $name
34run_rc_command "$1"
35