Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142724897
D54346.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D54346.diff
View Options
diff --git a/Makefile.inc1 b/Makefile.inc1
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1356,28 +1356,6 @@
.endif
.endif
-#
-# Don't allow installworld or installkernel on a pkgbase system. This avoids
-# accidentally updating a pkgbase system with install{world,kernel}, causing
-# the installed system to become out of date with the package database.
-#
-# Skip the check if DESTDIR is defined on the assumption the user knows what
-# they're doing. This means the check can be disabled for the running system
-# using DESTDIR=/.
-#
-.if !make(distributeworld) && !defined(DESTDIR)
-_installcheck_world: __installcheck_PKG
-_installcheck_kernel: __installcheck_PKG
-__installcheck_PKG: .PHONY
-.if exists(${LOCALBASE}/sbin/pkg-static)
- @if ${LOCALBASE}/sbin/pkg-static info -e ${PKG_NAME_PREFIX}-runtime; then \
- echo >&2 "ERROR: This target should not be used on a system installed from packages." ; \
- echo >&2 " To override this check, set DESTDIR=/."; \
- false; \
- fi
-.endif
-.endif
-
.if !defined(DB_FROM_SRC)
#
# Check for missing UIDs/GIDs.
@@ -1873,6 +1851,67 @@
.endif
.endif
+#
+# Don't allow installworld or installkernel on a pkgbase system. This avoids
+# accidentally updating a pkgbase system with install{world,kernel}, causing
+# the installed system to become out of date with the package database.
+#
+# Skip the check if DESTDIR is defined on the assumption the user knows what
+# they're doing. This means the check can be disabled for the running system
+# using DESTDIR=/.
+#
+# People who want to disable this check permanently may set two variables in
+# /etc/make.conf, ALLOW_PKGBASE_INSTALLKERNEL and ALLOW_PKGBASE_INSTALLWORLD,
+# to disable these checks. That doesn't stop this from breaking your system,
+# it just stops make from warning about it.
+#
+.if !make(distributeworld) && !defined(DESTDIR)
+
+. if !defined(ALLOW_PKGBASE_INSTALLKERNEL) && exists(${LOCALBASE}/sbin/pkg-static)
+# For installkernel, we check if this specific kernel was installed by pkg.
+# This means people can continue to use installkernel for non-packaged
+# kernels, which is useful for development.
+
+_installcheck_kernel: __installcheck_kernel_pkgbase
+__installcheck_kernel_pkgbase: .PHONY
+. for _kernel in ${NO_INSTALLKERNEL:D:U${INSTKERNNAME}} \
+ ${INSTALLEXTRAKERNELS:S/^/${INSTKERNNAME}./}
+ @if ${LOCALBASE}/sbin/pkg-static which /boot/${_kernel}/kernel \
+ >/dev/null 2>&1; then \
+ echo >&2 "ERROR: The kernel at /boot/${_kernel} was installed from packages." ; \
+ echo >&2 " A packaged kernel should never be updated using installkernel;" ; \
+ echo >&2 " this will cause the package database to become out of sync with" ; \
+ echo >&2 " the live system state. Either uninstall the packaged kernel," ; \
+ echo >&2 " or install this kernel to a different path using INSTKERNNAME." ; \
+ echo >&2 "" ; \
+ echo >&2 " If you understand the risks and wish to proceed anyway, you may" ; \
+ echo >&2 " set ALLOW_PKGBASE_INSTALLKERNEL=yes to override this safety check." ; \
+ echo >&2 " After doing so, you should not use the pkg(8) utility until you" ; \
+ echo >&2 " have resolved the inconsistency between the installed system and" ; \
+ echo >&2 " the package database." ; \
+ false; \
+ fi
+. endfor
+. endif # !defined(ALLOW_PKGBASE_INSTALLKERNEL) && exists(pkg-static)
+
+. if !defined(ALLOW_PKGBASE_INSTALLWORLD) && exists(${LOCALBASE}/sbin/pkg-static)
+_installcheck_world: __installcheck_world_pkgbase
+__installcheck_world_pkgbase: .PHONY
+ @if ${LOCALBASE}/sbin/pkg-static info -e ${PKG_NAME_PREFIX}-runtime; then \
+ echo >&2 "ERROR: This target should never be used on a system installed from packages;" ; \
+ echo >&2 " doing so will cause the package database to become out of sync with" ; \
+ echo >&2 " the live system state." ; \
+ echo >&2 "" ; \
+ echo >&2 " If you understand the risks and wish to proceed anyway, you may" ; \
+ echo >&2 " set ALLOW_PKGBASE_INSTALLWORLD=yes to override this safety check." ; \
+ echo >&2 " After doing so, you should not use the pkg(8) utility until you" ; \
+ echo >&2 " have resolved the inconsistency between the installed system and" ; \
+ echo >&2 " the package database." ; \
+ false; \
+ fi
+. endif # !defined(ALLOW_PKGBASE_INSTALLWORLD) && exists(pkg-static)
+.endif # !make(distributeworld) && !defined(DESTDIR)
+
#
# installkernel, etc.
#
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 23, 5:40 PM (13 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27488583
Default Alt Text
D54346.diff (4 KB)
Attached To
Mode
D54346: Makefile.inc1: Allow safe installkernel with pkgbase
Attached
Detach File
Event Timeline
Log In to Comment