Don't use /tmp/_motd in the aftermath of the chflags(2) revelations.

Obtained from: OpenBSD (millert etc/rc rev 1.102 and hugh)
This commit is contained in:
peter 1999-08-06 06:16:06 +00:00
parent 9f770d77c9
commit 753bd4730c

19
etc/rc
View File

@ -1,5 +1,5 @@
#!/bin/sh
# $Id: rc,v 1.189 1999/06/21 15:59:42 sheldonh Exp $
# $Id: rc,v 1.190 1999/08/02 05:42:44 imp Exp $
# From: @(#)rc 5.27 (Berkeley) 6/5/91
# System startup script run by init on autoboot
@ -400,13 +400,16 @@ if [ "X${local_startup}" != X"NO" ]; then
fi
if [ "X${update_motd}" != X"NO" ]; then
T=/tmp/_motd
rm -rf $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
cp $T /etc/motd
chmod 644 /etc/motd
rm -rf $T
T=`mktemp /tmp/_motd.XXXXXX`
if [ $? -ne 0 ]; then
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
cmp -s $T /etc/motd || {
cp $T /etc/motd
chmod 644 /etc/motd
}
rm -f $T
fi
fi
# Run rc.devfs if present to customify devfs