[OpenWrt-Devel] [PATCH] base-files: validate firmware for compatibility with backup

Rafał Miłecki zajec5 at gmail.com
Thu Sep 5 07:08:13 EDT 2019


From: Rafał Miłecki <rafal at milecki.pl>

This allows platform code to check if firmware image can be used with
preserving a backup. It may be used e.g. when installing vendor
firmwares that won't restore appended backup archive.

Suggested-by: Luis Araneda <luaraneda at gmail.com>
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 .../base-files/files/usr/libexec/validate_firmware_image   | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/package/base-files/files/usr/libexec/validate_firmware_image b/package/base-files/files/usr/libexec/validate_firmware_image
index a07796c9dc..f85fb9e4b4 100755
--- a/package/base-files/files/usr/libexec/validate_firmware_image
+++ b/package/base-files/files/usr/libexec/validate_firmware_image
@@ -8,6 +8,7 @@ include /lib/upgrade
 
 VALID=1
 FORCEABLE=1
+ALLOW_BACKUP=1
 
 # Mark image as invalid but still possible to install
 notify_firmware_invalid() {
@@ -20,6 +21,11 @@ notify_firmware_broken() {
 	FORCEABLE=0
 }
 
+# Mark image as incompatible with preserving a backup
+notify_firmware_no_backup() {
+	ALLOW_BACKUP=0
+}
+
 # Add result of validation test
 notify_firmware_test_result() {
 	local old_ns
@@ -55,5 +61,6 @@ json_init
 	json_close_object
 	json_add_boolean valid "$VALID"
 	json_add_boolean forceable "$FORCEABLE"
+	json_add_boolean allow_backup "$ALLOW_BACKUP"
 json_dump -i
 json_set_namespace $old_ns
-- 
2.21.0


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list