ADD_SUBDIRECTORY(types)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/package-manager-debug.h DESTINATION include)
+
} listening;
} info;
void *new_event_cb;
+ char *tep_path;
+ char *tep_move;
} pkgmgr_client_t;
typedef struct _iter_data {
/* Manage pc */
pc->ctype = ctype;
pc->status_type = PKGMGR_CLIENT_STATUS_ALL;
+ pc->tep_path = NULL;
if (pc->ctype == PC_REQUEST) {
pc->info.request.cc = comm_client_new();
return PKGMGR_R_EINVAL;
}
+ if (mpc->tep_path) {
+ free(mpc->tep_path);
+ mpc->tep_path = NULL;
+ }
+
+ if (mpc->tep_move) {
+ free(mpc->tep_move);
+ mpc->tep_move = NULL;
+ }
+
free(mpc);
mpc = NULL;
return PKGMGR_R_OK;
return strdup(pkg_type);
}
+API int pkgmgr_client_set_tep_path(pkgmgr_client *pc, char *tep_path, char *tep_move)
+{
+ retvm_if(pc == NULL, PKGMGR_R_EINVAL, "package manager client pc is NULL");
+ retvm_if(tep_path == NULL, PKGMGR_R_EINVAL, "tep path is NULL");
+ pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
+
+ mpc->tep_path = strdup(tep_path);
+ mpc->tep_move = strdup(tep_move);
+
+ return PKGMGR_R_OK;
+}
+
API int pkgmgr_client_usr_install(pkgmgr_client *pc, const char *pkg_type,
const char *descriptor_path, const char *pkg_path,
const char *optional_file, pkgmgr_mode mode,
GVariant *result;
int ret = PKGMGR_R_ECOMM;
char *req_key = NULL;
+ GVariantBuilder *builder = NULL;
+ GVariant *args = NULL;
int req_id;
pkgmgr_client_t *mpc = (pkgmgr_client_t *)pc;
char *pkgtype;
+ char *temp = NULL;
if (pc == NULL || pkg_path == NULL) {
ERR("invalid parameter");
return PKGMGR_R_EINVAL;
}
+ if (mpc->tep_path != NULL && access(mpc->tep_path, F_OK) != 0) {
+ ERR("failed to access: %s", mpc->tep_path);
+ return PKGMGR_R_EINVAL;
+ }
+
/* TODO: check pkg's type on server-side */
if (pkg_type == NULL)
pkgtype = __get_type_from_path(pkg_path);
else
pkgtype = strdup(pkg_type);
+ /* build arguments */
+ builder = g_variant_builder_new(G_VARIANT_TYPE("as"));
+ if (mpc->tep_path) {
+ g_variant_builder_add(builder, "s", "-e");
+ g_variant_builder_add(builder, "s", mpc->tep_path);
+ g_variant_builder_add(builder, "s", "-M");
+ g_variant_builder_add(builder, "s", mpc->tep_move);
+ }
+
+ args = g_variant_new("as", builder);
+ g_variant_builder_unref(builder);
+
result = comm_client_request(mpc->info.request.cc, "install",
- g_variant_new("(uss)", uid, pkgtype, pkg_path));
- free(pkgtype);
+ g_variant_new("(uss@as)", uid, pkgtype, pkg_path, args));
+
if (result == NULL)
return PKGMGR_R_ECOMM;
g_variant_get(result, "(i&s)", &ret, &req_key);
## Install
-INSTALL(TARGETS
- pkgmgr_installer_client
+INSTALL(TARGETS
+ pkgmgr_installer_client
pkgmgr_installer
DESTINATION ${LIB_INSTALL_DIR}
COMPONENT RuntimeLibraries)
-INSTALL(FILES
- comm_client.h
+INSTALL(FILES
+ comm_client.h
comm_config.h
pkgmgr_installer.h
DESTINATION include/pkgmgr)
-INSTALL(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer-client.pc
- ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer.pc
+INSTALL(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer-client.pc
+ ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer.pc
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
char *optional_data;
char *caller_pkgid;
uid_t target_uid;
+ char *tep_path;
+ int tep_move;
+ int is_tep_included;
GDBusConnection *conn;
};
return NULL;
}
+ pi->tep_path = NULL;
+ pi->tep_move = 0;
pi->request_type = PKGMGR_REQ_INVALID;
return pi;
free(pi->optional_data);
if (pi->caller_pkgid)
free(pi->caller_pkgid);
+ if (pi->tep_path)
+ free(pi->tep_path);
if (pi->conn) {
g_dbus_connection_flush_sync(pi->conn, NULL, NULL);
if (pi->pkgmgr_info)
free(pi->pkgmgr_info);
pi->pkgmgr_info = strndup(optarg, MAX_STRLEN);
+ DBG("option is [i] pkgid[%s]", pi->pkgmgr_info );
+ if (pi->pkgmgr_info && strlen(pi->pkgmgr_info)==0){
+ free(pi->pkgmgr_info);
+ }else{
+ mode = 'i';
+ }
+ break;
+
+ case 'e': /* install */
+ if (pi->tep_path)
+ free(pi->tep_path);
+ pi->tep_path = strndup(optarg, MAX_STRLEN);
+ pi->is_tep_included = 1;
+ DBG("option is [e] tep_path[%s]", pi->tep_path);
+ break;
+
+ case 'M': /* install */
+ if (strcmp(optarg, "tep_move") == 0)
+ pi->tep_move = 1;
+ else
+ pi->tep_move = 0;
+ DBG("option is [M] tep_move[%d]", pi->tep_move);
break;
case 'd': /* uninstall */
return pi->pkgmgr_info;
}
+API const char *pkgmgr_installer_get_tep_path(pkgmgr_installer *pi)
+{
+ CHK_PI_RET(PKGMGR_REQ_INVALID);
+ return pi->tep_path;
+}
+
+API int pkgmgr_installer_get_tep_move_type(pkgmgr_installer *pi)
+{
+ CHK_PI_RET(PKGMGR_REQ_INVALID);
+ return pi->tep_move;
+}
+
API const char *pkgmgr_installer_get_session_id(pkgmgr_installer *pi)
{
CHK_PI_RET(PKGMGR_REQ_INVALID);
*/
const char *pkgmgr_installer_get_request_info(pkgmgr_installer *pi);
+/**
+ @brief Get TEP path
+ @pre pkgmgr_installer_receive_request() must be called.
+ @post None
+ @see pkgmgr_installer_receive_request
+ @param[in] pi pkgmgr_installer object
+ @return TEP path if exists
+ @retval NULL on function failure
+ @remark Returned string must not be modified.
+ @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+ pkgmgr_installer *pi;
+ int r = 0;
+ char *tep_path = NULL;
+
+ pi = pkgmgr_installer_new();
+ if(!pi) return -1;
+ if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+ r = -1;
+ goto CLEANUP_RET;
+ }
+ tep_path = (char *) pkgmgr_installer_get_tep_path(pi);
+
+ // Do something...
+
+ pkgmgr_installer_free(pi);
+ return r;
+}
+@endcode
+ */
+const char *pkgmgr_installer_get_tep_path(pkgmgr_installer *pi);
+
+/**
+ @brief Get TEP move type
+ @pre pkgmgr_installer_receive_request() must be called.
+ @post None
+ @see pkgmgr_installer_receive_request
+ @param[in] pi pkgmgr_installer object
+ @return integer value indicates tep move type(0: copy TEP file / 1: move TEP file)
+ @retval 0 on function failure
+ @remark Returned string must not be modified.
+ @code
+#include <pkgmgr_installer.h>
+int main(int argc, char **argv)
+{
+ pkgmgr_installer *pi;
+ int r = 0;
+ int tep_move_type = -1;
+
+ pi = pkgmgr_installer_new();
+ if(!pi) return -1;
+ if(pkgmgr_installer_receive_request(pi, argc, argv)) {
+ r = -1;
+ goto CLEANUP_RET;
+ }
+ tep_move_type = pkgmgr_installer_get_tep_move_type(pi);
+
+ // Do something...
+
+ pkgmgr_installer_free(pi);
+ return r;
+}
+@endcode
+ */
+int pkgmgr_installer_get_tep_move_type(pkgmgr_installer *pi);
+
/**
@brief Get session ID for a certain session
@pre pkgmgr_installer_receive_request() must be called.
pkgmgr_installer_free(pi);
return r;
-}
+}
@endcode
*/
const char *pkgmgr_installer_get_session_id(pkgmgr_installer *pi);
pkgmgr_installer_free(pi);
return r;
-}
+}
@endcode
*/
const char *pkgmgr_installer_get_license_path(pkgmgr_installer *pi);
pkgmgr_installer_free(pi);
return r;
-}
+}
@endcode
*/
int pkgmgr_installer_is_quiet(pkgmgr_installer *pi);
const char *pkgmgr_installer_get_caller_pkgid(pkgmgr_installer *pi);
/**
- @brief Send a process status signal
+ @brief Send a process status signal
@pre None
@post None
@see None
pkgmgr_installer_free(pi);
return r;
-}
+}
@endcode
*/
int pkgmgr_installer_send_signal(pkgmgr_installer *pi,
#endif
/* Supported options */
-const char *short_opts = "k:l:i:d:c:m:t:o:r:p:s:q";
+const char *short_opts = "k:l:i:d:c:m:t:o:r:p:s:e:M:q";
const struct option long_opts[] = {
{ "session-id", 1, NULL, 'k' },
{ "license-path", 1, NULL, 'l' },
{ "optional-data", 0, NULL, 'o' },
{ "reinstall", 0, NULL, 'r' },
{ "caller-pkgid", 1, NULL, 'p' },
+ { "tep-path", 1, NULL, 'e' },
+ { "tep-move", 1, NULL, 'M' },
{ "smack", 1, NULL, 's' },
{ 0, 0, 0, 0 } /* sentinel */
};
%description types-devel
Package Manager client types develpoment package for packaging
-
%prep
%setup -q
cp %{SOURCE1001} %{SOURCE1002} %{SOURCE1003} %{SOURCE1004} %{SOURCE1005} %{SOURCE1006} .
/**
* @mainpage
- *
+ *
* This is package manager
*
* Packaeg manager is used to install/uninstall the packages.\n
* package includes dpkg, java, widget, etc. and it can be added\n
* Security is considered on current package manager\n
- *
+ *
*/
/**
#define PKG_VALUE_STRING_LEN_MAX 512
#define PKG_URL_STRING_LEN_MAX 1024
#define PKG_LABEL_STRING_LEN_MAX 128
+#define PKG_PATH_STRING_LEN_MAX 512
-/**
+/**
*@brief application's structure retrieved by package-manager
*/
typedef struct _package_manager_pkg_info_t {