Subject: kern/1432: identifying -current versions
To: None <gnats-bugs@gnats.netbsd.org>
From: Simon J. Gerraty <sjg@zen.void.oz.au>
List: netbsd-bugs
Date: 09/03/1995 21:40:09
>Number:         1432
>Category:       kern
>Synopsis:       Adds SUP date to uname -r output
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Sep  4 18:05:04 1995
>Last-Modified:
>Originator:     Simon J. Gerraty
>Organization:
Zen Programming...
>Release:        950818
>Environment:
	
System: NetBSD zen.void.oz.au 1.0A.95.08.18 NetBSD 1.0A (ZEN) #0: Fri Aug 18 18:59:14 EST 1995 root@zen.void.oz.au:/f1/usr.src/sys/arch/i386/compile/ZEN i386


>Description:
	
1.0A is not really enough to identify a -current version.

Since most folk refer to the SUP date as the version they are running,
it makes sense to include this information in the output of uname -r.

The following patch to sys/conf/newvers.sh relies on a file (eg
/usr/src/sup.date) containing the date the sources were SUPed.
The content are appended to $osr, so that if sup.date contains any of
YYMMDD
YY.MM.DD
YY/MM/DD
etc

then uname -r would print 1.0A.YY.MM.DD

The patch has no effect unless $osr ends in A as is the case for
-current versions.

>How-To-Repeat:
	
>Fix:
	
RCS file: /local/src/master/usr.src/sys/conf/newvers.sh,v
retrieving revision 1.1.1.1
diff -c -b -r1.1.1.1 newvers.sh
*** newvers.sh  1995/04/11 08:47:05     1.1.1.1
--- newvers.sh  1995/09/03 03:56:58
***************
*** 47,52 ****
--- 47,62 ----
  ost="NetBSD"
  osr="1.0A"
  
+ case "$osr" in
+ *A)
+         # a -current snapshot, what date?
+         SUP_DATE=${SUP_DATE-/usr/src/sup.date}
+         # the sed command will turn all of YYMMDD, YY.MM.DD etc
+         # into .YY.MM.DD
+         test -s $SUP_DATE && osr="${osr}`sed 's,[^0-9]*\([0-9][0-9]\),.\1,g' $SUP_DATE`"
+         ;;
+ esac
+ 
  echo "char ostype[] = \"${ost}\";" > vers.c
  echo "char osrelease[] = \"${osr}\";" >> vers.c
  echo "char sccs[4] = { '@', '(', '#', ')' };" >> vers.c
>Audit-Trail:
>Unformatted: