From 753bd4730c6b2aa5e6f0b777d13e5f07823ebcbc Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 6 Aug 1999 06:16:06 +0000 Subject: Don't use /tmp/_motd in the aftermath of the chflags(2) revelations. Obtained from: OpenBSD (millert etc/rc rev 1.102 and hugh) --- etc/rc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'etc/rc') diff --git a/etc/rc b/etc/rc index b0e7a2b..1535005 100644 --- a/etc/rc +++ b/etc/rc @@ -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 -- cgit v1.1