Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jun 2018 22:48:35 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334982 - in head/etc: . devd
Message-ID:  <201806112248.w5BMmZV6044273@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Mon Jun 11 22:48:34 2018
New Revision: 334982
URL: https://svnweb.freebsd.org/changeset/base/334982

Log:
  User service foo rather than /etc/rc.d/foo.
  
  devd predates service in the system. Modernize usage to use service to
  start/stop things in reaction to events rather than calling the rc
  file directly.
  
  This was pointed out in my talk at BSDcan as well as indirectly
  referrred to as a barrier to entry for OpenRC in that working group.

Modified:
  head/etc/devd.conf
  head/etc/devd/apple.conf
  head/etc/devd/devmatch.conf

Modified: head/etc/devd.conf
==============================================================================
--- head/etc/devd.conf	Mon Jun 11 20:46:20 2018	(r334981)
+++ head/etc/devd.conf	Mon Jun 11 22:48:34 2018	(r334982)
@@ -57,7 +57,7 @@ notify 0 {
 	match "system"		"IFNET";
 	match "type"		"LINK_UP";
 	media-type		"ethernet";
-	action "/etc/rc.d/dhclient quietstart $subsystem";
+	action "service dhclient quietstart $subsystem";
 };
 
 #
@@ -76,7 +76,7 @@ notify 0 {
 	match "system"		"IFNET";
 	match "type"		"LINK_UP";
 	media-type		"802.11";
-	action "/etc/rc.d/dhclient quietstart $subsystem";
+	action "service dhclient quietstart $subsystem";
 };
 
 # An entry like this might be in a different file, but is included here
@@ -94,11 +94,11 @@ detach 100 {
 # When a USB Bluetooth dongle appears, activate it
 attach 100 {
 	device-name "ubt[0-9]+";
-	action "/etc/rc.d/bluetooth quietstart $device-name";
+	action "service bluetooth quietstart $device-name";
 };
 detach 100 {
 	device-name "ubt[0-9]+";
-	action "/etc/rc.d/bluetooth quietstop $device-name";
+	action "service bluetooth quietstop $device-name";
 };
 
 # Firmware downloader for Atheros AR3011 based USB Bluetooth devices
@@ -111,11 +111,11 @@ detach 100 {
 # When a USB keyboard arrives, attach it as the console keyboard.
 attach 100 {
 	device-name "ukbd0";
-	action "/etc/rc.d/syscons setkeyboard /dev/ukbd0";
+	action "service syscons setkeyboard /dev/ukbd0";
 };
 detach 100 {
 	device-name "ukbd0";
-	action "/etc/rc.d/syscons setkeyboard /dev/kbd0";
+	action "service syscons setkeyboard /dev/kbd0";
 };
 
 notify 100 {
@@ -124,7 +124,7 @@ notify 100 {
 	match "type" "CREATE";
 	match "cdev" "atp[0-9]+";
 
-	action "/etc/rc.d/moused quietstart $cdev";
+	action "service moused quietstart $cdev";
 };
 
 notify 100 {
@@ -133,7 +133,7 @@ notify 100 {
 	match "type" "CREATE";
 	match "cdev" "ums[0-9]+";
 
-	action "/etc/rc.d/moused quietstart $cdev";
+	action "service moused quietstart $cdev";
 };
 
 notify 100 {
@@ -142,7 +142,7 @@ notify 100 {
 	match "type" "CREATE";
 	match "cdev" "wsp[0-9]+";
 
-	action "/etc/rc.d/moused quietstart $cdev";
+	action "service moused quietstart $cdev";
 };
 
 notify 100 {
@@ -151,7 +151,7 @@ notify 100 {
 	match "type" "DESTROY";
 	match "cdev" "ums[0-9]+";
 
-	action "/etc/rc.d/moused stop $cdev";
+	action "service moused stop $cdev";
 };
 
 # Firmware download into the ActiveWire board. After the firmware download is
@@ -236,7 +236,7 @@ nomatch 10 {
 notify 10 {
 	match "system"		"ACPI";
 	match "subsystem"	"ACAD";
-	action "/etc/rc.d/power_profile $notify";
+	action "service power_profile $notify";
 };
 
 # Notify all users before beginning emergency shutdown when we get
@@ -317,7 +317,7 @@ notify 10 {
 notify 0 {
 	match "system"		"RCTL";
 	match "rule"		"user:770:swap:.*";
-	action			"/usr/local/etc/rc.d/postgresql restart";
+	action			"service postgresql restart";
 };
 
 # Discard autofs caches, useful for the -media special map.

Modified: head/etc/devd/apple.conf
==============================================================================
--- head/etc/devd/apple.conf	Mon Jun 11 20:46:20 2018	(r334981)
+++ head/etc/devd/apple.conf	Mon Jun 11 22:48:34 2018	(r334982)
@@ -76,5 +76,5 @@ notify 10 {
 	match "system"		"PMU";
 	match "subsystem"	"POWER";
 	match "type"		"ACLINE";
-	action "/etc/rc.d/power_profile $notify";
+	action "service power_profile $notify";
 };

Modified: head/etc/devd/devmatch.conf
==============================================================================
--- head/etc/devd/devmatch.conf	Mon Jun 11 20:46:20 2018	(r334981)
+++ head/etc/devd/devmatch.conf	Mon Jun 11 22:48:34 2018	(r334982)
@@ -9,7 +9,7 @@
 #
 # Generic NOMATCH event
 nomatch 100 {
-	action "/etc/rc.d/devmatch start '?$_'";
+	action "service devmatch start '?$_'";
 };
 
 # Add the following to devd.conf to prevent this from running:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806112248.w5BMmZV6044273>