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 Wemm 1999-08-06 06:16:06 +00:00
parent 955f41c518
commit f837ca75aa

19
etc/rc
View File

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