Date: Mon, 8 Jul 1996 17:59:04 -0400 (EDT) From: Dmitry Kohmanyuk <dk@dog.farm.org> To: mbarkah@hemi.com (Ade Barkah) Cc: hackers@freebsd.org Subject: Re: NFS install problem with 2.2-960612-SNAP, motd, etc. Message-ID: <199607082159.RAA09331@dog.farm.org>
next in thread | raw e-mail | index | archive | help
In article <199606200510.XAA19984@hemi.com> you wrote: > rc.local has the following code in it: > | T=/tmp/_motd ... > | uname -v | sed ... > $T > | ... > | cp $T /etc/motd > The above is extremely annoying. =-) Is there a good reason to keep > such code in rc.local ? Can we get rid of it ? Please ? =-) I can > just think of all the poor FreeBSD newcomers who can't for the life > of them figure out why their /etc/motd keeps on dissappearing. Over- > writing user files is morally bad, anyways. it is not disappearing; there is just some little magic insisting on giving user an idea of the system s?he have just logged in ;-) I would comment on it line-by-line: T=/tmp/_motd # a name for the scratch file rm -f $T # delete it uname -v | sed -e '...[long]...' > $T # put massaged uname output to it echo "" >> $T # append a line to it sed '1,/^$/d' < /etc/motd >> $T # append old motd but its begginning # up to the first empty line to it cp $T /etc/motd # copy it back to /etc/motd chmod 644 /etc/motd # fix perms rm -f $T # remove scarch file the only bad possibility arising from this is: when you put something into /etc/motd and _remove_ first FreeBSD id line, all text from the beginning of /etc/motd to the first empty line (or to the end of file, if there isn't an empty line there) would be replaced. (if file starts with empty line, text until _second_ empty line would be lost.) I can consider this a suboptimal behaviour, though. (Should we put `Do not remove this tag under penalty of law' into manual page for /etc/motd? <grin> ) changing sed '1,/^$/d' to sed '/^FreeBSD /,/^$/d' can probably make anyone happy, though. -- "'Programming' is a four-letter word." --Craig Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607082159.RAA09331>