Move the mktemp invocation inside motd_start to avoid creating temp

files when uptdate_motd and clear_tmp_enable are both NO.

Submitted by:	Alex Deiter <tiamat@komi.mts.ru>
This commit is contained in:
Doug Barton 2003-04-29 06:56:40 +00:00
parent 718e4d2f64
commit ff50165760

View File

@ -18,11 +18,9 @@ stop_cmd=":"
case ${OSTYPE} in
FreeBSD)
T=`mktemp /tmp/_motd.XXXXXX`
PERMS="644"
;;
NetBSD)
T="/etc/_motd"
PERMS="664"
;;
esac
@ -40,10 +38,12 @@ motd_start()
case ${OSTYPE} in
FreeBSD)
T=`mktemp /tmp/_motd.XXXXXX`
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}
;;
NetBSD)
T='/etc/_motd'
sysctl -n kern.version | while read i; do echo $i; break; done > $T
sed '1{/^NetBSD.*/{d;};};' < /etc/motd >> $T
;;