From 7a56e0752825d080ae2e3e56a4f6120ba8d1d7a3 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Tue, 25 Apr 2017 17:54:51 +0900 Subject: [PATCH 01/16] Release version 0.3.4 Changes: - Fix bug about sdcard api - Fix cleardata tool - Apply taget_uid for GET_PKG_SIZE_INFO_REQ Change-Id: Id1d1342afddb8af3bc6b0913512d672ae2830345 Signed-off-by: Junghyun Yeon --- packaging/pkgmgr-tool.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/pkgmgr-tool.spec b/packaging/pkgmgr-tool.spec index a3dea53..7cace6d 100644 --- a/packaging/pkgmgr-tool.spec +++ b/packaging/pkgmgr-tool.spec @@ -1,6 +1,6 @@ Name: pkgmgr-tool Summary: Packager Manager Tool package -Version: 0.3.3 +Version: 0.3.4 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 6006552d2559bb8086a3c6812eb2dfbb0b9b6abf Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Wed, 17 May 2017 14:25:56 +0900 Subject: [PATCH 02/16] Modify calculation logic for data and cache. Exclude the data or cache in the global directory from the calculation of data or cache size. Change-Id: I2830772de8046e6b8000624c9d0e3907fa7903da Signed-off-by: jongmyeongko --- src/pkg_getsize.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pkg_getsize.c b/src/pkg_getsize.c index 6b68a7a..5877f23 100644 --- a/src/pkg_getsize.c +++ b/src/pkg_getsize.c @@ -530,8 +530,10 @@ static int __calculate_pkg_size_info(STORAGE_TYPE type, LOGE("Calculating data directory failed."); goto error; } - *data_size += size; - LOGD("data_size: %lld", *data_size); + if (type != STORAGE_TYPE_INTERNAL_GLOBAL_PATH) { + *data_size += size; + LOGD("data_size: %lld", *data_size); + } } else if (strncmp(name, "cache", strlen("cache")) == 0) { LOGD("traverse path: %s/%s", app_root_dir, name); ret = fstat(subfd, &st); @@ -546,8 +548,10 @@ static int __calculate_pkg_size_info(STORAGE_TYPE type, LOGE("Calculating cache directory failed."); goto error; } - *cache_size += size; - LOGD("cache_size: %lld", *cache_size); + if (type != STORAGE_TYPE_INTERNAL_GLOBAL_PATH) { + *cache_size += size; + LOGD("cache_size: %lld", *cache_size); + } } else if (strncmp(name, "shared", strlen("shared")) == 0) { ret = __calculate_shared_dir_size(dfd, app_root_dir, data_size, app_size, cache_size); -- 2.7.4 From 117a94d9aacd253b92fd0b64300f214459e84c13 Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Wed, 17 May 2017 16:29:48 +0900 Subject: [PATCH 03/16] Release version 0.3.5 Changes: - Modify calculation logic for data and cache Change-Id: Ib6c7ddd6debbaadea36650e417ac9a1b2dd0f753 Signed-off-by: jongmyeongko --- packaging/pkgmgr-tool.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/pkgmgr-tool.spec b/packaging/pkgmgr-tool.spec index 7cace6d..186a4e0 100644 --- a/packaging/pkgmgr-tool.spec +++ b/packaging/pkgmgr-tool.spec @@ -1,6 +1,6 @@ Name: pkgmgr-tool Summary: Packager Manager Tool package -Version: 0.3.4 +Version: 0.3.5 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From f58e1ec4645dece664606217783e518fa6b867ee Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Thu, 18 May 2017 21:22:49 +0900 Subject: [PATCH 04/16] Fix bug on pkg_getsize - Signal for uid doesn't work Change-Id: Iebdf076ec74c011b6c74582de7b7f4d1e3f62897 Signed-off-by: jongmyeongko --- src/pkg_getsize.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pkg_getsize.c b/src/pkg_getsize.c index 5877f23..fb47829 100644 --- a/src/pkg_getsize.c +++ b/src/pkg_getsize.c @@ -792,7 +792,7 @@ static int __send_sizeinfo_cb(const pkgmgrinfo_pkginfo_h handle, if (ret) return ret; - ret = pkgmgr_installer_send_signal_for_uid(pi, caller_uid, + ret = pkgmgr_installer_send_signal_for_uid(pi, target_uid, PKGMGR_INSTALLER_GET_SIZE_KEY_STR, pkgid, data_buf, total_buf); @@ -817,7 +817,7 @@ static int __send_result_to_signal(pkgmgr_installer *pi, const char *req_key, return ret; } - ret = pkgmgr_installer_send_signal_for_uid(pi, caller_uid, + ret = pkgmgr_installer_send_signal_for_uid(pi, target_uid, PKGMGR_INSTALLER_GET_SIZE_KEY_STR, pkgid, PKGMGR_INSTALLER_GET_SIZE_KEY_STR, info_str); free(info_str); @@ -970,7 +970,7 @@ int main(int argc, char *argv[]) PKGMGR_INSTALLER_GET_SIZE_KEY_STR, PKGMGR_INSTALLER_END_KEY_STR)) LOGE("failed to send finished signal"); - if (pkgmgr_installer_send_signal_for_uid(pi, caller_uid, + if (pkgmgr_installer_send_signal_for_uid(pi, target_uid, PKGMGR_INSTALLER_GET_SIZE_KEY_STR, pkgid, PKGMGR_INSTALLER_GET_SIZE_KEY_STR, -- 2.7.4 From 61adad28150b6f157740fe7a3aadd474e6e22d03 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Thu, 1 Jun 2017 09:26:10 +0900 Subject: [PATCH 05/16] Release version 0.3.6 Changes: - Fix bug on pkg_getsize Change-Id: Ifa8aa46811ea2e2d69203597fd6899dd7922711a Signed-off-by: Junghyun Yeon --- packaging/pkgmgr-tool.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/pkgmgr-tool.spec b/packaging/pkgmgr-tool.spec index 186a4e0..27ab229 100644 --- a/packaging/pkgmgr-tool.spec +++ b/packaging/pkgmgr-tool.spec @@ -1,6 +1,6 @@ Name: pkgmgr-tool Summary: Packager Manager Tool package -Version: 0.3.5 +Version: 0.3.6 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 056e3d08492cfe1963606cebcdf5135364f603b1 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Wed, 31 May 2017 19:00:57 +0900 Subject: [PATCH 06/16] Change scripts - Remove scripts for pkg_initdb - Add initial label change script Change-Id: Ifcf7aceb5f08c10dc0658e3da29cae5ba21b9e08 Signed-off-by: Junghyun Yeon --- CMakeLists.txt | 2 ++ data/pkgmgr-label-initial-image.sh.in | 49 +++++++++++++++++++++++++++++++++++ packaging/pkgmgr-tool.spec | 15 +---------- 3 files changed, 52 insertions(+), 14 deletions(-) create mode 100644 data/pkgmgr-label-initial-image.sh.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ed804d..f663436 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,8 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/data/pkgmgr-create-delta.sh.in pkgmgr-create- INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgmgr-create-delta.sh DESTINATION ${SYSCONF_INSTALL_DIR}/package-manager/) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/data/pkgmgr-clear-skel.sh.in pkgmgr-clear-skel.sh @ONLY) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgmgr-clear-skel.sh DESTINATION /usr/share/fixed_multiuser/scripts/) +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/data/pkgmgr-label-initial-image.sh.in pkgmgr-label-initial-image.sh @ONLY) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgmgr-label-initial-image.sh DESTINATION ${SYSCONF_INSTALL_DIR}/package-manager/) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/data/700.pkgmgr.patch.sh.in 700.pkgmgr.patch.sh @ONLY) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/700.pkgmgr.patch.sh DESTINATION /usr/share/upgrade/scripts/) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/data/701.app2sd.patch.sh.in 701.app2sd.patch.sh @ONLY) diff --git a/data/pkgmgr-label-initial-image.sh.in b/data/pkgmgr-label-initial-image.sh.in new file mode 100644 index 0000000..610c88f --- /dev/null +++ b/data/pkgmgr-label-initial-image.sh.in @@ -0,0 +1,49 @@ +#!/bin/sh +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +echo "----------------------------------" +echo " Labeling for some installed files" +echo "----------------------------------" + +_ro_packages_dir="/usr/share/packages" +_rw_packages_dir="/opt/share/packages" +_skel_dir="/etc/skel/apps_rw" +_subdir_list="$(dir $_skel_dir)" + +for entry in "$_ro_packages_dir"/*.xml; do + if [ -f "$entry" ]; then + chsmack -a "System" $entry + fi +done + +for entry in "$_rw_packages_dir"/*.xml; do + if [ -f "$entry" ]; then + chsmack -a "System" $entry + fi +done + +for entry in $_subdir_list; do + _bin_symlink="$_skel_dir/$entry/bin" + _lib_symlink="$_skel_dir/$entry/lib" + _res_symlink="$_skel_dir/$entry/res" + _shared_res_symlink="$_skel_dir/$entry/shared/res" + + _target_list=" \ + $_bin_symlink \ + $_lib_symlink \ + $_res_symlink \ + $_shared_res_symlink" + + for sub_entry in $_target_list; do + if [ -h "$sub_entry" ]; then + chsmack -a "User::Home" $sub_entry + fi + done + + for sub_entry in "$_skel_dir/$entry"/*.xml; do + if [ -h "$sub_entry" ]; then + chsmack -a "User::Home" $sub_entry + fi + done +done + diff --git a/packaging/pkgmgr-tool.spec b/packaging/pkgmgr-tool.spec index 27ab229..e060666 100644 --- a/packaging/pkgmgr-tool.spec +++ b/packaging/pkgmgr-tool.spec @@ -55,20 +55,6 @@ mkdir -p %{buildroot}%{_sysconfdir}/opt/upgrade # Update mime database to support package mime types update-mime-database %{_datadir}/mime -%posttrans -if [ ! -f %{TZ_SYS_DB}/.pkgmgr_parser.db ]; then - pkg_initdb --ro - install_preload_pkg - if [ -f /tmp/.preload_install_error ]; then - if [ ! -d /tmp/.postscript/error ]; then - mkdir -p /tmp/.postscript/error - fi - echo "preload install failed" > /tmp/.postscript/error/%{name}_error - else - pkgcmd -l - fi -fi - %files %manifest %{name}.manifest %license LICENSE @@ -89,3 +75,4 @@ fi %attr(0700,root,root) /usr/share/upgrade/scripts/701.app2sd.patch.sh %attr(0700,root,root) %{_sysconfdir}/opt/upgrade/pkgmgr.patch.sh %attr(0700,root,root) /usr/share/fixed_multiuser/scripts/pkgmgr-clear-skel.sh +%attr(0700,root,root) %{_sysconfdir}/package-manager/pkgmgr-label-initial-image.sh -- 2.7.4 From 7c5413bd427c5cc61617637020ffea60299a0fff Mon Sep 17 00:00:00 2001 From: jongmyeongko Date: Tue, 13 Jun 2017 21:44:04 +0900 Subject: [PATCH 07/16] Release version 0.3.7 Changes: - Change scripts Change-Id: Ic1b6d46eae756459c5afda6c48e4f6d5ecccd9d8 Signed-off-by: jongmyeongko --- packaging/pkgmgr-tool.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/pkgmgr-tool.spec b/packaging/pkgmgr-tool.spec index e060666..581fa2b 100644 --- a/packaging/pkgmgr-tool.spec +++ b/packaging/pkgmgr-tool.spec @@ -1,6 +1,6 @@ Name: pkgmgr-tool Summary: Packager Manager Tool package -Version: 0.3.6 +Version: 0.3.7 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 73a504010bbf88b42072c715cd9bed434e63e74f Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Tue, 13 Jun 2017 19:47:19 +0900 Subject: [PATCH 08/16] Fix upgrade script - copy manifest of user tpk file to manifest location to be initialized by pkg_initdb - get user wgt packages and invoke backend to be initialized - Add initialization of restriction db Change-Id: If92bfdd7346f5ce2e30e00c1d920b23a285ed993 Signed-off-by: Junghyun Yeon --- data/700.pkgmgr.patch.sh.in | 61 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/data/700.pkgmgr.patch.sh.in b/data/700.pkgmgr.patch.sh.in index cb154b9..e845d9c 100644 --- a/data/700.pkgmgr.patch.sh.in +++ b/data/700.pkgmgr.patch.sh.in @@ -39,6 +39,8 @@ TIZEN_MANIFEST=tizen-manifest.xml OWNER_SYSTEM_SHARE=owner:system_share TRUSTED_LABEL=User::Author::1 +RESTRICTION_DBPATH=/var/lib/package-manager +RESTRICTION_DBNAME=restriction.db #---------------------------------- # upgrade script for pkgmgr #---------------------------------- @@ -48,6 +50,15 @@ function backup_db(){ mv $PARSER_DB_PATH $PARSER_BACKUP_DB_PATH } +function create_restriction_db(){ + echo "#create restriction db" + local restriction_db=$RESTRICTION_DBPATH/$RESTRICTION_DBNAME + mkdir -p $RESTRICTION_DBPATH + echo "PRAGMA journal_mode=WAL; + CREATE TABLE restriction (uid INTEGER NOT NULL, pkgid TEXT NOT NULL, mode INTEGER NOT NULL, UNIQUE(uid, pkgid));" | + sqlite3 $restriction_db +} + function remove_modified_manifest(){ echo "#remove modified manifest" rm -rf $DEFAULT_PKG_MANIFEST_LOCATION/* @@ -55,10 +66,15 @@ function remove_modified_manifest(){ function remove_unregistered_pkg(){ #remove pkg folder which is not registered at pkg db - rm -rf $OPT_USR_APPS/media-server - rm -rf $OPT_USR_APPS/org.tizen.indicator_Shm - rm -rf $OPT_USR_APPS/org.tizen.sound-player - rm -rf $OPT_USR_APPS/tmp + ls $OPT_USR_APPS/ | while read FOLDER + do + result=$(sqlite3 $PARSER_BACKUP_DB_PATH "SELECT COUNT(*) FROM package_info WHERE package='$FOLDER';") + if [ $result != "1" ] + then + echo "delete unregistered package directory $OPT_USR_APPS/$FOLDER" + rm -r $OPT_USR_APPS/$FOLDER + fi + done } function move_user_tpk_ro_files(){ @@ -103,6 +119,11 @@ function move_user_tpk_rw_files(){ rm -rf $DEFAULT_PKG_APP_LOCATION/$package/shared/cache } +function copy_user_tpk_manifest(){ + local package=$1 + cp $DEFAULT_PKG_APP_LOCATION/$1/$TIZEN_MANIFEST $DEFAULT_PKG_MANIFEST_LOCATION/$package.xml +} + function move_user_tpk_files(){ echo "#move user TPK's files" echo "SELECT package FROM package_info WHERE package_preload='false' COLLATE NOCASE AND package_type='tpk' COLLATE NOCASE;" | @@ -113,6 +134,7 @@ function move_user_tpk_files(){ echo "processing user tpk $package..." move_user_tpk_ro_files $package move_user_tpk_rw_files $package + copy_user_tpk_manifest $package done < $DB_RESULT_FILE rm -f $DB_RESULT_FILE } @@ -254,7 +276,7 @@ function disable_preload_pkg(){ while read package do - echo "disable preload tpk, rpm $package..." + echo "disable preload pkg $package..." tpk-backend -D $package --preload done < $DB_RESULT_FILE rm -f $DB_RESULT_FILE @@ -283,8 +305,10 @@ function disable_user_pkg(){ while read package type do + echo "disable user pkg $package..." + echo "$type-backend -D $package" $type-backend -D $package - done < $DB_RESULT_FILE + done < $DB_RESULT_FILE rm -f $DB_RESULT_FILE } @@ -292,8 +316,31 @@ function remove_backup_db(){ rm $PARSER_BACKUP_DB_PATH } +function init_user_wgt_packages(){ + echo "#init user wgt packages" + echo ".separator \" \" + SELECT package FROM package_info WHERE package_preload='false' COLLATE NOCASE AND package_type='wgt';" | + sqlite3 $PARSER_BACKUP_DB_PATH > $DB_RESULT_FILE + + while read package + do + echo "init user wgt package $package..." + wgt-backend -y $package + done < $DB_RESULT_FILE + rm -f $DB_RESULT_FILE +} + +function migrate_external_info(){ + echo "#migrate external storage info" + echo "ATTACH DATABASE '$PARSER_BACKUP_DB_PATH' AS backup; + UPDATE package_info set installed_storage='installed_external' WHERE package IN (SELECT package FROM backup.package_info WHERE installed_storage='installed_external' COLLATE NOCASE);" | + sqlite3 $PARSER_DB_PATH +} + backup_db +create_restriction_db + remove_modified_manifest remove_unregistered_pkg @@ -301,11 +348,13 @@ move_user_tpk_files move_user_wgt_files initdb +init_user_wgt_packages remove_files_for_deleted_packages move_preload_pkg_userdata disable_preload_pkg disable_user_pkg +migrate_external_info remove_backup_db -- 2.7.4 From 9111402dcf66cf0d2f5a5d2e84cc43e8c5669818 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Fri, 30 Jun 2017 11:09:59 +0900 Subject: [PATCH 09/16] Release version 0.3.8 Changes: - Fix upgrade script Change-Id: I1d93cb63643d449d84d23cae1b6c1d45858492bd Signed-off-by: Sangyoon Jang --- packaging/pkgmgr-tool.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/pkgmgr-tool.spec b/packaging/pkgmgr-tool.spec index 581fa2b..dd1adb5 100644 --- a/packaging/pkgmgr-tool.spec +++ b/packaging/pkgmgr-tool.spec @@ -1,6 +1,6 @@ Name: pkgmgr-tool Summary: Packager Manager Tool package -Version: 0.3.7 +Version: 0.3.8 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From 7e591af0c1509526d4d84fc0a564ca2925155e62 Mon Sep 17 00:00:00 2001 From: Bartlomiej Kunikowski Date: Mon, 3 Jul 2017 06:29:55 +0000 Subject: [PATCH 10/16] Revert "Add new error handling" This reverts commit 36b92948c41e6f459a89488f6162abd78f69493d. Change-Id: I5b70c9fe3580e2df303b0dffb7a14927b687914c --- src/pkg_cmd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/pkg_cmd.c b/src/pkg_cmd.c index 2ecdd02..813bd2e 100644 --- a/src/pkg_cmd.c +++ b/src/pkg_cmd.c @@ -160,9 +160,6 @@ static void __error_no_to_string(int errnumber, char **errstr) if (errstr == NULL) return; switch (errnumber) { - case PKGMGR_INSTALLER_ERRCODE_RECOVERY_DONE: - *errstr = PKGMGR_INSTALLER_ERRCODE_RECOVERY_DONE_STR; - break; case PKGMGR_INSTALLER_ERRCODE_GLOBALSYMLINK_ERROR: *errstr = PKGMGR_INSTALLER_ERRCODE_GLOBALSYMLINK_ERROR_STR; break; -- 2.7.4 From 67931845cbcba1781c68f669e481247b5337ae1f Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 4 Jul 2017 10:40:16 +0900 Subject: [PATCH 11/16] Release version 0.3.9 Changes: - Fix build break Change-Id: I73917bf9ff4ce78ea627ecd9a873bdc399307820 Signed-off-by: Sangyoon Jang --- packaging/pkgmgr-tool.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/pkgmgr-tool.spec b/packaging/pkgmgr-tool.spec index dd1adb5..a06538d 100644 --- a/packaging/pkgmgr-tool.spec +++ b/packaging/pkgmgr-tool.spec @@ -1,6 +1,6 @@ Name: pkgmgr-tool Summary: Packager Manager Tool package -Version: 0.3.8 +Version: 0.3.9 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From e37b45938ea1e8d64ab0ced11d80efccf55846f8 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 25 Jul 2017 15:14:10 +0900 Subject: [PATCH 12/16] Fix code style Change-Id: Ice9a07a1cbca9b2fec964a79184ceab6af9edc1e Signed-off-by: Sangyoon Jang --- src/install_preload_pkg.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/install_preload_pkg.c b/src/install_preload_pkg.c index 4ed08f9..58439e5 100644 --- a/src/install_preload_pkg.c +++ b/src/install_preload_pkg.c @@ -58,7 +58,7 @@ static int _install_preload_pkg(const char *backend, const char *directory, bool readonly) { DIR *dir; - struct dirent *file_info = NULL; + struct dirent *file_info; int ret; char file_path[BUFSZE]; char err_buf[BUFSZE]; @@ -69,7 +69,7 @@ static int _install_preload_pkg(const char *backend, const char *directory, _D("The directory for preloaded pkgs doesn't exist"); return 0; } else { - _E("Failed to access the [%s] because [%s]", directory, + _E("Failed to access [%s]: [%s]", directory, strerror_r(errno, err_buf, sizeof(err_buf))); return -1; } @@ -88,7 +88,7 @@ static int _install_preload_pkg(const char *backend, const char *directory, pid_t pid = fork(); if (pid == 0) { execl(backend, backend, "-i", file_path, - readonly? "--preload":"--preload-rw", + readonly ? "--preload" : "--preload-rw", (char *)NULL); } else if (pid < 0) { _E("failed to fork and execute %s!", backend); @@ -101,12 +101,13 @@ static int _install_preload_pkg(const char *backend, const char *directory, waitpid(pid, &status, 0); } - /* remove a file after installation */ - /* keep rw packages for factory-reset */ + /* remove a file after installation, + * keep rw packages for factory-reset + */ if (readonly) { ret = remove(file_path); if (ret < 0) { - _E("Failed to remove the file [%s] because [%s]", + _E("Failed to remove [%s]: [%s]", file_path, strerror_r(errno, err_buf, sizeof(err_buf))); closedir(dir); @@ -123,7 +124,7 @@ static int _install_preload_pkg(const char *backend, const char *directory, static int _is_authorized(uid_t uid) { /* install_preload_pkg should be called by as root privilege. */ - if ((uid_t) OWNER_ROOT == uid) + if ((uid_t)OWNER_ROOT == uid) return 1; else return 0; @@ -133,7 +134,7 @@ int main(int argc, char *argv[]) { char err_msg[BUFSZE]; int handle = -1; - int ret = 0; + int ret; if (!_is_authorized(getuid())) { _E("You are not an authorized user!"); @@ -161,8 +162,7 @@ error: _E("Failed to open error file"); return -1; } - snprintf(err_msg, sizeof(err_msg), - "install_preload_pkg error!\n"); + snprintf(err_msg, sizeof(err_msg), "install_preload_pkg error!\n"); ret = write(handle, err_msg, strlen(err_msg)); if (ret == -1) _E("Failed to write an error message. (%d)", errno); -- 2.7.4 From 31451842a835f0947335363efb695fd4981fd0a1 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 25 Jul 2017 14:59:13 +0900 Subject: [PATCH 13/16] Skip checking reference when installing preload pkgs Requires: - https://review.tizen.org/gerrit/139436 Change-Id: I44eae5ac3c05fe14fe0bceb084bf1f3e06456515 Signed-off-by: Sangyoon Jang --- src/install_preload_pkg.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/install_preload_pkg.c b/src/install_preload_pkg.c index 58439e5..8fda943 100644 --- a/src/install_preload_pkg.c +++ b/src/install_preload_pkg.c @@ -55,7 +55,7 @@ #define WGT_RW_DIR tzplatform_mkpath(TZ_SYS_RO_APP, ".preload-rw-wgt") static int _install_preload_pkg(const char *backend, const char *directory, - bool readonly) + bool readonly, bool skip_reference_check) { DIR *dir; struct dirent *file_info; @@ -89,6 +89,9 @@ static int _install_preload_pkg(const char *backend, const char *directory, if (pid == 0) { execl(backend, backend, "-i", file_path, readonly ? "--preload" : "--preload-rw", + skip_reference_check ? + "--skip-check-reference" : + "", (char *)NULL); } else if (pid < 0) { _E("failed to fork and execute %s!", backend); @@ -135,22 +138,30 @@ int main(int argc, char *argv[]) char err_msg[BUFSZE]; int handle = -1; int ret; + bool skip_reference_check = false; if (!_is_authorized(getuid())) { _E("You are not an authorized user!"); return -1; } - if (_install_preload_pkg(TPK_BACKEND_CMD, TPK_DIR, true) < 0) + if (argc > 1 && !strcmp(argv[1], "--skip-reference-check")) + skip_reference_check = true; + + if (_install_preload_pkg(TPK_BACKEND_CMD, TPK_DIR, true, + skip_reference_check) < 0) goto error; - if (_install_preload_pkg(WGT_BACKEND_CMD, WGT_DIR, true) < 0) + if (_install_preload_pkg(WGT_BACKEND_CMD, WGT_DIR, true, + skip_reference_check) < 0) goto error; - if (_install_preload_pkg(TPK_BACKEND_CMD, TPK_RW_DIR, false) < 0) + if (_install_preload_pkg(TPK_BACKEND_CMD, TPK_RW_DIR, false, + skip_reference_check) < 0) goto error; - if (_install_preload_pkg(WGT_BACKEND_CMD, WGT_RW_DIR, false) < 0) + if (_install_preload_pkg(WGT_BACKEND_CMD, WGT_RW_DIR, false, + skip_reference_check) < 0) goto error; return 0; -- 2.7.4 From d30843ff4f640fd485a7b7fbb374fc7708821c0c Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 1 Aug 2017 14:40:57 +0900 Subject: [PATCH 14/16] Release version 0.3.10 Changes: - Fix code style - Skip checking reference when installing preload pkgs Change-Id: Iac173e0899f1d0827a32acfe239d570fbcca2cc6 Signed-off-by: Sangyoon Jang --- packaging/pkgmgr-tool.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/pkgmgr-tool.spec b/packaging/pkgmgr-tool.spec index a06538d..1094d74 100644 --- a/packaging/pkgmgr-tool.spec +++ b/packaging/pkgmgr-tool.spec @@ -1,6 +1,6 @@ Name: pkgmgr-tool Summary: Packager Manager Tool package -Version: 0.3.9 +Version: 0.3.10 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4 From c6cab34bcce3e4e203dee0b588581f6dcbcb0745 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 25 Jul 2017 19:24:08 +0900 Subject: [PATCH 15/16] Support move to extended Change-Id: Ibd99fb34a05bda84c44d20ca89b6ff14cba57e07 Signed-off-by: Sangyoon Jang --- src/pkg_cmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pkg_cmd.c b/src/pkg_cmd.c index 813bd2e..14e80be 100644 --- a/src/pkg_cmd.c +++ b/src/pkg_cmd.c @@ -420,7 +420,7 @@ static void __print_usage() printf("-p, --package-path provide package path\n"); printf("-n, --package-name provide package name\n"); printf("-t, --package-type provide package type\n"); - printf("-T, --move-type provide move type [0: move to internal / 1: move to external]\n"); + printf("-T, --move-type provide move type [0: move to internal / 1: move to external / 2: move to extended]\n"); printf(" --global Global Mode [Warning: user should be privilegied to use this mode]\n"); printf(" --uid Specify target user's id. This only affect app activation/deactivation.\n"); printf("-e, --tep-path provide TEP package path\n"); @@ -1015,7 +1015,7 @@ static int __process_request(uid_t target_uid) ret = -1; break; } - if (data.type < 0 || data.type > 1) { + if (data.type < 0 || data.type > 2) { printf("Invalid move type...See usage\n"); ret = -1; break; -- 2.7.4 From adb1697a70cf5ecfc72f97c886f359674f6bd3f4 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Fri, 4 Aug 2017 14:45:19 +0900 Subject: [PATCH 16/16] Release version 0.3.11 Changes: - Support move to extended Change-Id: I7dac639bb1a67467e35bc59020d7cb7a8fe3f594 Signed-off-by: Junghyun Yeon --- packaging/pkgmgr-tool.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/pkgmgr-tool.spec b/packaging/pkgmgr-tool.spec index 1094d74..09acd57 100644 --- a/packaging/pkgmgr-tool.spec +++ b/packaging/pkgmgr-tool.spec @@ -1,6 +1,6 @@ Name: pkgmgr-tool Summary: Packager Manager Tool package -Version: 0.3.10 +Version: 0.3.11 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 -- 2.7.4