From owner-freebsd-current@FreeBSD.ORG Fri Oct 12 11:55:37 2007 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D03516A473 for ; Fri, 12 Oct 2007 11:55:37 +0000 (UTC) (envelope-from prvs=0805a381f1=rermilov@team.vega.ru) Received: from mail.vega.ru (mx1.vega.ru [87.242.77.163]) by mx1.freebsd.org (Postfix) with ESMTP id D645113C45D for ; Fri, 12 Oct 2007 11:55:36 +0000 (UTC) (envelope-from prvs=0805a381f1=rermilov@team.vega.ru) Received: from [87.242.97.68] (port=50771 helo=edoofus.dev.vega.ru) by mail.vega.ru with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68 (FreeBSD)) (envelope-from ) id 1IgG8I-000M6X-SL; Fri, 12 Oct 2007 08:44:34 +0000 Received: from edoofus.dev.vega.ru (localhost [127.0.0.1]) by edoofus.dev.vega.ru (8.14.1/8.14.1) with ESMTP id l9C8hnQr059059; Fri, 12 Oct 2007 12:43:49 +0400 (MSD) (envelope-from rermilov@team.vega.ru) Received: (from ru@localhost) by edoofus.dev.vega.ru (8.14.1/8.14.1/Submit) id l9C8hm0T059058; Fri, 12 Oct 2007 12:43:48 +0400 (MSD) (envelope-from rermilov@team.vega.ru) X-Authentication-Warning: edoofus.dev.vega.ru: ru set sender to rermilov@team.vega.ru using -f Date: Fri, 12 Oct 2007 12:43:48 +0400 From: Ruslan Ermilov To: Dmitry Morozovsky Message-ID: <20071012084347.GA58315@team.vega.ru> References: <20071011224937.D97516@woozle.rinet.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20071011224937.D97516@woozle.rinet.ru> User-Agent: Mutt/1.5.16 (2007-06-09) Cc: current@freebsd.org Subject: Re: INSTKERNNAME= foolproof check X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2007 11:55:37 -0000 On Thu, Oct 11, 2007 at 10:53:12PM +0400, Dmitry Morozovsky wrote: > Colleagues, > > Today I successfully shoot myself in the foot by typing > > make installkernel KERNCONF=GENERIC INSTKERNNAME= > > instead of usual > > make installkernel KERNCONF=GENERIC INSTKERNNAME=GENERIC > > Empty INSTKERNNAME leads to wiping /boot completely - rather annoying, > especially in my case, where I had some non-trivial (and, of course, no backups > ;-) loader.conf > > What do you think about the following patch? > > Index: Makefile.inc1 > =================================================================== > RCS file: /home/ncvs/src/Makefile.inc1,v > retrieving revision 1.588.2.1 > diff -u -r1.588.2.1 Makefile.inc1 > --- Makefile.inc1 11 Oct 2007 06:08:51 -0000 1.588.2.1 > +++ Makefile.inc1 11 Oct 2007 18:49:19 -0000 > @@ -742,6 +742,10 @@ > @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ > false > .endif > +.if empty(INSTKERNNAME) > + @echo "ERROR: Kernel install directory is empty."; \ > + false > +.endif > @echo "--------------------------------------------------------------" > @echo ">>> Installing kernel" > @echo "--------------------------------------------------------------" > There's a better place to fix this, so a classical config/make method is fixed as well. Though, this is only one of the many possibilities to shoot yourself in the foot. %%% Index: kern.pre.mk =================================================================== RCS file: /home/ncvs/src/sys/conf/kern.pre.mk,v retrieving revision 1.92 diff -u -p -r1.92 kern.pre.mk --- kern.pre.mk 8 Aug 2007 19:12:06 -0000 1.92 +++ kern.pre.mk 12 Oct 2007 08:41:23 -0000 @@ -10,7 +10,9 @@ SRCCONF?= /etc/src.conf # Can be overridden by makeoptions or /etc/make.conf KERNEL_KO?= kernel -KERNEL?= kernel +.if !defined(KERNEL) || empty(KERNEL) +KERNEL= kernel +.endif KODIR?= /boot/${KERNEL} M= ${MACHINE_ARCH} %%% Cheers, -- Ruslan Ermilov ru@FreeBSD.org FreeBSD committer