Clean up repository 28/76728/1 accepted/tizen/common/20160703.125829 accepted/tizen/ivi/20160629.015701 accepted/tizen/mobile/20160629.015620 accepted/tizen/tv/20160629.015748 accepted/tizen/wearable/20160629.015551 submit/tizen/20160627.042541
authorSangyoon Jang <s89.jang@samsung.com>
Mon, 27 Jun 2016 05:25:51 +0000 (14:25 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Mon, 27 Jun 2016 05:26:16 +0000 (14:26 +0900)
Remove unused files. (pkg_initdb)
Remove excutable bit from source file.

Change-Id: I6ee19dc01abc79c99606c3be782906add45401b9
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
CMakeLists.txt
data/10_package-manager-add.post [deleted file]
packaging/pkgmgr-tool.spec
src/pkg_initdb.c [deleted file]
src/pkg_rsc_slice.c [changed mode: 0755->0644]

index f5612bb..b7a96db 100644 (file)
@@ -24,11 +24,6 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/client/include)
 
 INCLUDE(FindPkgConfig)
 
-pkg_check_modules(pkgs_initdb REQUIRED bundle pkgmgr-parser pkgmgr-info libtzplatform-config pkgmgr)
-FOREACH(flag ${pkgs_initdb_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
 pkg_check_modules(pkgs_test REQUIRED dlog glib-2.0 bundle pkgmgr pkgmgr-parser pkgmgr-info pkgmgr-installer
 libtzplatform-config aul)
 FOREACH(flag ${pkgs_test_CFLAGS})
@@ -67,8 +62,6 @@ ADD_EXECUTABLE(rsc-slice src/pkg_rsc_slice.c)
 TARGET_LINK_LIBRARIES(rsc-slice ${pkgs_test_LDFLAGS})
 INSTALL(TARGETS rsc-slice DESTINATION bin)
 
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/10_package-manager-add.post  DESTINATION ${SYSCONF_INSTALL_DIR}/gumd/useradd.d/)
-
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/mime.wac.xml DESTINATION /usr/share/mime/packages/)
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/mime.tpk.xml DESTINATION /usr/share/mime/packages/)
 
diff --git a/data/10_package-manager-add.post b/data/10_package-manager-add.post
deleted file mode 100644 (file)
index aa13d61..0000000
+++ /dev/null
@@ -1 +0,0 @@
-pkg_initdb --uid $2
index 6de46e9..7b9b010 100644 (file)
@@ -79,7 +79,6 @@ fi
 %dir %{_sysconfdir}/opt/upgrade
 %{_sysconfdir}/opt/upgrade/pkgmgr.patch.sh
 %{_bindir}/pkgcmd
-%attr(755,root,root) %{_sysconfdir}/gumd/useradd.d/10_package-manager-add.post
 %{_bindir}/pkg_getsize
 %{_bindir}/pkg_clearcache
 %{_bindir}/pkginfo
