From owner-freebsd-questions@FreeBSD.ORG Wed Jun 22 22:39:40 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CE55106566B for ; Wed, 22 Jun 2011 22:39:40 +0000 (UTC) (envelope-from vogelke@hcst.net) Received: from beta.hcst.com (beta.hcst.com [192.52.183.241]) by mx1.freebsd.org (Postfix) with ESMTP id D00138FC13 for ; Wed, 22 Jun 2011 22:39:39 +0000 (UTC) Received: from beta.hcst.com (localhost [127.0.0.1]) by beta.hcst.com (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p5MMSrwR025616 for ; Wed, 22 Jun 2011 18:28:53 -0400 Received: (from vogelke@localhost) by beta.hcst.com (8.14.3/8.14.3/Submit) id p5MMSrPR025615; Wed, 22 Jun 2011 18:28:53 -0400 Received: by kev.msw.wpafb.af.mil (Postfix, from userid 32768) id D989DBE92; Wed, 22 Jun 2011 18:28:11 -0400 (EDT) To: freebsd-questions@freebsd.org In-reply-to: (message from Dennis Glatting on Tue, 21 Jun 2011 20:21:46 -0600 (MDT)) Organization: Array Infotech X-Disclaimer: I don't speak for the USAF or Array Infotech. X-GPG-ID: 1024D/711752A0 2006-06-27 Karl Vogel X-GPG-Fingerprint: 56EB 6DBF 4224 C953 F417 CC99 4C7C 7D46 7117 52A0 References: Message-Id: <20110622222811.D989DBE92@kev.msw.wpafb.af.mil> Date: Wed, 22 Jun 2011 18:28:11 -0400 (EDT) From: vogelke+unix@pobox.com (Karl Vogel) Subject: Re: Embedding a RCS token in uname -i X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: vogelke+unix@pobox.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2011 22:39:40 -0000 >> On Tue, 21 Jun 2011 20:21:46 -0600 (MDT), >> Dennis Glatting 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 # /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