Date: Wed, 22 Jun 2011 18:28:11 -0400 (EDT) From: vogelke+unix@pobox.com (Karl Vogel) To: freebsd-questions@freebsd.org Subject: Re: Embedding a RCS token in uname -i Message-ID: <20110622222811.D989DBE92@kev.msw.wpafb.af.mil> In-Reply-To: <alpine.BSF.2.00.1106212012120.8941@Elmer.dco.penx.com> (message from Dennis Glatting on Tue, 21 Jun 2011 20:21:46 -0600 (MDT)) References: <alpine.BSF.2.00.1106212012120.8941@Elmer.dco.penx.com>
next in thread | previous in thread | raw e-mail | index | archive | help
>> On Tue, 21 Jun 2011 20:21:46 -0600 (MDT), >> Dennis Glatting <freebsd@penx.com> said: D> My goal is to provide a mechanism where I can identify that kernels D> built on a group of machines are running the same kernel built from a D> configuration under RCS. How can I customized the current config and D> build mechanisms to accomplish this? Make your changes to the file GENERIC.in, run a small script to create GENERIC with the stuff you want, and then do your build. D> Is it a dumb idea? I don't think so. See below for one way to do it; the script includes a sanity check to make sure your build config file has been checked in. -- Karl Vogel I don't speak for the USAF or my company Mr. Rogers was an ordained minister. --item for a lull in conversation --------------------------------------------------------------------------- me% cat -n GENERIC.in 1 # $Revision: 1.2 $ $Date: 2011/06/22 18:13:14 $ 2 3 cpu HAMMER 4 ident GENERIC 5 ... me% ./mkgen me% cat -n GENERIC 1 # THIS FILE WAS AUTOMATICALLY GENERATED. GENERIC.in is under 2 # revision control, so please make your changes there. 3 # 4 # $Revision: 1.2 $ $Date: 2011/06/22 18:13:14 $ 5 6 cpu HAMMER 7 ident GENERIC-1.2-20110622 8 ... me% cat mkgen #!/bin/ksh #<mkgen: Get version and date info from GENERIC.in, write GENERIC export PATH=/usr/local/bin:/bin:/usr/bin in=GENERIC.in out=GENERIC if rcsdiff -q $in > /dev/null; then echo updating $out else echo $in needs to be checked in exit 0 fi nawk -v ifile=$in 'BEGIN { warn1 = "# THIS FILE WAS AUTOMATICALLY GENERATED. " warn2 = "# revision control, so please make your changes there.\n#" } { if ($0 ~ /Revision:/) { print warn1, ifile, "is under" print warn2 print gsub("/"," ") id = sprintf("%s-%s%s%s", $3, $6, $7, $8) } else if ($0 ~ /^ident/) { print $0 "-" id } else print }' $in > $out exit 0
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110622222811.D989DBE92>