From 04cbe943bc49a54b3660df99b93ac33304c7a2d1 Mon Sep 17 00:00:00 2001
From: Zygmunt Krynicki <zygmunt.krynicki@huawei.com>
Date: Fri, 29 Oct 2021 21:44:03 +0000
Subject: [PATCH] sysota: persist state directory

SystemOTA needs one bit of information, namely, if the system is in
try-boot mode. This information may not be available from the boot
system at all times, and is required for correct operation.

Persist the entire /var/lib/sysota directory, as SystemOTA creates
temporary files and renames over the desired filename for atomicity.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@huawei.com>
---
 meta-oniro-core/recipes-core/sysota/sysota_git.bb | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/meta-oniro-core/recipes-core/sysota/sysota_git.bb b/meta-oniro-core/recipes-core/sysota/sysota_git.bb
index 7e66c26a..c71bf9cf 100644
--- a/meta-oniro-core/recipes-core/sysota/sysota_git.bb
+++ b/meta-oniro-core/recipes-core/sysota/sysota_git.bb
@@ -112,3 +112,10 @@ FILESEXTRAPATHS_prepend_raspberrypi4-64 := "${THISDIR}/files/raspberrypi4:"
 # Make the SystemOTA package machine-specific. This lets us put the specific
 # configuration file, which encodes boot loader type, into it safely.
 PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+# Persist SystemOTA state directory.
+inherit writables
+
+WRITABLE_TYPE[sysota] = "persistent"
+WRITABLES = "sysota"
+WRITABLE_PATH[sysota] = "/var/lib/sysota"
-- 
GitLab