From 3ea6bd7b1ba605d7b9e52b281355842e1e0a53ff Mon Sep 17 00:00:00 2001 From: Youngbok Shin Date: Mon, 10 Oct 2016 17:35:37 +0900 Subject: [PATCH] Fix download-fonts-service package for Tizen 3.0 Change-Id: I49354bbab76c71d33ccd2c3b2c82f626664930d4 --- CMakeLists.txt | 2 +- download-fonts-service.manifest | 14 ------ packaging/download-fonts-service.manifest | 5 ++ packaging/download-fonts-service.spec | 16 ++++--- pkgmgr_font/CMakeLists.txt | 5 +- pkgmgr_font/src/font_service_register.c | 78 +++++++++++-------------------- 6 files changed, 45 insertions(+), 75 deletions(-) delete mode 100755 download-fonts-service.manifest create mode 100644 packaging/download-fonts-service.manifest mode change 100755 => 100644 packaging/download-fonts-service.spec diff --git a/CMakeLists.txt b/CMakeLists.txt index cc300bf..a6faea3 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ pkg_check_modules(pkg REQUIRED capi-system-system-settings elementary pkgmgr-info - security-server + pkgmgr-installer ) SET(PACKAGE "${PROJECT_NAME}") diff --git a/download-fonts-service.manifest b/download-fonts-service.manifest deleted file mode 100755 index b6c8305..0000000 --- a/download-fonts-service.manifest +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/packaging/download-fonts-service.manifest b/packaging/download-fonts-service.manifest new file mode 100644 index 0000000..a76fdba --- /dev/null +++ b/packaging/download-fonts-service.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/download-fonts-service.spec b/packaging/download-fonts-service.spec old mode 100755 new mode 100644 index 3e3986e..174fadd --- a/packaging/download-fonts-service.spec +++ b/packaging/download-fonts-service.spec @@ -1,23 +1,25 @@ Name: download-fonts-service -Summary: Master Download fonts service. -Version: 0.0.8 +Summary: Master Download fonts service +Version: 1.0.0 Release: 1 -Group: TO_BE / FILLED_IN +Group: Base/Package Management License: Apache-2.0 Source0: %{name}-%{version}.tar.gz +Source1001: download-fonts-service.manifest BuildRequires: cmake, gettext-tools, smack, coreutils BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(fontconfig) BuildRequires: pkgconfig(capi-system-system-settings) BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(pkgmgr-info) -BuildRequires: pkgconfig(security-server) +BuildRequires: pkgconfig(pkgmgr-installer) %description Master Download fonts service. %prep %setup -q +cp %{SOURCE1001} . %build %if 0%{?sec_build_binary_debug_enable} @@ -30,7 +32,7 @@ export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE" export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE" export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE" %endif -cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DPRODUCT=private +cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%jobs} @@ -38,9 +40,11 @@ CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%j rm -rf %{buildroot} %make_install +mkdir -p %{buildroot}%{_tmpfilesdir} + %files -n download-fonts-service %manifest download-fonts-service.manifest %defattr(-,root,root,-) -%{_prefix}/etc/package-manager/parserlib/category/* +/etc/package-manager/parserlib/category/* # End of a file diff --git a/pkgmgr_font/CMakeLists.txt b/pkgmgr_font/CMakeLists.txt index 7086af2..5d6424e 100755 --- a/pkgmgr_font/CMakeLists.txt +++ b/pkgmgr_font/CMakeLists.txt @@ -8,14 +8,13 @@ pkg_check_modules(bin_pkgs REQUIRED fontconfig capi-system-system-settings elementary - pkgmgr-info ) FOREACH(flag ${bin_pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -Wall -Werror") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g -Wall") ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") @@ -25,5 +24,5 @@ ADD_LIBRARY(${PROJECT_NAME} SHARED TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${bin_pkgs_LDFLAGS}) -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION "etc/package-manager/parserlib/category") +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION "/etc/package-manager/parserlib/category") # End of a file diff --git a/pkgmgr_font/src/font_service_register.c b/pkgmgr_font/src/font_service_register.c index 31e62e7..3147a7d 100755 --- a/pkgmgr_font/src/font_service_register.c +++ b/pkgmgr_font/src/font_service_register.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "system_settings.h" @@ -49,8 +49,8 @@ static const char *PRELOADED_PATH = "/opt/share/fonts/preloaded"; static const char *ELM_PROFILE_CFG = "/opt/home/app/.elementary/config/profile.cfg"; #define MAX_FILE_LEN 4096 -#define APP_OWNER_ID 5000 -#define APP_GROUP_ID 5000 +#define APP_OWNER_ID 5001 +#define APP_GROUP_ID 100 static int make_dir(const char *path); static int symbolic_link(const char *srcpath, const char *destpath); @@ -95,7 +95,14 @@ static int make_dir(const char *path) return ret; } - ret = chmod (path, 0755); + ret = chown(path, getuid(), APP_GROUP_ID); + if (ret < 0) + { + DEBUG_ERROR("chown is failed %s\n",path); + return ret; + } + + ret = chmod(path, 0755); if (ret < 0) { DEBUG_ERROR("chmod is failed %s\n",path); @@ -103,13 +110,6 @@ static int make_dir(const char *path) return ret; } } - ret = security_server_label_access(path, "_"); - - if (ret < 0) - { - DEBUG_ERROR("security_server_label_access is failed %s\n",path); - return ret; - } return ret; } @@ -174,14 +174,6 @@ static int symbolic_link(const char *srcpath, const char *destpath) DEBUG_ERROR("symlink is failed \n"); goto FAIL; } - - ret = security_server_label_access(destdir, "_"); - - if (ret < 0) - { - DEBUG_ERROR("security_server_label_access is failed %s\n",destdir); - goto FAIL; - } } } closedir (d); @@ -247,14 +239,6 @@ static int move_file(const char *srcpath, const char *destpath) DEBUG_ERROR("symlink is failed \n"); goto FAIL; } - - ret = security_server_label_access(destdir, "_"); - - if (ret < 0) - { - DEBUG_ERROR("security_server_label_access is failed %s\n",destdir); - goto FAIL; - } } } closedir (d); @@ -500,8 +484,11 @@ int COMMON_PKGMGR_PLUGIN_INSTALL(const char *pkgid, const char *appid, GList *li pkgmgrinfo_pkginfo_h handle = NULL; const char *app_root_path = NULL; const char *dest_path = NULL; + uid_t uid = 0; + + pkgmgr_installer_info_get_target_uid(&uid); + ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle); - ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle); if (ret < 0) { DEBUG_ERROR("pkgid[%s] handle get fail", pkgid); @@ -561,8 +548,11 @@ int COMMON_PKGMGR_PLUGIN_UPGRADE(const char *pkgid, const char *appid, GList *li pkgmgrinfo_pkginfo_h handle = NULL; const char* app_root_path = NULL; const char* dest_path = NULL; + uid_t uid = 0; + + pkgmgr_installer_info_get_target_uid(&uid); + ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle); - ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle); if (ret < 0) { DEBUG_ERROR("pkgid[%s] handle get fail", pkgid); @@ -594,7 +584,7 @@ int COMMON_PKGMGR_PLUGIN_UPGRADE(const char *pkgid, const char *appid, GList *li if (access(deletedir, F_OK) == -1) { - DEBUG_ERROR("dest directory is not exist \n"); + DEBUG_ERROR("dest directory(%s) is not exist: %s\n", deletedir, strerror(errno)); goto FAIL; } @@ -606,18 +596,16 @@ int COMMON_PKGMGR_PLUGIN_UPGRADE(const char *pkgid, const char *appid, GList *li } ret = make_dir(PARENT_PATH); - if (ret < 0) { - DEBUG_ERROR("make current directory is failed \n"); + DEBUG_ERROR("make current directory(%s) is failed: %s\n", PARENT_PATH, strerror(errno)); goto FAIL; } ret = make_dir(dest_path); - if (ret < 0) { - DEBUG_ERROR("make current directory is failed \n"); + DEBUG_ERROR("make current directory(%s) is failed: %s\n", dest_path, strerror(errno)); goto FAIL; } @@ -644,9 +632,11 @@ int COMMON_PKGMGR_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList * FcObjectSet *os = NULL; FcPattern *pat = NULL; FcFontSet *fs = NULL; + pkgmgrinfo_pkginfo_h handle = NULL; const char* app_root_path = NULL; const char *dest_path = NULL; int ret; + uid_t uid = 0; elm_init(0, NULL); @@ -656,10 +646,9 @@ int COMMON_PKGMGR_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList * return -1; } - pkgmgrinfo_pkginfo_h handle = NULL; - + pkgmgr_installer_info_get_target_uid(&uid); + ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle); - ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle); if (ret < 0) { DEBUG_ERROR("pkgid[%s] handle get fail", pkgid); @@ -753,12 +742,6 @@ int COMMON_PKGMGR_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList * chmod (ELM_PROFILE_CFG, 0777); } - ret = security_server_label_access(ELM_PROFILE_CFG, "system::homedir"); - if (ret < 0) - { - chmod (ELM_PROFILE_CFG, 0777); - } - DIR *d = NULL; struct dirent *e; @@ -781,13 +764,6 @@ int COMMON_PKGMGR_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList * DEBUG_LOG("chown is failed %s", file_full_path); chmod (file_full_path, 0777); } - - ret = security_server_label_access(file_full_path, "system::homedir"); - if (ret < 0) - { - DEBUG_LOG("chsmack is failed %s", file_full_path); - chmod (file_full_path, 0777); - } } } @@ -805,7 +781,7 @@ int COMMON_PKGMGR_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList * if (access(deletedir, F_OK) == -1) { - DEBUG_ERROR("dest directory(%s) is not exist \n", deletedir); + DEBUG_ERROR("dest directory(%s) is not exist: %s\n", deletedir, strerror(errno)); goto FAIL; } -- 2.7.4