return pid;
}
+static int __process_mount_install(pm_dbus_msg *item)
+{
+ char *backend_cmd;
+ char **argv;
+ char args[MAX_PKG_ARGS_LEN] = {'\0', };
+ int pid;
+
+ backend_cmd = _get_backend_cmd(item->pkg_type);
+ if (backend_cmd == NULL)
+ return -1;
+
+ snprintf(args, sizeof(args), "%s -k %s -w %s %s", backend_cmd,
+ item->req_id, item->pkgid, item->args);
+
+ argv = __generate_argv(args);
+
+ pid = __fork_and_exec_with_args(argv, item->uid);
+ g_strfreev(argv);
+ free(backend_cmd);
+
+ return pid;
+}
+
static int __process_reinstall(pm_dbus_msg *item)
{
char *backend_cmd;
__set_recovery_mode(item->uid, item->pkgid, item->pkg_type);
ret = __process_install(item);
break;
+ case PKGMGR_REQUEST_TYPE_MOUNT_INSTALL:
+ __set_backend_busy(x);
+ __set_recovery_mode(item->uid, item->pkgid, item->pkg_type);
+ ret = __process_mount_install(item);
+ break;
case PKGMGR_REQUEST_TYPE_REINSTALL:
__set_backend_busy(x);
__set_recovery_mode(item->uid, item->pkgid, item->pkg_type);
" <arg type='i' name='ret' direction='out'/>"
" <arg type='s' name='reqkey' direction='out'/>"
" </method>"
+ " <method name='mount_install'>"
+ " <arg type='u' name='uid' direction='in'/>"
+ " <arg type='s' name='pkgtype' direction='in'/>"
+ " <arg type='s' name='pkgpath' direction='in'/>"
+ " <arg type='as' name='args' direction='in'/>"
+ " <arg type='i' name='ret' direction='out'/>"
+ " <arg type='s' name='reqkey' direction='out'/>"
+ " </method>"
" <method name='uninstall'>"
" <arg type='u' name='uid' direction='in'/>"
" <arg type='s' name='pkgtype' direction='in'/>"
return ret;
}
+static int __handle_request_mount_install(uid_t uid,
+ GDBusMethodInvocation *invocation, GVariant *parameters)
+{
+ uid_t target_uid = (uid_t)-1;
+ char *pkgtype = NULL;
+ char *pkgpath = NULL;
+ char *args = NULL;
+ char *reqkey = NULL;
+ gchar **tmp_args = NULL;
+ gsize args_count;
+ int ret = -1;
+ GVariant *value;
+ int i = 0;
+ int len = 0;
+
+ g_variant_get(parameters, "(u&s&s@as)", &target_uid, &pkgtype, &pkgpath, &value);
+ tmp_args = (gchar **)g_variant_get_strv(value, &args_count);
+
+ for (i = 0; i < args_count; i++)
+ len = len + strlen(tmp_args[i]) + 1;
+
+ args = (char *)calloc(len, sizeof(char));
+ if (args == NULL) {
+ ERR("calloc failed");
+ ret = -1;
+ goto catch;
+ }
+
+ for (i = 0; i < args_count; i++) {
+ strncat(args, tmp_args[i], strlen(tmp_args[i]));
+ if (i != args_count - 1)
+ strncat(args, " ", strlen(" "));
+ }
+
+ if (target_uid == (uid_t)-1 || pkgtype == NULL) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)",
+ PKGMGR_R_ECOMM, ""));
+ ret = -1;
+ goto catch;
+ }
+
+ if (pkgpath == NULL) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)",
+ PKGMGR_R_ECOMM, ""));
+ ret = -1;
+ goto catch;
+ }
+
+ reqkey = __generate_reqkey(pkgpath);
+ if (reqkey == NULL) {
+ ret = -1;
+ goto catch;
+ }
+
+ if (_pm_queue_push(target_uid, reqkey, PKGMGR_REQUEST_TYPE_MOUNT_INSTALL,
+ pkgtype, pkgpath, args)) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)",
+ PKGMGR_R_ESYSTEM, ""));
+ ret = -1;
+ goto catch;
+ }
+
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)",
+ PKGMGR_R_OK,
+ reqkey));
+ ret = 0;
+
+ catch:
+ if (reqkey)
+ free(reqkey);
+
+ if (args)
+ free(args);
+
+ return ret;
+}
+
static int __handle_request_reinstall(uid_t uid,
GDBusMethodInvocation *invocation, GVariant *parameters)
{
if (g_strcmp0(method_name, "install") == 0)
ret = __handle_request_install(uid, invocation, parameters);
+ else if (g_strcmp0(method_name, "mount_install") == 0)
+ ret = __handle_request_mount_install(uid, invocation, parameters);
else if (g_strcmp0(method_name, "reinstall") == 0)
ret = __handle_request_reinstall(uid, invocation, parameters);
else if (g_strcmp0(method_name, "uninstall") == 0)