Date: Fri, 12 Oct 2007 12:43:48 +0400 From: Ruslan Ermilov <ru@freebsd.org> To: Dmitry Morozovsky <marck@rinet.ru> Cc: current@freebsd.org Subject: Re: INSTKERNNAME= foolproof check Message-ID: <20071012084347.GA58315@team.vega.ru> In-Reply-To: <20071011224937.D97516@woozle.rinet.ru> References: <20071011224937.D97516@woozle.rinet.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071012084347.GA58315>
