diff options
author | gordon <gordon@FreeBSD.org> | 2002-06-13 22:14:37 +0000 |
---|---|---|
committer | gordon <gordon@FreeBSD.org> | 2002-06-13 22:14:37 +0000 |
commit | 9c5433cb225f7a4e56e87623ea2e4011179553a5 (patch) | |
tree | 3168589e209abd888b033397e3c46dee6131a116 /etc/rc.d/motd | |
parent | 50d99cdfecd92f5323a18aa791a5b1cb9d8b7191 (diff) | |
download | FreeBSD-src-9c5433cb225f7a4e56e87623ea2e4011179553a5.zip FreeBSD-src-9c5433cb225f7a4e56e87623ea2e4011179553a5.tar.gz |
Merge in all the changes that Mike Makonnen has been maintaining for a
while. This is only the script pieces, the glue for the build comes next.
Submitted by: Mike Makonnen <makonnen@pacbell.net>
Reviewed by: silence on -current and -hackers
Prodded by: rwatson
Diffstat (limited to 'etc/rc.d/motd')
-rwxr-xr-x | etc/rc.d/motd | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/etc/rc.d/motd b/etc/rc.d/motd index f000364..f61abc8 100755 --- a/etc/rc.d/motd +++ b/etc/rc.d/motd @@ -1,10 +1,13 @@ #!/bin/sh # # $NetBSD: motd,v 1.5 2000/09/19 13:04:38 lukem Exp $ +# $FreeBSD$ # # PROVIDE: motd # REQUIRE: mountcritremote +# BEFORE: LOGIN +# KEYWORD: FreeBSD NetBSD . /etc/rc.subr @@ -13,6 +16,17 @@ rcvar="update_motd" start_cmd="motd_start" stop_cmd=":" +case `${CMD_OSTYPE}` in +FreeBSD) + T=`mktemp /tmp/_motd.XXXXXX` + PERMS="644" + ;; +NetBSD) + T="/etc/_motd" + PERMS="664" + ;; +esac + motd_start() { # Update kernel info in /etc/motd @@ -21,12 +35,24 @@ motd_start() # echo "Updating motd." if [ ! -f /etc/motd ]; then - install -c -o root -g wheel -m 664 /dev/null /etc/motd + install -c -o root -g wheel -m ${PERMS} /dev/null /etc/motd fi - T=/etc/_motd - sysctl -n kern.version | while read i; do echo $i; break; done > $T - sed '1{/^NetBSD.*/{d;};};' < /etc/motd >> $T - cmp -s $T /etc/motd || cp $T /etc/motd + + case `${CMD_OSTYPE}` in + FreeBSD) + 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) + sysctl -n kern.version | while read i; do echo $i; break; done > $T + sed '1{/^NetBSD.*/{d;};};' < /etc/motd >> $T + ;; + esac + cmp -s $T /etc/motd || { + echo T=$T + cp $T /etc/motd + chmod ${PERMS} /etc/motd + } rm -f $T } |