git: 32fdac77b3d7 - stable/14 - devd: autofs: Move autofs related events to a separate file

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Tue, 04 Jun 2024 11:37:30 UTC
The branch stable/14 has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=32fdac77b3d76be73ebc6985f2be437dca1828cb

commit 32fdac77b3d76be73ebc6985f2be437dca1828cb
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2023-11-07 10:06:15 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2024-06-04 11:37:07 +0000

    devd: autofs: Move autofs related events to a separate file
    
    If a user don't have FreeBSD-autofs installed there is no need to try calling
    automount on every GEOM event.
    It's also easier to add/delete autofs related event in a separate file.
    
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    Differential Revision:  https://reviews.freebsd.org/D42495
    Reviewed by:    imp
    
    (cherry picked from commit b3c116d50ecacaab5236e0488cb74c1bcf614ae7)
---
 sbin/devd/Makefile    | 5 +++++
 sbin/devd/autofs.conf | 9 +++++++++
 sbin/devd/devd.conf   | 7 -------
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/sbin/devd/Makefile b/sbin/devd/Makefile
index f1a5f12ac478..20490c954031 100644
--- a/sbin/devd/Makefile
+++ b/sbin/devd/Makefile
@@ -11,6 +11,11 @@ DEVDDIR=	/etc/devd
 DEVD+=	asus.conf
 .endif
 
+CONFGROUPS+=		AUTOFS
+AUTOFSDIR=		${DEVDDIR}
+AUTOFS+=		autofs.conf
+AUTOFSPACKAGE=		autofs
+
 CONFGROUPS+=		DHCLIENT
 DHCLIENTDIR=		${DEVDDIR}
 DHCLIENT+=		dhclient.conf
diff --git a/sbin/devd/autofs.conf b/sbin/devd/autofs.conf
new file mode 100644
index 000000000000..a06ca7295d38
--- /dev/null
+++ b/sbin/devd/autofs.conf
@@ -0,0 +1,9 @@
+#
+# autofs(5) specific devd events
+
+# Discard autofs caches, useful for the -media special map.
+notify 100 {
+	match "system" "GEOM";
+	match "subsystem" "DEV";
+	action "/usr/sbin/automount -c";
+};
diff --git a/sbin/devd/devd.conf b/sbin/devd/devd.conf
index ea8421e76d61..50dbf19ffd4a 100644
--- a/sbin/devd/devd.conf
+++ b/sbin/devd/devd.conf
@@ -159,13 +159,6 @@ notify 0 {
 	action			"service postgresql restart";
 };
 
-# Discard autofs caches, useful for the -media special map.
-notify 100 {
-	match "system" "GEOM";
-	match "subsystem" "DEV";
-	action "/usr/sbin/automount -c";
-};
-
 # Handle userland coredumps.
 # This commented out handler makes it possible to run an
 # automated debugging session after the core dump is generated.