Subject: Re: userland build-date?
To: Luke Mewburn <lukem@netbsd.org>
From: Hubert Feyrer <hubert@feyrer.de>
List: tech-userlevel
Date: 01/04/2004 02:15:26
On Sun, 4 Jan 2004, Luke Mewburn wrote:
> Interesting idea.  We could also consider adding the details of the
> build system as well (a la the kernel build string).

which details do you have in mind?


> Have you tried adding a rule to etc/Makefile to build this and seeing
> how well it works?

For a quick hack:

	miyu# cd /usr/src/etc/
	miyu# make make INSTALL_DONE=1 distribution DESTDIR=/
	...
	miyu# cat /etc/release
	NetBSD 1.6ZG/i386 built Sun Jan  4 01:00:37 GMT 2004

	Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
	        The NetBSD Foundation, Inc.  All rights reserved.
	Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
	        The Regents of the University of California.  All rights reserved.
	miyu#

Patch appended below. Want to commit it? :)


 - Hubert

Index: etc/Makefile
===================================================================
RCS file: /cvsroot/src/etc/Makefile,v
retrieving revision 1.265
diff -u -r1.265 Makefile
--- etc/Makefile	1 Jan 2004 12:28:22 -0000	1.265
+++ etc/Makefile	4 Jan 2004 01:08:57 -0000
@@ -46,6 +46,7 @@
 TZDIR=		/usr/share/zoneinfo
 LOCALTIME?=	UTC
 MAKESUMS=	CKSUM=${TOOL_CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums
+DISTRIBREVL!=	${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh

 # Flags for creating ISO CDROM image
 # mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrecord
@@ -144,19 +145,28 @@
 	(cd ${.CURDIR}; ${MAKE} install-etc-files)
 .endif	# !DISTRIBUTION_DONE

-.PHONY: MAKEDEV
+.PHONY: MAKEDEV release-info
 MAKEDEV:
 	${_MKTARGET_CREATE}
 	MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \
 	    NETBSDSRCDIR=${NETBSDSRCDIR:Q} \
 	    awk -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl > ${.TARGET}

+release-info:
+	@( echo "NetBSD ${DISTRIBREVL}/${MACHINE} built `date`" ; \
+	   echo ""; \
+	   echo "Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004" ; \
+           echo "	The NetBSD Foundation, Inc.  All rights reserved."; \
+	   echo "Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994"; \
+	   echo "	The Regents of the University of California.  All rights reserved."; \
+	) >${.TARGET}
+


 # install-etc-files --
 #	Install etc (config) files; not performed by "make build"
 #
-install-etc-files: check_DESTDIR MAKEDEV
+install-etc-files: check_DESTDIR MAKEDEV release-info
 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
 	    ${BIN1} ${DESTDIR}/etc
 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
@@ -182,6 +192,8 @@
 .endif	# MKUNPRIVED != no
 	${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
 	    MAKEDEV ${DESTDIR}/dev
+	${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
+	    release-info ${DESTDIR}/etc/release
 	${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
 	    MAKEDEV.local ${DESTDIR}/dev
 	${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
Index: distrib/sets/lists/etc/mi
===================================================================
RCS file: /cvsroot/src/distrib/sets/lists/etc/mi,v
retrieving revision 1.130
diff -u -r1.130 mi
--- distrib/sets/lists/etc/mi	3 Jan 2004 14:17:06 -0000	1.130
+++ distrib/sets/lists/etc/mi	4 Jan 2004 01:08:57 -0000
@@ -208,6 +208,7 @@
 ./etc/rc.shutdown			etc-sys-rc
 ./etc/rc.subr				etc-sys-rc
 ./etc/rc.wscons				etc-obsolete	obsolete
+./etc/release				etc-sys-etc
 ./etc/remote				etc-uucp-etc
 ./etc/rmt				etc-sysutil-etc
 ./etc/rpc				etc-net-etc

-- 
Hubert Feyrer <hubert@feyrer.de>