return status;
}
-int client_controller_add_launch_request_with_data(char *key, char *value)
+int client_controller_add_launch_request_with_data(const char *key, const char *value)
{
int ret = 0;
char *mem = NULL;
{
switch (state) {
case STORAGE_STATE_UNMOUNTABLE:
- case STORAGE_STATE_REMOVED:
case STORAGE_STATE_MOUNTED_READ_ONLY:
_D("Storage %d status : not mounted", storage_id);
break;
case STORAGE_STATE_MOUNTED:
_I("Storage %d status : mounted", storage_id);
- fota_storage_checker_process(mount_path);
+ fota_storage_checker_plug(storage_id, mount_path);
+ break;
+ case STORAGE_STATE_REMOVED:
+ _I("Storage %d status : removed", storage_id);
+ fota_storage_checker_unplug(storage_id, mount_path);
break;
default:
_E("Unexpected state : %d", state);
#include "update-manager.h"
+static int fota_storage_id = -1;
+
int fota_storage_search_delta_path(const char *mount_path, gchar **delta_path)
{
int status = 0;
return status;
}
-void fota_storage_checker_process(const char *mount_path)
+void fota_storage_checker_plug(int storage_id, const char *mount_path)
{
int ret = 0;
gchar *delta_path = NULL;
_E("Failed to add launch request : %d, key : %s, value : %s",
ret, CLIENT_APP_CTRL_LOCAL_KEY, delta_path);
}
+ fota_storage_id = storage_id;
process_destroy:
g_free(delta_path);
}
+
+void fota_storage_checker_unplug(int storage_id, const char *mount_path)
+{
+ int ret = 0;
+ if (storage_id == fota_storage_id) {
+ ret = client_controller_add_launch_request_with_data(CLIENT_APP_CTRL_UNPLUG_KEY, mount_path);
+ if (ret < 0) {
+ _E("Failed to add launch request : %d, key : %s, value : %s",
+ ret, CLIENT_APP_CTRL_UNPLUG_KEY, mount_path);
+ }
+ fota_storage_id = -1;
+ }
+}
#define CLIENT_METADATA_KEY "tizen-update-manager"
#define CLIENT_METADATA_VALUE "client"
#define CLIENT_APP_CTRL_LOCAL_KEY "fota-local"
+#define CLIENT_APP_CTRL_UNPLUG_KEY "fota-unplug"
#define CLIENT_APP_CTRL_REBOOT_KEY "fota-reboot"
/* Update */
bool client_status_checker_is_success(void);
int client_controller_process_launch_request(void);
-int client_controller_add_launch_request_with_data(char *, char *);
+int client_controller_add_launch_request_with_data(const char *, const char *);
int common_storage_checker_init(void);
int common_storage_checker_fini(void);
int fota_controller_install(void);
int fota_controller_result(void);
-void fota_storage_checker_process(const char *);
+void fota_storage_checker_plug(int, const char *);
+void fota_storage_checker_unplug(int, const char *);
int util_file_mkdir(const char *);
int util_file_read_line(const char *, char []);