set_target_properties(pkgmgr_installer PROPERTIES COMPILE_FLAGS "${installer_pkgs_CFLAGS_str}")
target_link_libraries(pkgmgr_installer ${installer_pkgs_LDFLAGS})
-
### Create pc file
configure_file(pkgmgr-installer.pc.in ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer.pc @ONLY)
-
## Install
-INSTALL(TARGETS
- pkgmgr_installer
- DESTINATION ${LIB_INSTALL_DIR}
- COMPONENT RuntimeLibraries)
-INSTALL(FILES
- pkgmgr_installer.h
- DESTINATION include/pkgmgr)
-
-
-INSTALL(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer.pc
- DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(TARGETS pkgmgr_installer DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
+INSTALL(FILES pkgmgr_installer.h DESTINATION include/pkgmgr)
+INSTALL(FILES pkgmgr_installer_info.h DESTINATION include/pkgmgr)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr-installer.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
#include "pkgmgr_installer.h"
#include "pkgmgr_installer_config.h"
#include "pkgmgr_installer_debug.h"
+#include "pkgmgr_installer_info.h"
#include "../client/include/comm_config.h"
GDBusConnection *conn;
};
+static uid_t g_target_uid;
+
static const char *__get_signal_name(pkgmgr_installer *pi, const char *key)
{
if (strcmp(key, PKGMGR_INSTALLER_INSTALL_PERCENT_KEY_STR) == 0)
int mode = 0;
pi->target_uid = getuid();
+ g_target_uid = pi->target_uid;
while (1) {
c = getopt_long(argc, argv, short_opts, long_opts, &opt_idx);
/* printf("c=%d %c\n", c, c); //debug */
return -1;
pi->target_uid = uid;
+ g_target_uid = pi->target_uid;
return 0;
}
ret = pkgmgrinfo_delete_certinfo(pkgid);
return ret;
}
+
+API int pkgmgr_installer_info_get_target_uid(uid_t *uid)
+{
+ *uid = g_target_uid;
+
+ return 0;
+}
--- /dev/null
+/*
+ * slp-pkgmgr
+ *
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#ifndef __PKGMGR_INSTALLER_INFO_H__
+#define __PKGMGR_INSTALLER_INFO_H__
+
+/**
+ * @file pkgmgr_installer_info.h
+ * @brief This file declares API for getting information of pkgmgr_installer
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Get target_uid for pkg to be installed path
+ * @pre None
+ * @post None
+ * @param[out] uid user id
+ * @return 0 if success, else retrun < 0
+ * @code
+ #include <pkgmgr_installer_info.h>
+ int main()
+ {
+ uid_t uid;
+ if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
+ printf("failed to get target uid\n");
+ }
+ printf("uid = %d\n", uid);
+ }
+ * @endcode
+ */
+int pkgmgr_installer_info_get_target_uid(uid_t *uid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __PKGMGR_INSTALLER_INFO_H__ */
+
%manifest %{name}-installer-devel.manifest
%defattr(-,root,root,-)
%dir %{_includedir}/pkgmgr
-%{_includedir}/pkgmgr/pkgmgr_installer.h
+%{_includedir}/pkgmgr/*.h
%{_libdir}/pkgconfig/pkgmgr-installer.pc
%{_libdir}/libpkgmgr_installer.so