From 05c22b52450878c40ca7512ee13f922a0227c21c Mon Sep 17 00:00:00 2001 From: Mateusz Moscicki Date: Tue, 27 Apr 2021 13:53:20 +0200 Subject: [PATCH] Add support for delta.tar.gz By using compressed delta.tar files, the amount of data that must be downloaded to perform a device update is reduced. Change-Id: I67a0f8405d67d8b07711e421b8fb782e7fadb82f --- update-manager/fota/fota-installer.c | 12 +++++++++--- update-manager/fota/fota-storage-checker.c | 10 ++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/update-manager/fota/fota-installer.c b/update-manager/fota/fota-installer.c index 20d7b06..5635ff0 100644 --- a/update-manager/fota/fota-installer.c +++ b/update-manager/fota/fota-installer.c @@ -29,9 +29,15 @@ int fota_installer_execute() client_delta_path = g_strjoin("/", APP_SHARED_DIR, appid, APP_SHARED_DATA, FOTA_DELTA_FILENAME, NULL); if (!g_file_test(client_delta_path, G_FILE_TEST_EXISTS)) { - _FLOGI("%s doesn't have delta.tar", appid); - status = -2; - goto execute_destroy; + gchar *tmp_client_delta_path = client_delta_path; + client_delta_path = g_strconcat(tmp_client_delta_path, ".gz", NULL); + free(tmp_client_delta_path); + + if (!g_file_test(client_delta_path, G_FILE_TEST_EXISTS)) { + _FLOGI("%s doesn't have delta.tar.gz", appid); + status = -2; + goto execute_destroy; + } } /* 2. Check client have appropriate delta */ diff --git a/update-manager/fota/fota-storage-checker.c b/update-manager/fota/fota-storage-checker.c index c04b387..ca50249 100644 --- a/update-manager/fota/fota-storage-checker.c +++ b/update-manager/fota/fota-storage-checker.c @@ -28,8 +28,14 @@ gchar *fota_storage_find_delta(const char* mount_path, const char *folder_name) /* 2. Check storage have delta.tar */ storage_delta_path = g_strjoin("/", mount_path, folder_name, FOTA_DELTA_FILENAME, NULL); if (!g_file_test(storage_delta_path, G_FILE_TEST_EXISTS)) { - _FLOGI("Storage doesn't have %s", storage_delta_path); - goto verify_destroy; + gchar *tmp_storage_delta_path = storage_delta_path; + storage_delta_path = g_strconcat(tmp_storage_delta_path, ".gz", NULL); + free(tmp_storage_delta_path); + + if (!g_file_test(storage_delta_path, G_FILE_TEST_EXISTS)) { + _FLOGI("Storage doesn't have %s", storage_delta_path); + goto verify_destroy; + } } /* 3. Check storage have appropriate delta */ -- 2.34.1