Home | History | Annotate | Line # | Download | only in conf
newvers_stand.sh revision 1.3
      1  1.1  jdolecek #!/bin/sh -
      2  1.1  jdolecek #
      3  1.3  jdolecek # $NetBSD: newvers_stand.sh,v 1.3 2000/07/13 22:04:44 jdolecek Exp $
      4  1.1  jdolecek #
      5  1.3  jdolecek # Copyright (c) 2000 The NetBSD Foundation, Inc.
      6  1.3  jdolecek # All rights reserved.
      7  1.3  jdolecek #
      8  1.3  jdolecek # This code is derived from software contributed to The NetBSD Foundation
      9  1.3  jdolecek # by Jaromir Dolecek.
     10  1.1  jdolecek #
     11  1.1  jdolecek # Redistribution and use in source and binary forms, with or without
     12  1.1  jdolecek # modification, are permitted provided that the following conditions
     13  1.1  jdolecek # are met:
     14  1.1  jdolecek # 1. Redistributions of source code must retain the above copyright
     15  1.1  jdolecek #    notice, this list of conditions and the following disclaimer.
     16  1.1  jdolecek # 2. Redistributions in binary form must reproduce the above copyright
     17  1.1  jdolecek #    notice, this list of conditions and the following disclaimer in the
     18  1.1  jdolecek #    documentation and/or other materials provided with the distribution.
     19  1.1  jdolecek # 3. All advertising materials mentioning features or use of this software
     20  1.1  jdolecek #    must display the following acknowledgement:
     21  1.3  jdolecek #	This product includes software developed by the NetBSD
     22  1.3  jdolecek #	Foundation, Inc. and its contributors.
     23  1.3  jdolecek # 4. Neither the name of The NetBSD Foundation nor the names of its
     24  1.3  jdolecek #    contributors may be used to endorse or promote products derived
     25  1.3  jdolecek #    from this software without specific prior written permission.
     26  1.1  jdolecek #
     27  1.3  jdolecek # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28  1.3  jdolecek # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29  1.3  jdolecek # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30  1.3  jdolecek # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31  1.3  jdolecek # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32  1.3  jdolecek # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33  1.3  jdolecek # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34  1.3  jdolecek # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35  1.3  jdolecek # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36  1.3  jdolecek # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37  1.3  jdolecek # POSSIBILITY OF SUCH DAMAGE.
     38  1.3  jdolecek 
     39  1.3  jdolecek # Script for generating of vers.c file from given template. Used in
     40  1.3  jdolecek # bootblock build on various architectures.
     41  1.1  jdolecek #
     42  1.3  jdolecek # Called as:
     43  1.3  jdolecek #	sh ${S}/conf/newvers_stand.sh [-NDM] VERSION_FILE ARCH [EXTRA_MSG]
     44  1.3  jdolecek 
     45  1.3  jdolecek add_name=yes
     46  1.3  jdolecek add_date=yes
     47  1.3  jdolecek add_maker=yes
     48  1.1  jdolecek 
     49  1.3  jdolecek # parse command args
     50  1.3  jdolecek while getopts "NDM?" OPT; do
     51  1.3  jdolecek 	case $OPT in
     52  1.3  jdolecek 	N)	add_name=no;;
     53  1.3  jdolecek 	D)	add_date=no;;
     54  1.3  jdolecek 	M)	add_maker=no;;
     55  1.3  jdolecek 	?)	echo "Syntax: newvers_stand.sh [-NDM] VERSION_TEMPLATE ARCH EXTRA_COMMENT" >&2
     56  1.3  jdolecek 		exit 1;;
     57  1.3  jdolecek 	esac
     58  1.3  jdolecek done
     59  1.3  jdolecek 
     60  1.3  jdolecek shift `expr $OPTIND - 1`
     61  1.1  jdolecek 
     62  1.1  jdolecek r=`grep '^[0-9].[0-9]:' $1 | tail -1 | sed -e 's/:.*//'`
     63  1.1  jdolecek 
     64  1.3  jdolecek # always add revision info
     65  1.3  jdolecek echo "const char bootprog_rev[] = \"${r}\";" > vers.c
     66  1.3  jdolecek 
     67  1.3  jdolecek if [ $add_name = yes ]; then
     68  1.3  jdolecek 	a="$2"		# architecture name
     69  1.3  jdolecek 	extra=${3:+" $3"}
     70  1.3  jdolecek 
     71  1.3  jdolecek 	echo "const char bootprog_name[] = \"NetBSD/${a}${extra}\";" >> vers.c
     72  1.3  jdolecek fi
     73  1.3  jdolecek 
     74  1.3  jdolecek if [ $add_date = yes ]; then
     75  1.3  jdolecek 	t=`date`
     76  1.3  jdolecek 	echo "const char bootprog_date[] = \"${t}\";" >> vers.c
     77  1.1  jdolecek fi
     78  1.1  jdolecek 
     79  1.3  jdolecek if [ $add_maker = yes ]; then
     80  1.3  jdolecek 	u=${USER-root} h=`hostname`
     81  1.3  jdolecek 	echo "const char bootprog_maker[] = \"${u}@${h}\";" >> vers.c
     82  1.3  jdolecek fi
     83