Skip to contentSkip to conversation

package/swupdate: add option to enable USB install

PATCH Applied James Hilliard 2 participants 2 messages Sep 19, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/swupdate: add option to enable USB install

This is enabled by default for consistency with meta-swupdate behavior.

---
Changes v1 -> v2:
- add note in commit on why this is enabled by default
- fix whitespace in udev rule

---
 package/swupdate/Config.in          | 7 +++++++
 package/swupdate/swupdate-usb.rules | 1 +
 package/swupdate/swupdate.mk        | 3 +++
 3 files changed, 11 insertions(+)
 create mode 100644 package/swupdate/swupdate-usb.rules
package/swupdate/Config.in +7 -0
index 6b832cfcbf..54a99b73d5 100644
@@ -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
package/swupdate/swupdate-usb.rules new file +1 -0
new file mode 100644
index 0000000000..72e003d74d
@@ -0,0 +1 @@
+ACTION=="add", KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_BUS}=="usb", ENV{ID_FS_USAGE}=="filesystem", TAG+="systemd", ENV{SYSTEMD_WANTS}+="swupdate-usb@%k.service"
package/swupdate/swupdate.mk +3 -0
index e191ab384a..5ed2ca55d2 100644
@@ -252,6 +252,9 @@ define SWUPDATE_INSTALL_INIT_SYSTEMD
 		$(TARGET_DIR)/usr/lib/systemd/system/swupdate.socket
 	$(INSTALL) -D -m 644 $(SWUPDATE_PKGDIR)/[email protected] \
 		$(TARGET_DIR)/usr/lib/systemd/system/[email protected]
+	$(if $(BR2_PACKAGE_SWUPDATE_USB), \
+		$(INSTALL) -D -m 644 $(SWUPDATE_PKGDIR)/swupdate-usb.rules \
+			$(TARGET_DIR)/lib/udev/rules.d/swupdate-usb.rules)
 	$(INSTALL) -D -m 644 $(SWUPDATE_PKGDIR)/swupdate-progress.service \
 		$(TARGET_DIR)/usr/lib/systemd/system/swupdate-progress.service
 	$(INSTALL) -D -m 644 $(SWUPDATE_PKGDIR)/tmpfiles-swupdate.conf \
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

James, All,

On 2021-09-19 02:09 -0600, James Hilliard spake thusly:

Quoted 2 lines

This is enabled by default for consistency with meta-swupdate behavior.

So, this is a new feature that was not implicitly provided by previous Buildroot versions, so there is no need for a backward compatibility, so there is no need for a default y in Buildroot. I've dropped it.

Also, I've added a comment about the dependency to systemd.

Applied to master, thanks.

Regards,
Yann E. MORIN.

Quoted 58 lines

---
Changes v1 -> v2:
- add note in commit on why this is enabled by default
- fix whitespace in udev rule

---
 package/swupdate/Config.in          | 7 +++++++
 package/swupdate/swupdate-usb.rules | 1 +
 package/swupdate/swupdate.mk        | 3 +++
 3 files changed, 11 insertions(+)
 create mode 100644 package/swupdate/swupdate-usb.rules
package/swupdate/Config.in +7 -0
index 6b832cfcbf..54a99b73d5 100644
@@ -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
package/swupdate/swupdate-usb.rules new file +1 -0
new file mode 100644
index 0000000000..72e003d74d
@@ -0,0 +1 @@
+ACTION=="add", KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_BUS}=="usb", ENV{ID_FS_USAGE}=="filesystem", TAG+="systemd", ENV{SYSTEMD_WANTS}+="swupdate-usb@%k.service"
package/swupdate/swupdate.mk +3 -0
index e191ab384a..5ed2ca55d2 100644
@@ -252,6 +252,9 @@ define SWUPDATE_INSTALL_INIT_SYSTEMD
 		$(TARGET_DIR)/usr/lib/systemd/system/swupdate.socket
 	$(INSTALL) -D -m 644 $(SWUPDATE_PKGDIR)/[email protected] \
 		$(TARGET_DIR)/usr/lib/systemd/system/[email protected]
+	$(if $(BR2_PACKAGE_SWUPDATE_USB), \
+		$(INSTALL) -D -m 644 $(SWUPDATE_PKGDIR)/swupdate-usb.rules \
+			$(TARGET_DIR)/lib/udev/rules.d/swupdate-usb.rules)
 	$(INSTALL) -D -m 644 $(SWUPDATE_PKGDIR)/swupdate-progress.service \
 		$(TARGET_DIR)/usr/lib/systemd/system/swupdate-progress.service
 	$(INSTALL) -D -m 644 $(SWUPDATE_PKGDIR)/tmpfiles-swupdate.conf \
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot