Changeset View
Changeset View
Standalone View
Standalone View
libexec/rc/rc.d/motd
Show All 31 Lines | if [ ! -w /etc/motd ]; then | ||||
echo ' /etc/motd is not writable, update failed.' | echo ' /etc/motd is not writable, update failed.' | ||||
return | return | ||||
fi | fi | ||||
T=`mktemp -t motd` | 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,' > ${T} | ||||
awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T} | awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T} | ||||
cmp -s $T /etc/motd || { | if ! cmp -s $T /etc/motd; then | ||||
cp $T /etc/motd | fsync $T | ||||
mv $T /etc/motd | |||||
chmod ${PERMS} /etc/motd | chmod ${PERMS} /etc/motd | ||||
} | fsync /etc | ||||
else | |||||
rm -f $T | rm -f $T | ||||
fi | |||||
check_startmsgs && echo '.' | check_startmsgs && echo '.' | ||||
} | } | ||||
load_rc_config $name | load_rc_config $name | ||||
run_rc_command "$1" | run_rc_command "$1" |