From nobody@FreeBSD.org  Sun Dec  2 16:49:48 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9153816A417
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  2 Dec 2007 16:49:48 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 7CB5113C457
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  2 Dec 2007 16:49:48 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id lB2GnWjh010345
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 2 Dec 2007 16:49:32 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id lB2GnWpR010344;
	Sun, 2 Dec 2007 16:49:32 GMT
	(envelope-from nobody)
Message-Id: <200712021649.lB2GnWpR010344@www.freebsd.org>
Date: Sun, 2 Dec 2007 16:49:32 GMT
From: Renato Botelho <garga@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: /etc/rc.d/motd doesn't work on custom system
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         118385
>Category:       conf
>Synopsis:       [patch] [rc] /etc/rc.d/motd doesn't work on custom system
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 02 16:50:00 UTC 2007
>Closed-Date:    Thu Jul 31 19:36:08 UTC 2008
>Last-Modified:  Thu Jul 31 19:36:08 UTC 2008
>Originator:     Renato Botelho
>Release:        7.0-BETA3
>Organization:
>Environment:
FreeBSD localhost 7.0-BETA3 FreeBSD 7.0-BETA3 #1: Sat Dec  1 17:38:41 BRST 2007     root@localhost:/usr/obj/usr/src/sys/GARGA  i386

>Description:
When you customize Operating System name, /etc/rc.d/motd add a new OS
information line at the top of /etc/motd on each new boot.

It happens because name "FreeBSD" is harcoded inside it, i've changed it
to get OS name using uname command.

I don't know if the way i did it is the best, but it's working here.
>How-To-Repeat:

>Fix:
Index: src/etc/rc.d/motd
===================================================================
RCS file: /home/ncvs/src/etc/rc.d/motd,v
retrieving revision 1.9
diff -u -r1.9 motd
--- src/etc/rc.d/motd	7 Oct 2004 13:55:26 -0000	1.9
+++ src/etc/rc.d/motd	2 Dec 2007 16:32:33 -0000
@@ -34,14 +34,16 @@
 	fi
 
 	T=`mktemp -t motd`
+	export __OSNAME=`/usr/bin/uname`
 	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}
+	awk '{if (NR == 1) {if ($1 == ENVIRON["__OSNAME"]) {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T}
 
 	cmp -s $T /etc/motd || {
 		cp $T /etc/motd
 		chmod ${PERMS} /etc/motd
 	}
 	rm -f $T
+	unset __OSNAME
 
 	echo .
 }

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Sun Jan 27 23:18:06 UTC 2008 
Responsible-Changed-Why:  
Over to freebsd-rc 

http://www.freebsd.org/cgi/query-pr.cgi?pr=118385 
State-Changed-From-To: open->closed 
State-Changed-By: dougb 
State-Changed-When: Thu Jul 31 19:34:22 UTC 2008 
State-Changed-Why:  

If you want to maintain your own operating system, go ahead. :) 

To my knowledge support for what you're asking for here is not 
really considered a requirement for FreeBSD, and I would prefer 
not to complicate things in the base any more than they already 
are without a good reason.  


Responsible-Changed-From-To: freebsd-rc->dougb 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Thu Jul 31 19:34:22 UTC 2008 
Responsible-Changed-Why:  

I closed this one. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=118385 
>Unformatted:
