summaryrefslogtreecommitdiffstats
path: root/etc/rc
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1999-08-06 06:16:06 +0000
committerpeter <peter@FreeBSD.org>1999-08-06 06:16:06 +0000
commit753bd4730c6b2aa5e6f0b777d13e5f07823ebcbc (patch)
tree62ecba0a6b67a3e108b3338b58b042d365694c22 /etc/rc
parent9f770d77c9224ba54efc6a701de94bb5efbd0023 (diff)
downloadFreeBSD-src-753bd4730c6b2aa5e6f0b777d13e5f07823ebcbc.zip
FreeBSD-src-753bd4730c6b2aa5e6f0b777d13e5f07823ebcbc.tar.gz
Don't use /tmp/_motd in the aftermath of the chflags(2) revelations.
Obtained from: OpenBSD (millert etc/rc rev 1.102 and hugh)
Diffstat (limited to 'etc/rc')
-rw-r--r--etc/rc19
1 files changed, 11 insertions, 8 deletions
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
OpenPOWER on IntegriCloud