Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
script3r
GitHub Repository: script3r/os161
Path: blob/master/kern/conf/newvers.sh
2096 views
1
#!/bin/sh
2
#
3
# newvers.sh - increment build number in current directory (a build directory)
4
# and emit vers.c.
5
# The build number is kept in the file "version".
6
#
7
# Usage: newvers.sh CONFIGNAME
8
9
#
10
# Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
11
# The President and Fellows of Harvard College.
12
#
13
# Redistribution and use in source and binary forms, with or without
14
# modification, are permitted provided that the following conditions
15
# are met:
16
# 1. Redistributions of source code must retain the above copyright
17
# notice, this list of conditions and the following disclaimer.
18
# 2. Redistributions in binary form must reproduce the above copyright
19
# notice, this list of conditions and the following disclaimer in the
20
# documentation and/or other materials provided with the distribution.
21
# 3. Neither the name of the University nor the names of its contributors
22
# may be used to endorse or promote products derived from this software
23
# without specific prior written permission.
24
#
25
# THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND
26
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28
# ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE
29
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35
# SUCH DAMAGE.
36
#
37
38
if [ ! -f autoconf.c ]; then
39
#
40
# If there's no file autoconf.c, we are in the wrong place.
41
#
42
echo "$0: Not in a kernel build directory"
43
exit 1
44
fi
45
46
if [ "x$1" = x ]; then
47
echo "Usage: $0 CONFIGNAME"
48
exit 1
49
fi
50
51
CONFIG="$1"
52
53
#
54
# Get and increment the version number
55
#
56
57
VERS=`cat version 2>/dev/null || echo 0`
58
VERS=`expr $VERS + 1`
59
echo "$VERS" > version
60
61
#
62
# Write vers.c
63
#
64
65
echo '/* This file is automatically generated. Edits will be lost.*/' > vers.c
66
echo "const int buildversion = $VERS;" >> vers.c
67
echo 'const char buildconfig[] = "'"$CONFIG"'";' >> vers.c
68
69
#
70
# Announce it in the hopes that it'll still be visible when the build
71
# finishes.
72
#
73
echo "*** This is $CONFIG build "'#'"$VERS ***"
74
75