diff --git a/src/pkg_initdb.c b/src/pkg_initdb.c
deleted file mode 100644 (file)
index 8baa5f1..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
- * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
- *
- * 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.
- *
- */
-
-#define _GNU_SOURCE
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <errno.h>
-
-#include <pkgmgr_parser.h>
-#include <pkgmgr_parser_db.h>
-#include <pkgmgr-info.h>
-
-/* For multi-user support */
-#include <tzplatform_config.h>
-
-#define OWNER_ROOT 0
-#define GLOBAL_USER tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)
-#define BUFSZE 4096
-
-#ifdef _E
-#undef _E
-#endif
-#define _E(fmt, arg...) fprintf(stderr, "[PKG_INITDB][E][%s,%d] "fmt"\n", \
-               __FUNCTION__, __LINE__, ##arg);
-
-#ifdef _D
-#undef _D
-#endif
-#define _D(fmt, arg...) fprintf(stderr, "[PKG_INITDB][D][%s,%d] "fmt"\n", \
-               __FUNCTION__, __LINE__, ##arg);
-
-#define PKGINSTALLMANIFEST_CMD "/usr/bin/pkg-install-manifest"
-
-static int _is_global(uid_t uid)
-{
-       return (uid == OWNER_ROOT || uid == GLOBAL_USER) ? 1 : 0;
-}
-
-static int _initdb_load_directory(uid_t uid, const char *directory)
-{
-       DIR *dir;
-       struct dirent file_info;
-       struct dirent *result;
-       char buf[BUFSZE];
-       pid_t pid;
-       int status;
-
-       dir = opendir(directory);
-       if (!dir) {
-               _E("Failed to access the [%s] because %s", directory,
-                               strerror_r(errno, buf, sizeof(buf)));
-               return -1;
-       }
-
-       _D("Loading manifest files from %s", directory);
-
-       while (readdir_r(dir, &file_info, &result) == 0) {
-               if (result == NULL)
-                       break;
-               if (file_info.d_type != DT_REG)
-                       continue;
-
-               snprintf(buf, sizeof(buf), "%s/%s", directory,
-                               file_info.d_name);
-               _D("manifest file %s", buf);
-
-               pid = fork();
-               if (pid == 0) {
-                       if (setuid(uid) != 0) {
-                               _E("failed to set uid");
-                               closedir(dir);
-                               return -1;
-                       }
-
-                       execl(PKGINSTALLMANIFEST_CMD, PKGINSTALLMANIFEST_CMD,
-                                       "-x", buf, (char *)NULL);
-                       _E("failed to execute: %s",
-                                       strerror_r(errno, buf, sizeof(buf)));
-                       exit(EXIT_FAILURE);
-               } else if (pid < 0) {
-                       _E("failed to fork and execute %s!",
-                                       PKGINSTALLMANIFEST_CMD);
-                       closedir(dir);
-                       return -1;
-               } else {
-                       waitpid(pid, &status, 0);
-               }
-       }
-
-       closedir(dir);
-
-       return 0;
-}
-
-static int _is_authorized()
-{
-       /* pkg_init db should be called by as root privilege. */
-       uid_t uid = getuid();
-
-       if ((uid_t) OWNER_ROOT == uid)
-               return 1;
-       else
-               return 0;
-}
-
-static void _remove_old_dbs(uid)
-{
-       const char *info_db_path;
-       const char *info_db_journal_path;
-       const char *cert_db_path;
-       const char *cert_db_journal_path;
-
-       if (!_is_global(uid))
-               tzplatform_set_user(uid);
-
-       info_db_path = tzplatform_mkpath(
-                       _is_global(uid) ? TZ_SYS_DB : TZ_USER_DB,
-                       ".pkgmgr_parser.db");
-       info_db_journal_path = tzplatform_mkpath(
-                       _is_global(uid) ? TZ_SYS_DB : TZ_USER_DB,
-                       ".pkgmgr_parser.db-journal");
-       cert_db_path = tzplatform_mkpath(
-                       _is_global(uid) ? TZ_SYS_DB : TZ_USER_DB,
-                       ".pkgmgr_cert.db");
-       cert_db_journal_path = tzplatform_mkpath(
-                       _is_global(uid) ? TZ_SYS_DB : TZ_USER_DB,
-                       ".pkgmgr_cert.db-journal");
-
-       if (remove(info_db_path))
-               _E(" %s is not removed", info_db_path);
-       if (remove(info_db_journal_path))
-               _E(" %s is not removed", info_db_journal_path);
-       if (remove(cert_db_path))
-               _E(" %s is not removed", cert_db_path);
-       if (remove(cert_db_journal_path))
-               _E(" %s is not removed", cert_db_journal_path);
-
-       tzplatform_reset_user();
-}
-
-int main(int argc, char *argv[])
-{
-       int ret;
-       const char *dir;
-       const char *dir_rw;
-       uid_t uid = 0;
-
-       if (!_is_authorized()) {
-               _E("You are not an authorized user!");
-               return -1;
-       }
-
-       if (argc > 1)
-               uid = (uid_t)atoi(argv[1]);
-
-       _remove_old_dbs(uid);
-
-       ret = pkgmgr_parser_create_and_initialize_db(uid);
-       if (ret < 0) {
-               _E("cannot create db");
-               return -1;
-       }
-
-       if (_is_global(uid)) {
-               /* first, RO location */
-               dir = tzplatform_getenv(TZ_SYS_RO_PACKAGES);
-               ret = _initdb_load_directory(uid, dir);
-
-               /* second, RW location */
-               dir_rw = tzplatform_getenv(TZ_SYS_RW_PACKAGES);
-               if (dir && dir_rw)
-                       if (strcmp(dir, dir_rw))
-                               ret = _initdb_load_directory(uid, dir_rw);
-       } else {
-               /* specified user location */
-               tzplatform_set_user(uid);
-               dir = tzplatform_getenv(TZ_USER_PACKAGES);
-               ret = _initdb_load_directory(uid, dir);
-               tzplatform_reset_user();
-       }
-
-       return ret;
-}
old mode 100755 (executable)
new mode 100644 (file)