[Buildroot] [PATCH 1/1] package/swupdate: add option to enable USB install

James Hilliard james.hilliard1 at gmail.com
Sat Sep 11 15:10:31 UTC 2021


Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>
---
 package/swupdate/Config.in          | 7 +++++++
 package/swupdate/swupdate-usb.rules | 2 ++
 package/swupdate/swupdate.mk        | 3 +++
 3 files changed, 12 insertions(+)
 create mode 100644 package/swupdate/swupdate-usb.rules

diff --git a/package/swupdate/Config.in b/package/swupdate/Config.in
index 6b832cfcbf..54a99b73d5 100644
--- a/package/swupdate/Config.in
+++ b/package/swupdate/Config.in
@@ -60,6 +60,13 @@ config BR2_PACKAGE_SWUPDATE_CONFIG
 	  I you wish to use your own modified swupdate configuration
 	  file specify the config file location with this option.
 
+config BR2_PACKAGE_SWUPDATE_USB
+	bool "swupdate usb"
+	default y
+	depends on BR2_PACKAGE_SYSTEMD
+	help
+	  Enable update from USB disk.
+
 config BR2_PACKAGE_SWUPDATE_WEBSERVER
 	bool "swupdate webserver"
 	default y
diff --git a/package/swupdate/swupdate-usb.rules b/package/swupdate/swupdate-usb.rules
new file mode 100644
index 0000000000..b4efd0b733
--- /dev/null
+++ b/package/swupdate/swupdate-usb.rules
@@ -0,0 +1,2 @@
+ACTION=="add", KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_BUS}=="usb", ENV{ID_FS_USAGE}=="filesystem", TAG+="systemd", ENV{SYSTEMD_WANTS}+="swupdate-usb@%k.service"
+
diff --git a/package/swupdate/swupdate.mk b/package/swupdate/swupdate.mk
index c49af7ebf7..c06106e2ee 100644
--- a/package/swupdate/swupdate.mk
+++ b/package/swupdate/swupdate.mk
@@ -252,6 +252,9 @@ define SWUPDATE_INSTALL_INIT_SYSTEMD
 		$(TARGET_DIR)/usr/lib/systemd/system/swupdate.socket
 	$(INSTALL) -D -m 644 package/swupdate/swupdate-usb at .service \
 		$(TARGET_DIR)/usr/lib/systemd/system/swupdate-usb at .service
+	$(if $(BR2_PACKAGE_SWUPDATE_USB), \
+		$(INSTALL) -D -m 644 package/swupdate/swupdate-usb.rules \
+			$(TARGET_DIR)/lib/udev/rules.d/swupdate-usb.rules)
 	$(INSTALL) -D -m 644 package/swupdate/swupdate-progress.service \
 		$(TARGET_DIR)/usr/lib/systemd/system/swupdate-progress.service
 	$(INSTALL) -D -m 644 package/swupdate/tmpfiles-swupdate.conf \
-- 
2.25.1



More information about the buildroot mailing list