HomeFreeBSD

Makefile.inc1: Allow safe installkernel with pkgbase

Description

Makefile.inc1: Allow safe installkernel with pkgbase

Commit 74a6bb524e5b added a check to install{world,kernel} to avoid
people accidentally running this on pkgbase systems and leaving their
system broken. This had two issues:

(1) The warning was not sufficiently scary, leading people to think

this was safe to do as long as they set DESTDIR=/.

(2) The installkernel check was too strict, and prevented installing

kernels that don't conflict with packaged kernels.

Fix (1) by rewording the warning to be scarier, and while here, add
two new variables (ALLOW_PKGBASE_INSTALL{WORLD,KERNEL}) which could
be set in /etc/make.conf for people who want to break their systems
by default.

Fix (2) by improving the installkernel check to see if the kernel(s)
we're actually installing are packaged. This means a new kernel can
be installed to /boot/kernel as long as there's no packaged kernel
installed there. This check understands INSTKERNNAME, so if there
is a packaged kernel in /boot/kernel, the new kernel can still be
installed using INSTKERNNAME=testkernel (or whatever).

MFC after: 2 weeks
Reported by: christos, jhb, others
Reviewed by: emaste, christos (previous version)
Sponsored by: https://www.patreon.com/bsdivy
Differential Revision: https://reviews.freebsd.org/D54346

Details

Provenance
ivyAuthored on Jan 5 2026, 5:39 PM
Reviewer
emaste
Differential Revision
D54346: Makefile.inc1: Allow safe installkernel with pkgbase
Parents
rG7359df79d3af: share/mk: Remove trailing '/' from debug info directories
Branches
Unknown
Tags
Unknown