1310201Sbapt#!/bin/sh -
2310201Sbapt#
3310201Sbapt#	$OpenBSD: newvers.sh,v 1.203 2024/03/12 01:20:30 deraadt Exp $
4310201Sbapt#	$NetBSD: newvers.sh,v 1.17.2.1 1995/10/12 05:17:11 jtc Exp $
5310201Sbapt#
6310201Sbapt# Copyright (c) 1984, 1986, 1990, 1993
7310201Sbapt#	The Regents of the University of California.  All rights reserved.
8310201Sbapt#
9310201Sbapt# Redistribution and use in source and binary forms, with or without
10310201Sbapt# modification, are permitted provided that the following conditions
11310201Sbapt# are met:
12310201Sbapt# 1. Redistributions of source code must retain the above copyright
13310201Sbapt#    notice, this list of conditions and the following disclaimer.
14310201Sbapt# 2. Redistributions in binary form must reproduce the above copyright
15310201Sbapt#    notice, this list of conditions and the following disclaimer in the
16310201Sbapt#    documentation and/or other materials provided with the distribution.
17310201Sbapt# 3. Neither the name of the University nor the names of its contributors
18310201Sbapt#    may be used to endorse or promote products derived from this software
19310201Sbapt#    without specific prior written permission.
20310201Sbapt#
21310201Sbapt# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22310201Sbapt# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23310201Sbapt# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24310201Sbapt# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25310201Sbapt# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26310201Sbapt# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27310201Sbapt# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28310201Sbapt# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29310201Sbapt# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30310201Sbapt# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31310201Sbapt# SUCH DAMAGE.
32310201Sbapt#
33310201Sbapt#	@(#)newvers.sh	8.1 (Berkeley) 4/20/94
34310201Sbapt
35310201Sbaptumask 007
36310201Sbapt
37310201Sbaptif [ ! -r version -o ! -s version ]
38310201Sbaptthen
39310201Sbapt	echo 0 > version
40310201Sbaptfi
41310201Sbapt
42310201Sbapttouch version
43310201Sbaptv=`cat version` u=`logname` d=${PWD%/obj} h=`hostname` t=`date`
44310201Sbaptid=`basename "${d}"`
45310201Sbapt
46310201Sbapt# additional things which need version number upgrades:
47310201Sbapt#	sys/sys/param.h:
48325928Sbapt#		OpenBSD symbol
49325928Sbapt#		OpenBSD_X_X symbol
50325928Sbapt#	share/mk/sys.mk
51310201Sbapt#		OSMAJOR
52310201Sbapt#		OSMINOR
53310201Sbapt#	etc/root/root.mail
54310201Sbapt#		VERSION and other bits
55310201Sbapt#	sys/arch/macppc/stand/tbxidata/bsd.tbxi
56310201Sbapt#		change	/X.X/macppc/bsd.rd
57310201Sbapt#	usr.bin/signify/signify.1
58310201Sbapt#		change the version in the EXAMPLES section
59310201Sbapt#
60310201Sbapt# When adding -beta, create a new www/<version>.html so devs can
61310201Sbapt# start adding to it. When removing -beta, roll errata pages.
62310201Sbapt#
63310201Sbapt# -current and -beta tagging:
64310201Sbapt#	For release, select STATUS ""
65310201Sbapt#	Right after release unlock, select STATUS "-current"
66310201Sbapt#	and enable POOL_DEBUG in sys/conf/GENERIC
67310201Sbapt#	A month or so before release, select STATUS "-beta"
68310201Sbapt#	and disable POOL_DEBUG in sys/conf/GENERIC
69325928Sbapt
70310201Sbaptost="OpenBSD"
71310201Sbaptosr="7.5"
72310201Sbapt
73310201Sbaptcat >vers.c <<eof
74310201Sbapt#define STATUS "-current"		/* just after a release */
75310201Sbapt#if 0
76310201Sbapt#define STATUS ""			/* release */
77310201Sbapt#define STATUS "-beta"			/* just before a release */
78310201Sbapt#define STATUS "-stable"		/* stable branch */
79325928Sbapt#endif
80310201Sbapt
81310201Sbaptconst char ostype[] = "${ost}";
82310201Sbaptconst char osrelease[] = "${osr}";
83310201Sbaptconst char osversion[] = "${id}#${v}";
84310201Sbaptconst char sccs[] =
85310201Sbapt    "    @(#)${ost} ${osr}" STATUS " (${id}) #${v}: ${t}\n";
86310201Sbaptconst char version[512] =
87310201Sbapt    "${ost} ${osr}" STATUS " (${id}) #${v}: ${t}\n    ${u}@${h}:${d}\n";
88310201Sbapteof
89310201Sbapt
90310201Sbaptexpr ${v} + 1 > version
91310201Sbapt