{
int ret = 0, status = 0;
char buf[MAX_BUFFER_SIZE] = {0, };
- char *current_release_version = NULL;
+ char *build_id = NULL;
if (g_file_test(delta_path, G_FILE_TEST_EXISTS)) {
_I("Found delta in %s, start process to verify", delta_path);
- ret = util_file_untar(delta_path, RELEASE_VERSION_DIR, RELEASE_VERSION_FILE);
+ ret = util_file_untar(delta_path, BUILD_ID_DIR, BUILD_ID_FILE);
if (ret < 0) {
- _E("Failed to fetch version.txt from delta : %d", ret);
+ _E("Failed to fetch %s from delta : %d", BUILD_ID_FILE, ret);
status = -1;
goto verify_destroy;
}
- current_release_version = fota_info_get_release_version();
- if (current_release_version == NULL) {
- _E("Failed to get current release version");
+ build_id = fota_info_get_build_id();
+ if (build_id == NULL) {
+ _E("Failed to get current build id");
status = -1;
goto verify_destroy;
}
- ret = util_file_read_line(RELEASE_VERSION_PATH, buf);
+ ret = util_file_read_line(BUILD_ID_PATH, buf);
if (ret < 0) {
- _E("Failed to read delta version : %d", ret);
+ _E("Failed to read delta build id : %d", ret);
status = -1;
goto verify_destroy;
}
- if (g_strrstr(buf, current_release_version) != NULL) {
- _I("Delta version matched : %s", current_release_version);
+ if (g_strrstr(buf, build_id) != NULL) {
+ _I("Delta build id matched : %s", build_id);
} else {
- _I("Delta version unmatched, current : %s, delta : %s",
- current_release_version, buf);
+ _I("Delta build id unmatched, current : %s, delta : %s",
+ build_id, buf);
status = 1;
}
} else {
}
verify_destroy:
- ret = remove(RELEASE_VERSION_PATH);
+ ret = remove(BUILD_ID_PATH);
if (ret < 0)
- _W("Failed to remove version.txt : %m");
+ _W("Failed to remove %s : %m", BUILD_ID_PATH);
return status;
}
#include "update-manager.h"
-static char *release_version = NULL;
+static char *build_id = NULL;
static char *platform_version = NULL;
-char *fota_info_get_release_version()
+char *fota_info_get_build_id()
{
- return release_version;
+ return build_id;
}
char *fota_info_get_platform_version()
int ret = 0;
_I("Start process to get fota information");
- ret = system_info_get_platform_string(RELEASE_INFO_KEY, &release_version);
+ ret = system_info_get_platform_string(BUILD_ID_KEY, &build_id);
if (ret != SYSTEM_INFO_ERROR_NONE) {
_E("system_info_get_platform_string failed : %d", ret);
return -1;
return -1;
}
- _I("Success to get fota information, platform : %s, release : %s",
- platform_version, release_version);
+ _I("Success to get fota information, platform : %s, build_id : %s",
+ platform_version, build_id);
return 0;
}
int fota_info_checker_fini()
{
- if (release_version)
- free(release_version);
+ if (build_id)
+ free(build_id);
if (platform_version)
free(platform_version);
int fota_storage_search_delta_path(const char *mount_path, gchar **delta_path)
{
int status = 0;
- char *release_version = NULL;
+ char *build_id = NULL;
const gchar *folder_name = NULL;
GFile *mount = NULL;
GFileEnumerator *enumerator = NULL;
goto search_destroy;
}
- release_version = fota_info_get_release_version();
- if (release_version == NULL) {
- _E("Failed to get release version");
+ build_id = fota_info_get_build_id();
+ if (build_id == NULL) {
+ _E("Failed to get build id");
status = -1;
goto search_destroy;
}
continue;
folder_name = g_file_info_get_name(info);
- if (g_str_has_prefix(folder_name, release_version) == TRUE) {
+ if (g_str_has_prefix(folder_name, build_id) == TRUE) {
*delta_path = g_strjoin("/", mount_path, folder_name, FOTA_DELTA_FILE, NULL);
break;
}
if (*delta_path != NULL) {
_I("Success to find delta path : %s", *delta_path);
} else {
- _I("Failed to find delta path with prefix %s", release_version);
+ _I("Failed to find delta path with prefix %s", build_id);
status = 1;
}
#define PLATFORM_VERSION_FILE "version"
#define PLATFORM_VERSION_PATH PLATFORM_VERSION_DIR "/" PLATFORM_VERSION_FILE
-#define RELEASE_INFO_KEY "tizen.org/system/build.release"
-#define RELEASE_VERSION_DIR "/tmp"
-#define RELEASE_VERSION_FILE "version.txt"
-#define RELEASE_VERSION_PATH RELEASE_VERSION_DIR "/" RELEASE_VERSION_FILE
+#define BUILD_ID_KEY "http://tizen.org/system/build.id"
+#define BUILD_ID_DIR "/tmp"
+#define BUILD_ID_FILE "build_id.txt"
+#define BUILD_ID_PATH BUILD_ID_DIR "/" BUILD_ID_FILE
#define FOTA_REBOOT_REASON "fota"
#define FOTA_DIR "/opt/usr/data/fota"
int fota_info_checker_init(void);
int fota_info_checker_fini(void);
-char *fota_info_get_release_version(void);
+char *fota_info_get_build_id(void);
char *fota_info_get_platform_version(void);
int fota_storage_checker_init(void);