#!/bin/sh1#2# newvers.sh - increment build number in current directory (a build directory)3# and emit vers.c.4# The build number is kept in the file "version".5#6# Usage: newvers.sh CONFIGNAME78#9# Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 200910# The President and Fellows of Harvard College.11#12# Redistribution and use in source and binary forms, with or without13# modification, are permitted provided that the following conditions14# are met:15# 1. Redistributions of source code must retain the above copyright16# notice, this list of conditions and the following disclaimer.17# 2. Redistributions in binary form must reproduce the above copyright18# notice, this list of conditions and the following disclaimer in the19# documentation and/or other materials provided with the distribution.20# 3. Neither the name of the University nor the names of its contributors21# may be used to endorse or promote products derived from this software22# without specific prior written permission.23#24# THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND25# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE26# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE27# ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE28# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL29# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS30# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)31# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT32# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY33# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF34# SUCH DAMAGE.35#3637if [ ! -f autoconf.c ]; then38#39# If there's no file autoconf.c, we are in the wrong place.40#41echo "$0: Not in a kernel build directory"42exit 143fi4445if [ "x$1" = x ]; then46echo "Usage: $0 CONFIGNAME"47exit 148fi4950CONFIG="$1"5152#53# Get and increment the version number54#5556VERS=`cat version 2>/dev/null || echo 0`57VERS=`expr $VERS + 1`58echo "$VERS" > version5960#61# Write vers.c62#6364echo '/* This file is automatically generated. Edits will be lost.*/' > vers.c65echo "const int buildversion = $VERS;" >> vers.c66echo 'const char buildconfig[] = "'"$CONFIG"'";' >> vers.c6768#69# Announce it in the hopes that it'll still be visible when the build70# finishes.71#72echo "*** This is $CONFIG build "'#'"$VERS ***"737475