Deleted Added
full compact
motd (179945) motd (197947)
1#!/bin/sh
2#
1#!/bin/sh
2#
3# $FreeBSD: head/etc/rc.d/motd 179945 2008-06-23 04:46:54Z mtm $
3# $FreeBSD: head/etc/rc.d/motd 197947 2009-10-10 22:17:03Z dougb $
4#
5
6# PROVIDE: motd
7# REQUIRE: mountcritremote
8# BEFORE: LOGIN
9
10. /etc/rc.subr
11

--- 5 unchanged lines hidden (view full) ---

17PERMS="644"
18
19motd_start()
20{
21 # Update kernel info in /etc/motd
22 # Must be done *before* interactive logins are possible
23 # to prevent possible race conditions.
24 #
4#
5
6# PROVIDE: motd
7# REQUIRE: mountcritremote
8# BEFORE: LOGIN
9
10. /etc/rc.subr
11

--- 5 unchanged lines hidden (view full) ---

17PERMS="644"
18
19motd_start()
20{
21 # Update kernel info in /etc/motd
22 # Must be done *before* interactive logins are possible
23 # to prevent possible race conditions.
24 #
25 [ -z "${rc_quiet}" ] && echo -n 'Updating motd:'
25 check_startmsgs && echo -n 'Updating motd:'
26 if [ ! -f /etc/motd ]; then
27 install -c -o root -g wheel -m ${PERMS} /dev/null /etc/motd
28 fi
29
30 if [ ! -w /etc/motd ]; then
31 echo ' /etc/motd is not writable, update failed.'
32 return
33 fi
34
35 T=`mktemp -t motd`
36 uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
37 awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T}
38
39 cmp -s $T /etc/motd || {
40 cp $T /etc/motd
41 chmod ${PERMS} /etc/motd
42 }
43 rm -f $T
44
26 if [ ! -f /etc/motd ]; then
27 install -c -o root -g wheel -m ${PERMS} /dev/null /etc/motd
28 fi
29
30 if [ ! -w /etc/motd ]; then
31 echo ' /etc/motd is not writable, update failed.'
32 return
33 fi
34
35 T=`mktemp -t motd`
36 uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
37 awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T}
38
39 cmp -s $T /etc/motd || {
40 cp $T /etc/motd
41 chmod ${PERMS} /etc/motd
42 }
43 rm -f $T
44
45 [ -z "${rc_quiet}" ] && echo .
45 check_startmsgs && echo '.'
46}
47
48load_rc_config $name
49run_rc_command "$1"
46}
47
48load_rc_config $name
49run_rc_command "$1"